04.05.2011, 18:51
Even if the vehicleid is 100 of health it sets the textdraw string to "wrecked" why?
pawn Код:
public OnPlayerStateChange(playerid, newstate, oldstate)
{
if(GetPlayerState(playerid) == PLAYER_STATE_DRIVER || GetPlayerState(playerid) == PLAYER_STATE_PASSENGER)
{
new Float:health;
if(GetVehicleHealth(GetPlayerVehicleID(playerid),health) <= 100)
{
TextDrawSetString(Vehstate[playerid],"~g~~h~State: ~y~~h~Exellente");
}
if(GetVehicleHealth(GetPlayerVehicleID(playerid),health) <= 90)
{
TextDrawSetString(Vehstate[playerid],"~g~~h~State: ~y~~h~Good");
}
if(GetVehicleHealth(GetPlayerVehicleID(playerid),health) <= 40)
{
TextDrawSetString(Vehstate[playerid],"~g~~h~State: ~y~~h~Poor");
}
if(GetVehicleHealth(GetPlayerVehicleID(playerid),health) <= 10)
{
TextDrawSetString(Vehstate[playerid],"~g~~h~State: ~y~~h~Wrecked");
}
TextDrawShowForPlayer(playerid,fueltd[playerid]);
TextDrawShowForPlayer(playerid,speedo[playerid]);
TextDrawShowForPlayer(playerid,Vehstate[playerid]);
}
else
{
TextDrawShowForPlayer(playerid,Vehstate[playerid]);
TextDrawHideForPlayer(playerid,fueltd[playerid]);
TextDrawHideForPlayer(playerid,speedo[playerid]);
}
return 1;
}