Lock vehicle
#6

pawn Код:
new CurrentVehicle[MAX_PLAYERS] = { -1, ... };
public OnPlayerStateChange(playerid, newstate, oldstate)
{
    if(newstate == PLAYER_STATE_DRIVER)
    {
        CurrentVehicle[playerid] = GetPlayerVehicleID(playerid);
    }
    return 1;
}

//When you want to lock the car use CurrentVehicle[playerid] as the vehicle id, make sure it isn't -1 though
CMD:lock(playerid, params[])
{
    if(CurrentVehicle[playerid] != -1)
    {
        for(new i, j = GetPlayerPoolSize(); i <= j; i++) // note that we assign the return value to a new variable (j) to avoid calling the function with each iteration
        {
            if(i != playerid) SetVehicleParamsForPlayer(CurrentVehicle[playerid],i,0,1);
        }
    }
    return 1;
}
Reply


Messages In This Thread
Lock vehicle - by STONEGOLD - 22.07.2015, 17:58
Re: Lock vehicle - by dominik523 - 22.07.2015, 18:25
Re: Lock vehicle - by STONEGOLD - 22.07.2015, 18:53
Re: Lock vehicle - by xVIP3Rx - 22.07.2015, 19:01
Re: Lock vehicle - by STONEGOLD - 22.07.2015, 19:39
Re: Lock vehicle - by xVIP3Rx - 22.07.2015, 19:52
Re: Lock vehicle - by STONEGOLD - 22.07.2015, 20:04
Re: Lock vehicle - by xVIP3Rx - 22.07.2015, 20:07
Re: Lock vehicle - by STONEGOLD - 22.07.2015, 20:13
Re: Lock vehicle - by xVIP3Rx - 22.07.2015, 20:16

Forum Jump:


Users browsing this thread: 1 Guest(s)