need a bit of help identifly a variable -
cssbart - 06.04.2012
in this script
http://pastebin.com/ac8eUr5U
what does the "i" mean eg giveplayerid
Re: need a bit of help identifly a variable -
Jack.7331 - 06.04.2012
"i" is who it's being sent to, or the playerid, basically.
Re: need a bit of help identifly a variable -
cssbart - 06.04.2012
its from raven's roleplay but i cant find where its set so i dont know what i is
Re: need a bit of help identifly a variable -
MadeMan - 06.04.2012
Here
pawn Код:
for(new i=0; i < MAX_PLAYERS; i++)
Re: need a bit of help identifly a variable -
Kindred - 06.04.2012
Quote:
Originally Posted by MadeMan
Here
pawn Код:
for(new i=0; i < MAX_PLAYERS; i++)
|
He's not asking how to do it, he's asking what the i "means". (this is already in the script he showed)
That is basicly stating that it loops through all online players, and the i is all the players. So, for example, the i != playerid means if the looped players are not the playerid (if not correct).
Good luck, hope I helped.
Re: need a bit of help identifly a variable -
MadeMan - 06.04.2012
Quote:
Originally Posted by KurtBag
He's not asking how to do it, he's asking what the i "means". (this is already in the script he showed)
That is basicly stating that it loops through all online players, and the i is all the players. So, for example, the i != playerid means if the looped players are not the playerid (if not correct).
Good luck, hope I helped.
|

I know, because I copied it from his code to show him where the 'i' is declared.
And 'i' is not 'all players', it's a normal variable like 'new Float:X' or 'new iname'. It loops through all player IDs from 0 to MAX_PLAYERS (usually 500). So it runs the code in the 'for' block 500 times, and every time does 'i++' (i=i+1) at the end of the block. So when running the code first time, i=0, second time i=1, then i=2, i=3 .... i=499, because 499 is the biggest value (player ID) where 'i < 500' is true. And 'i != playerid' means if the looped ID is not the ID of the player who pressed the key.
You should read this to learn more about the 'for loop' -
https://sampwiki.blast.hk/wiki/Control_S...res#for_.28.29
Re: need a bit of help identifly a variable -
ivanVU - 06.04.2012
in this code "i" is for each player that is in range of this
Quote:
if(IsPlayerInRangeOfPoint(i,60, pX,pY,pZ))
|
it will hit him with tazer