14.06.2009, 05:31
I have coded such that when a players Vehicle health is same for a period of 20 seconds he get removed from his vehicles. But it removes players from their vehicle even the health has changed, plz help tia.
pawn Код:
new Float:oldv[MAX_PLAYERS];
new Float:newv[MAX_PLAYERS];
forward health();
forward vhealth();
public health()
{
for(new i=0;i<MAX_PLAYERS;i++)
{
if(PlayerDerby[i] == 1){
if(IsPlayerInAnyVehicle(i))
{
GetVehicleHealth(GetPlayerVehicleID(i),oldv[i]);
SetTimer("vhealth",20000,0);
}
}
}
}
public vhealth()
{
for(new i=0;i<MAX_PLAYERS;i++)
{
if(PlayerDerby[i] == 1){
if(IsPlayerInAnyVehicle(i))
{
GetVehicleHealth(GetPlayerVehicleID(i),newv[i]);
SetTimer("health",1000,0);
if (oldv[i] == newv[i]) RemovePlayerFromVehicle(i);
}
}
}
}