14.06.2009, 05:51
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))
{
new Float:carhp, Float:FinalHP;
new VID = GetPlayerVehicleID(i);
GetVehicleHealth(VID, carhp);
FinalHP = carhp/10;
oldv[i] = floatround(FinalHP, floatround_round);
SetTimer("vhealth",20000,0);
}
}
}
}
public vhealth()
{
for(new i=0;i<MAX_PLAYERS;i++)
{
if(PlayerDerby[i] == 1)
{
if(IsPlayerInAnyVehicle(i))
{
new Float:carhp, Float:FinalHP;
new VID = GetPlayerVehicleID(i);
GetVehicleHealth(VID, carhp);
FinalHP = carhp/10;
newv[i] = floatround(FinalHP, floatround_round);
SetTimer("health",1000,0);
if(oldv[i] == newv[i]) RemovePlayerFromVehicle(i);
}
}
}
}