05.05.2009, 14:14
pawn Код:
//Define colors, the textdraws and forwards
//OnGameModeInit --> Timer of one second, true
public PlayerStats(playerid)
{
new Float:Health;
new Float:Armour
GetPlayerHealth(playerid, Health);
GetPlayerArmour(playerid, Armour);
//HealthBar --> works perfectly
if(Health == 100){TextDrawSetString(HealthBar[playerid],"...................................................................................................");}
else if(Health == 99){TextDrawSetString(HealthBar[playerid],"...................................................................................................");}
//Bla bla..
else if(Health == 2){TextDrawSetString(HealthBar[playerid],"..");}
else if(Health == 1){TextDrawSetString(HealthBar[playerid],".");}
else if(Health == 0){TextDrawHideForPlayer(playerid,HealthBar[playerid]);}
//ArmourBar --> Works perfectly
if(Armour == 100){TextDrawSetString(ArmourBar[playerid],"...................................................................................................");}
else if(Armour == 99){TextDrawSetString(ArmourBar[playerid],"...................................................................................................");}
// Bla bla...
else if(Armour == 2){TextDrawSetString(ArmourBar[playerid],"..");}
else if(Armour == 1){TextDrawSetString(ArmourBar[playerid],".");}
else if(Armour == 0)
{
TextDrawHideForPlayer(playerid,ArmourBarBG); //Works
TextDrawHideForPlayer(playerid,ArmourBar[playerid]); //Works
}
//Health adding --> Works
if(Health < 100.0)
{
SetPlayerHealth(playerid,Health+1.0);
}
//Vehiclehealth
if (IsPlayerInAnyVehicle(playerid))
{
new Float:CarHealth;
GetVehicleHealth(GetPlayerVehicleID(playerid), CarHealth);
//CarHealthBar --> DONT WORKS AT ALL!
if(CarHealth == 1000.0){TextDrawSetString(CarBar[playerid],"...................................................................................................");}
else if(CarHealth == 990.0){TextDrawSetString(CarBar[playerid],"...................................................................................................");}
//Bla bla
else if(CarHealth == 20.0){TextDrawSetString(CarBar[playerid],"~r~..");}
else if(CarHealth == 10.0){TextDrawSetString(CarBar[playerid],"~r~.");}
//SetHealth -->
if(InArea[playerid] == false)
{
if (CarHealth < 1000.0)
{
SetVehicleHealth(GetPlayerVehicleID(playerid), 1000.0);
}
}
}
return 1;
}
I made a textdraw, between the armor and healthbar. If i'm in a vehicle, the bar will display(onplayerupdate). But, if i'm driving to anything, until my car smokes and blow up, there happens nothing with the car-healthbar. What can the problem be?