Top of script:
Under OnGameModeInit() or OnFilterScriptInit():
pawn Код:
myCar = CreateVehicle(Parameters here);
Under OnPlayerEnterVehicle() or OnPlayerStateChange()
OnPlayerEnterVehicle()
pawn Код:
if(strcmp(sendername, "YOUR_NAME_HERE", false) == 0) // Replace your in game name with "YOUR_NAME_HERE".
{
if(!ispassenger && vehicleid == myCar)
{
new Float: x, Float: y, Float: z;
GetPlayerPos(playerid, x, y, z); // I grab his position and set it to what it was because...
SetPlayerPos(playerid, x, y, z); // RemovePlayerFromVehicle() doesn't function properly in this.
SendClientMessage(playerid, -1, "This car is off limits.");
}
}
OnPlayerStateChange()
pawn Код:
if(oldstate == PLAYER_STATE_ONFOOD && newstate == PLAYER_STATE_DRIVER)
{
new vehicleid = GetPlayerVehicleID(playerid);
if(vehicleid == myCar)
{
RemovePlayerFromVehicle(playerid);
SendClientMessage(playerid, -1, "This car is off limits.");
}
}