11.03.2011, 07:25
pawn Код:
public OnPlayerStateChange(playerid, newstate, oldstate)
{
new PlayerName[24];
GetPlayerName(playerid, PlayerName, sizeof(PlayerName));
new vehicleid = GetPlayerVehicleID(playerid);
if(newstate == PLAYER_STATE_DRIVER)
{
if(vehicleid == AdminCar1)
{
if(IsPlayerAdminLevel(playerid,1))
{
RemovePlayerFromVehicle(playerid);
SendClientMessage(playerid, 0x33AA33AA, "I'm sorry, but this car has been reserved for Admins");
}
}
}
else if(vehicleid == AdminCar2)
{
if(IsPlayerAdminLevel(playerid,2))
{
RemovePlayerFromVehicle(playerid);
SendClientMessage(playerid, 0x33AA33AA, "I'm sorry, but this car has been reserved for Admins");
}
}
else if(vehicleid == AdminCar3)
{
if(IsPlayerAdminLevel(playerid,3))
{
RemovePlayerFromVehicle(playerid);
SendClientMessage(playerid, 0x33AA33AA, "I'm sorry, but this car has been reserved for Admins");
}
}
else if(vehicleid == AdminCar4)
{
if(IsPlayerAdminLevel(playerid,4))
{
RemovePlayerFromVehicle(playerid);
SendClientMessage(playerid, 0x33AA33AA, "I'm sorry, but this car has been reserved for Admins");
}
}
return 1;
}
To the guy who said Use OnPlayerEnterVehicle that is a bad idea as people can still steal the cars and if there is a normal car next to the admin car it will think he is going into the admin car and call that.