20.12.2010, 15:16
The IsPlayerInAnyVehicle function will only ever return 0 or 1. You are comparing it to 571, which it will never be. This is why your != statement always passes and goes on to show the client message.
I believe the correct usage of the IsPlayerInAnyVehicle function in this case would be:
GetPlayerVehicleID will return the in-game vehicle ID that a player is in.
GetVehicleModel will return the model ID of a vehicle
Remember that vehicle ID and model ID are different things!
I believe the correct usage of the IsPlayerInAnyVehicle function in this case would be:
pawn Код:
if(IsPlayerInAnyVehicle(playerid)) // if this is true(1), it will pass. if this is false(0), it will fail.
{
if(GetVehicleModel(GetPlayerVehicleID(playerid)) != 571) // check to see if the vehicle is a kart
{
RemovePlayerFromVehicle(playerid);
SendClientMessage(playerid,orange,"You cant be near kart circuit here with a vehicle");
}
}
GetVehicleModel will return the model ID of a vehicle
Remember that vehicle ID and model ID are different things!