28.04.2017, 12:02
Topic says all. The health lowers down in a milisecond, the next thing you know, it's back up to 1000, same as the altitude
Code:
Code:
PHP код:
#define METRES_TO_FEET(%0) \
( ( %0 ) / 0.3047999995367040007042099189296 )
public OnPlayerUpdate(playerid)
{
for(new i = 0; i < MAX_PLAYERS; i++)
{
if(IsPlayerConnected(i))
{
if(IsPlayerInAnyVehicle(playerid))
{
// Getting the vehicles speed in km/h
new vspeed[25];
new Float: x;
new Float: y;
new Float: z;
new altstring[25];
format(vspeed, sizeof(vspeed), "~b~KMH: ~w~%d", GetKMHSpeed(i));
PlayerTextDrawSetString(i, vehKMH[i], vspeed);
// Getting the vehicles health (shown as percentage)
new vhealthtd[32], Float:vHealth;
GetVehicleHealth(GetPlayerVehicleID(playerid), vHealth);
format(vhealthtd, sizeof(vhealthtd), "~b~Health: ~w~%0.0f", vHealth);
PlayerTextDrawSetString(i, vehHealth[i], vhealthtd);
new vid;
vid = GetPlayerVehicleID(playerid);
GetVehiclePos(vid, x, y, z);
format(altstring, sizeof(altstring), "~b~Altitude: ~w~ %d M", floatround( METRES_TO_FEET( z ) ));
PlayerTextDrawSetString(i, vehAlt[i], altstring);
}
}
}
return 1;
}