Removing player from hydra if GetPlayerScore(playerid) <- 1000
#5

OnPlayerEnterVehicle is called when a player BEGINS to enter a vehicle, not when he has actually entered it.

pawn Код:
public OnPlayerStateChange(playerid, newstate, oldstate)
{
    if(newstate & PLAYER_STATE_DRIVER) //If the player entered as a driver
    {
        if(GetVehicleModel(GetPlayerVehicleID(playerid)) == 520) //If the vehicle is a hydra
        {
            if(GetPlayerScore(playerid) < 1000 || gTeam[playerid] != ARMY_PILOT) //If their score is less than 100
            {
                RemovePlayerFromVehicle(playerid); //Remove them from the vehicle
                SendClientMessage(playerid, -1, "You must have 1000 score and be an army pilot to be able to use this vehicle.");
            }
        }
    }
    return 1;
}
Sources:
https://sampwiki.blast.hk/wiki/OnPlayerStateChange
https://sampwiki.blast.hk/wiki/RemovePlayerFromVehicle
https://sampwiki.blast.hk/wiki/GetPlayerScore
https://sampwiki.blast.hk/wiki/GetVehicleModel
https://sampwiki.blast.hk/wiki/GetPlayerVehicleID
Reply


Messages In This Thread

Forum Jump:


Users browsing this thread: 3 Guest(s)