Thread: for
View Single Post
  #13  
Old 02-21-2005, 02:59 AM
falco10291029 falco10291029 is offline
BEst User EVER!
Join Date: Apr 2004
Posts: 1,186
falco10291029 is on a distinguished road
yes I suppose it actually replaces for with combo if you need to use for-each.

What i mean by this is:

NPC Code:

for (pl: allplayers) {
if (pl.client.hp>1000) {
pl.chat="I am Hacking!";
sendtorc(pl.account @ "is Hacking");//I think i did that part right, not entirely sure though
}
}


replaces:
NPC Code:

for (i=0;i<allplayerscount;i++) {
with(allplayers[i]) {
if (strtofloat(#s(client.hp))>1000) {
setplayerprop#c, I am hacking!;
sendtorc #a is hacking!;
}
}
}

__________________
BEst Insult ever: If I had a dollar for every brain you DIDNT have, i'd have one dollar!

Last edited by falco10291029; 02-21-2005 at 03:10 AM..