08.07.2014, 19:03
(
Последний раз редактировалось Threshold; 09.07.2014 в 02:21.
)
OnPlayerEnterVehicle is called when a player BEGINS to enter a vehicle, not when he has actually entered it.
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
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;
}
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