Little help with a 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)
+--- Thread: Little help with a loop (
/showthread.php?tid=623681)
Little help with a loop -
cdoubleoper - 03.12.2016
So I've got there 4 vehicle slots & I want to put a new modelid to the empty one (if available)
(0 means empty)
Код:
for(new i = 0; i < 4; i++)
{
if(player[playerid][vModelid][i] == 0)
{
But, with this code it is gonna put a new vehicle to every single one that equals to 0, not only one.
Any ideas? Thanx
Re: Little help with a loop -
Alvitr - 03.12.2016
PHP код:
for(new i = 0; i < 4; i++)
{
if(player[playerid][vModelid][i] == 0)
{
player[playerid][vModelid][i] = modelid;
break; // exit loop