For loop - Printable Version
+- SA-MP Forums Archive (
https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (
https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (
https://sampforum.blast.hk/forumdisplay.php?fid=12)
+---- Forum: Help Archive (
https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: For loop (
/showthread.php?tid=274042)
For loop -
[IL]HeHu - 04.08.2011
I made a for loop that will get the first key that has the value of 0 but for some reason it takes all the keys that have a value of 0.
Here it is:
PHP код:
ForLoop(i,MAX_OWNED) if(HKey[playerid][i] == 0) HKey[playerid][i] = HouseInfo[h][hKey], printf("House key: %i | House slot: %i",HKey[playerid][i],i);
ForLoop is just for(new i=0;i<MAX_OWNED;i++)
MAX_OWNED is 3
Re: For loop -
MadeMan - 04.08.2011
pawn Код:
ForLoop(i,MAX_OWNED) if(HKey[playerid][i] == 0) HKey[playerid][i] = HouseInfo[h][hKey], printf("House key: %i | House slot: %i",HKey[playerid][i],i), break;