19.07.2009, 17:08
It's Very simple. Try this:
You'll need to also add Andre's IsCopCar function as well:
Untested.
EDIT: It will stop anyone who enters a cop car and is ranked 1 or less to be ejected. This is not what you want looking at ur original post. I used the variable you gave only for the player ranks. If you want just add/ change the rank to check if the player's not a cop.
pawn Код:
public OnPlayerStateChange(playerid,newstate,oldstate)
{
new carid;
carid = GetVehicleModel(GetPlayerVehicleID(playerid));
if(newstate == PLAYER_STATE_DRIVER || newstate == PLAYER_STATE_PASSENGER)
{
if(IsCopCar(carid) && PlayerInfo[playerid][pRank] >= 1) // If Player Enters any Cop Car and is Ranked 1 or less
{
SendClientMessage(playerid, 0xFF0000AA, "You cannot use this Vehicle, You need to be above Level 1 - Ejected");
RemovePlayerFromVehicle(playerid);
}
}
return 1;
}
pawn Код:
stock IsCopCar(carid)
{
new Operative[] = { 523, 427, 490, 528, 596, 597, 598, 599 };
for(new i = 0; i < sizeof(Operative); i++)
{
if(GetVehicleModel(carid) == Operative[i]) return 1;
}
return 0;
}
EDIT: It will stop anyone who enters a cop car and is ranked 1 or less to be ejected. This is not what you want looking at ur original post. I used the variable you gave only for the player ranks. If you want just add/ change the rank to check if the player's not a cop.