public OnPlayerEnterVehicle(playerid, vehicleid, ispassenger)
{
if(GetVehicleModel(vehicleid) == 520 )
{
if(GetPlayerScore(playerid) < 1000 )
{
SendClientMessage(playerid,0xFF0000FF,"You cant drive this vehicle you noob");
RemovePlayerFromVehicle( playerid );
}
}
if(GetVehicleModel(vehicleid) == 432 )
{
if(GetPlayerScore(playerid) < 1000 )
{
SendClientMessage(playerid,0xFF0000FF,"You cant drive this vehicle you noob");
RemovePlayerFromVehicle( playerid );
}
}
return 1;
}
Note: This function will not work when used in OnPlayerEnterVehicle because the player isn't in the vehicle yet at the time the callback is called. Suggested using OnPlayerStateChange instead. |
public OnPlayerStateChange(playerid, newstate, oldstate)
{
if(newstate == PLAYER_STATE_DRIVER)
{
new vehicleid = GetPlayerVehicleID(playerid);
if(GetVehicleModel(vehicleid) == 520 && GetPlayerScore(playerid) < 1000)
{
SendClientMessage(playerid,0xFF0000FF,"You cant drive this vehicle you noob");
RemovePlayerFromVehicle(playerid);
}
if(GetVehicleModel(vehicleid) == 432 && GetPlayerScore(playerid) < 1000 )
{
SendClientMessage(playerid,0xFF0000FF,"You cant drive this vehicle you noob");
RemovePlayerFromVehicle( playerid );
}
}
return 1;
}
if(GetVehicleModel(vehicleid) == 520 || 432 )
{
if(GetPlayerScore(playerid) < 1000 )
{
SendClientMessage(playerid,0xFF0000FF,"You cant drive this vehicle you noob");
RemovePlayerFromVehicle( playerid );
}
}