12.06.2009, 16:17
Here is my need when a player's vehicle health didnt decrease for 20 seconds he should be removed from his vehicle. but this code didnt work. I used timers for the 20 seconds cycle
pawn Код:
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);
return 1;
}
return 1;
}
}
return 1;
}
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);
return 1;
}
return 1;
}
}
return 1;
}