07.02.2009, 14:06
Why can't i get this working my code looks like:
I think this should work but when i enter a vehicle i get that the health is a huge number :/
pawn Код:
forward Damage();
new DamageTimer;
new Float: VHealth[MAX_VEHICLES];
public OnGameModeInit()
{
DamageTimer = SetTimer("Damage", 1000, 1);
return 1;
}
public OnGameModeExit()
{
KillTimer("DamageTimer");
return 1;
}
public Damage()
{
for(new i = 0; i < MAX_PLAYERS; i++)
{
if(IsPlayerConnected(i))
{
if(IsPlayerInAnyVehicle(i))
{
if(GetPlayerState(i) == PLAYER_STATE_DRIVER)
{
new Text[255];
GetVehicleHealth(GetPlayerVehicleID(i), VHealth[i]);
format(Text, sizeof(Text), "%d", VHealth[i]);
SCM(i, COLOR_WHITE, Text);
if(VHealth[i] < 200)
{
SCM(i, COLOR_RED, "MAIN ERROR(Your car is too broken to drive!)");
RemovePlayerFromVehicle(i);
}
}
}
}
}
return 1;
}

