need a bit of help identifly a variable
#1

in this script
http://pastebin.com/ac8eUr5U
what does the "i" mean eg giveplayerid
Reply
#2

"i" is who it's being sent to, or the playerid, basically.
Reply
#3

its from raven's roleplay but i cant find where its set so i dont know what i is
Reply
#4

Here

pawn Код:
for(new i=0; i < MAX_PLAYERS; i++)
Reply
#5

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.
Reply
#6

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
Reply
#7

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
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)