Vehicle Damage
#4

Why can't i get this working my code looks like:
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;
}
I think this should work but when i enter a vehicle i get that the health is a huge number :/
Reply


Messages In This Thread
Vehicle Damage - by Jonte92 - 07.02.2009, 09:49
Re: Vehicle Damage - by CracK - 07.02.2009, 10:02
Re: Vehicle Damage - by Jonte92 - 07.02.2009, 11:36
Re: Vehicle Damage - by Jonte92 - 07.02.2009, 14:06
Re: Vehicle Damage - by CracK - 07.02.2009, 14:17
Re: Vehicle Damage - by Jefff - 07.02.2009, 14:18
Re: Vehicle Damage - by Jonte92 - 07.02.2009, 14:56
Re: Vehicle Damage - by ICECOLDKILLAK8 - 07.02.2009, 16:37
Re: Vehicle Damage - by VoViNaToR - 08.02.2009, 09:26

Forum Jump:


Users browsing this thread: 1 Guest(s)