Problem with Health TextDraw
#1

Hi , i want to show to players how Much Health+Armour they have , it will be like a textdraw , and i have no Idea

i will never forgot if you help me .
Reply
#2

pawn Код:
#include a_samp

new Text:Textdraw0;
new Float:vida;
forward
coisas(playerid);

public coisas(playerid)
{
    vida = GetPlayerHealth(playerid,vida);
    new text[20];
    format(text,sizeof(text),"~g~Vida: %1.1f",vida);
    TextDrawSetString(Textdraw0,text);
    TextDrawShowForPlayer(playerid,Textdraw0);
    return 1;
}

public OnFilterScriptInit()
{
    return 1;
}
public OnPlayerConnect(playerid)
{
    Textdraw0 = TextDrawCreate(490.000000, 100.000000, "~r~vida:");
    TextDrawBackgroundColor(Textdraw0, 255);
    TextDrawFont(Textdraw0, 3);
    TextDrawLetterSize(Textdraw0, 0.500000, 1.000000);
    TextDrawColor(Textdraw0, -1);
    TextDrawSetOutline(Textdraw0, 0);
    TextDrawSetProportional(Textdraw0, 1);
    TextDrawSetShadow(Textdraw0, 1);
    return 1;
}

public OnPlayerSpawn(playerid)
{
    coisas(playerid);
    return 1;
}
public OnFilterScriptExit()
{
    TextDrawHideForAll(Textdraw0);
    TextDrawDestroy(Textdraw0);
    return 1;
}
in textdraw... change "vida" to health...
Reply
#3

thank you but your code show only 1.1 in health and i was 90 the health stay 1
Reply
#4

that code wont work, works only for certain players
also i think this one will fix it ( not certain players only problem )
pawn Код:
format(text,sizeof(text),"~g~Vida: %.2f",vida);
Reply
#5

Not Working , it show to me Vida : 1.00 and don't change
Reply
#6

pawn Код:
public OnPlayerSpawn(playerid)
{
    SetTimerEx( "coisas", 100, true, "i", playerid );
    return 1;
}
Reply
#7

Not Working this is the Screen :


i have this inside the inculde a_samp :
PHP код:
new Text:Textdraw0;
new 
Float:vida;
forward
coisas
(playerid); 
and this :
PHP код:
public coisas(playerid)
{
    
vida GetPlayerHealth(playerid,vida);
    new 
text[20];
    
format(text,sizeof(text),"~g~Health: %.2f",vida);
    
TextDrawSetString(Textdraw0,text);
    
TextDrawShowForPlayer(playerid,Textdraw0);
    return 
1;

and :
PHP код:
public OnPlayerConnect(playerid)
{
Textdraw0 TextDrawCreate(490.000000100.000000"~r~Health:");
    
TextDrawBackgroundColor(Textdraw0255);
    
TextDrawFont(Textdraw03);
    
TextDrawLetterSize(Textdraw00.5000001.000000);
    
TextDrawColor(Textdraw0, -1);
    
TextDrawSetOutline(Textdraw00);
    
TextDrawSetProportional(Textdraw01);
    
TextDrawSetShadow(Textdraw01); 
and :
PHP код:
public OnPlayerSpawn(playerid)
{
SetTimerEx"coisas"100true"i"playerid ); 
PHP код:
public OnFilterScriptExit()
{
    
TextDrawHideForAll(Textdraw0);
    
TextDrawDestroy(Textdraw0);
    return 
1;

This is All (i have Health:1.1 and don't change as you can see )
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)