08.04.2012, 11:16
I would like to; If the car health is <400 the player got RemovePlayerFromVehicle....How?
new Float:health;
GetVehicleHealth(GetPlayerVehicleID(playerid), health);
if(health < 400.0) RemovePlayerFromVehicle(playerid);
SetTimer("CheckHealth", 1000, 1); //Timer which gets called every second
forward CheckHealth();
public CheckHealth()
{
for(new i=0; i<MAX_PLAYERS; i++)
{
if(IsPlayerInAnyVehicle(i) && GetPlayerSkin(i) != 50)
{
new Float:health;
GetVehicleHealth(GetPlayerVehicleID(i), health));
if(health < 400.0)
{
RemovePlayerFromVehicle(i);
SendClientMessage(i, COLOR_BLUE, "[Vehicle] You were removed from your vehicle because it had less than 400 health points.");
}
}
}
return 1;
}