i do carhealth and do not see the textdraw
#2

https://sampwiki.blast.hk/wiki/GetVehicleHealth

The vehicle's health is stored to the variable "health" and that is what you need to use as argument.
By doing this (which is incorrect):
pawn Код:
format(String, 250,"%.2f",GetVehicleHealth(car, health));
the function will return either 1 (on success) or 0 (on failure).

pawn Код:
new Float: health, car = GetPlayerVehicleID(playerid), szText[10];

if (car)
{
    GetVehicleHealth(car, health);
    format(szText, sizeof (szText), "%.2f", health);
}
Also use per-player textdraws if you want to show a textdraw for each player who is in vehicle and all you need to do is create the textdraw once on connect and show it when the player enters the vehicle/hide it when the player exits the vehicle. You don't have to destroy and re-create it over and over again.
Reply


Messages In This Thread

Forum Jump:


Users browsing this thread: 7 Guest(s)