pawn Код:
if(IsPlayerInAnyVehicle(infop)){
new vehid;
vehid = GetPlayerVehicleID(infop);
GetVehicleHealth(vehid, vh);
} else {
vh = floatstr("No");
}
format(string, sizeof(string), "Info -> Vehicle Health: %.0f", vh);
SendClientMessage(playerid, COLOR_GREEN, string);
Okay so lets see whats wrong here... First of all, the indentation is non existant. Please learn to indent to make things easier to read.
pawn Код:
if(IsPlayerInAnyVehicle(infop))
{
new vehid;
vehid = GetPlayerVehicleID(infop);
GetVehicleHealth(vehid, vh);
}
else
{
vh = floatstr("No");
}
format(string, sizeof(string), "Info -> Vehicle Health: %.0f", vh);
SendClientMessage(playerid, COLOR_GREEN, string);
MUCH better... Alright, secondly you do not use a float to send the info that is contained in a string... If you wanted it to say " Info -> Vehicle Health: no" then you should have done this.
pawn Код:
if(IsPlayerInAnyVehicle(infop))
{
new vehid;
vehid = GetPlayerVehicleID(infop);
GetVehicleHealth(vehid, vh);
format(string, sizeof(string), "Info -> Vehicle Health: %.0f", vh);
SendClientMessage(playerid, COLOR_GREEN, string); // <- I dont suggest using SendClientMessage to tell a vehicles health. Try GameTextForPlayer instead, it will get rid of the chat spam.
}
else
{
SendClientMessage(playerid, COLOR_GREEN, "Info -> Vehicle Health: No");
}
EDIT: I see someone posted prettymuch exactly what I just said, but ill keep what I got up here anyways as mine is slightly different.