Textdraws
#1

pawn Код:
new Float:hp;
    GetPlayerHealth(playerid, hp);
   
    format(string, sizeof(string), "Health: %f", floatround(hp));
    PlayerTextDrawSetString(playerid, Textdraw1[playerid], string);
    PlayerTextDrawShow(playerid, Textdraw1[playerid]);
Why does it display as "Health: 0.00000000000000000000" in game?
Reply
#2

pawn Код:
new Float:hp;
    GetPlayerHealth(playerid, hp);
   
    format(string, sizeof(string), "Health:%.1f", floatround(hp));
    PlayerTextDrawSetString(playerid, Textdraw1[playerid], string);
    PlayerTextDrawShow(playerid, Textdraw1[playerid]);
Reply
#3

Yeah, I already tried this. The problem is that it says that I have 0 health.
Reply
#4

pawn Код:
new Float:hp;
    GetPlayerHealth(playerid, hp);
   
    format(string, sizeof(string), "Health:%.0f%", floatround(hp));
    PlayerTextDrawSetString(playerid, Textdraw1[playerid], string);
    PlayerTextDrawShow(playerid, Textdraw1[playerid]);
Reply
#5

pawn Код:
if(!strcmp(cmdtext, "/health"))
    {
        for(new i = 0; i < MAX_PLAYERS; i++)
        {
            if(IsPlayerConnected(i))
            {
                new Float:hp, string[256];
                GetPlayerHealth(playerid, hp);

                format(string, sizeof(string), "Health: %d", floatround(hp));
                SendClientMessage(i, -1,string);
              //  PlayerTextDrawSetString(playerid, Textdraw1[playerid], string);
              //  PlayerTextDrawShow(playerid, Textdraw1[playerid]);
            }
        }
        return 1;
    }
Reply
#6

Ah yes, floatround turns it into an integer, thanks both.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)