SA-MP Forums Archive
autogate only work for id 0 - 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: autogate only work for id 0 (/showthread.php?tid=294812)



autogate only work for id 0 - Unknown123 - 03.11.2011

pawn Код:
forward onPlayerUpdateEx();
public onPlayerUpdateEx() //1 sec timer
{
    foreach(Player, playerid)
    {
        if(IsPlayerInRangeOfObject(playerid, Gate1, 20.0) || IsPlayerInRangeOfObject(playerid, Gate2, 20.0))
        {
            if(IsPlayerPolice(playerid))
            {
                MoveDynamicObject(Gate1, -1619.0000, 688.5200, 9.7574, 2.0);
                MoveDynamicObject(Gate2, -1644.3500, 688.5200, 9.7574, 2.0);
            }
        }
        else
        {
            MoveDynamicObject(Gate1, -1627.0886, 688.5200, 9.7574, 2.0);
            MoveDynamicObject(Gate2, -1635.9632, 688.5200, 9.7574, 2.0);
        }
    }
    return 1;
}



Re: autogate only work for id 0 - Jack_Leslie - 03.11.2011

OnPlayerUpdateEx(playerid);?

Then there's no need to use foreach or any type of loop.


Re: autogate only work for id 0 - Unknown123 - 03.11.2011

i cant add (playerid) if i use SetTimer, so i must use foreach to loop


Re: autogate only work for id 0 - SuperViper - 03.11.2011

pawn Код:
SetTimerEx("onPlayerUpdateEx", 300, 1, "i", playerid);



Re: autogate only work for id 0 - Unknown123 - 03.11.2011

Quote:
Originally Posted by SuperViper
Посмотреть сообщение
pawn Код:
SetTimerEx("onPlayerUpdateEx", 300, 1, "i", playerid);
that do the same with loop and SetTimer :3 anyway i fixed it.