15.05.2014, 11:00
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):
the function will return either 1 (on success) or 0 (on failure).
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.
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));
pawn Код:
new Float: health, car = GetPlayerVehicleID(playerid), szText[10];
if (car)
{
GetVehicleHealth(car, health);
format(szText, sizeof (szText), "%.2f", health);
}