14.12.2014, 16:28
It's a pretty simple thing, right?
First, find the callback you're going to be using. Probably OnPlayerStateChange. You want to compare for, like you already have, PLAYER_STATE_ONFOOT going to PLAYER_STATE_DRIVER. Add a check for teams.
Second, read this: https://sampwiki.blast.hk/wiki/ClearAnimations
- ClearAnimations(playerid) will stop the animation of getting in the car so the State won't change.
So...
First, find the callback you're going to be using. Probably OnPlayerStateChange. You want to compare for, like you already have, PLAYER_STATE_ONFOOT going to PLAYER_STATE_DRIVER. Add a check for teams.
Second, read this: https://sampwiki.blast.hk/wiki/ClearAnimations
- ClearAnimations(playerid) will stop the animation of getting in the car so the State won't change.
So...
Код:
public OnPlayerStateChange(playerid, newstate, oldstate) { if(oldstate == PLAYER_STATE_ONFOOT && newstate == PLAYER_STATE_DRIVER) { new veh = GetPlayerVehicleID(playerid); if((VehicleInfo[vehicleid][vteam] != 0) && (VehicleInfo[vehicleid][vteam] != PlayerInfo[playerid][pteam])) { SendClientMessage(playerid,-1,"This vehicle is restricted."); ClearAnimations(playerid); } } return 1; }