OnPlayerStateChange, locking vehicles
#3

pawn Код:
new PoliceCars[50];
pawn Код:
PoliceCars[1] = AddStaticVehicle(598,2312.0000000,2431.1001000,3.1000000,0.0000000,-1,-1);
Could i actually do:

pawn Код:
if(vehicleID == PoliceCars[50])...etc
Thank you for explaining it!

EDIT:

pawn Код:
if(newstate == PLAYER_STATE_DRIVER)
    {
        for(new i=0;i<sizeof(PoliceCars);i++)
        {
            if(vehicleID == PoliceCars[i])
            {
                if(PlayerInfo[playerid][pFac] != 1)
                {
                    RemovePlayerFromVehicle(playerid);
                    SendClientMessage(playerid, COLOR_RED, "You have to be a Police officer to drive this vehicle!");
                }
            }
        }
    }
I figure what I just writ wouldn't loop through all the vehicles, but only 44th item in the array. So if I create a loop, to loop through the array and then check if the player is in one of those vehicles, will that work?
Reply


Messages In This Thread
OnPlayerStateChange, locking vehicles - by ross8839 - 10.06.2017, 13:44
Re: OnPlayerStateChange, locking vehicles - by Vince - 10.06.2017, 14:04
Re: OnPlayerStateChange, locking vehicles - by ross8839 - 10.06.2017, 14:07
Re: OnPlayerStateChange, locking vehicles - by SyS - 10.06.2017, 15:19

Forum Jump:


Users browsing this thread: 1 Guest(s)