SA-MP Forums Archive
[Off] [Ajuda] Meio [Pedido] textdrawn life - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: Non-English (https://sampforum.blast.hk/forumdisplay.php?fid=9)
+--- Forum: Languages (https://sampforum.blast.hk/forumdisplay.php?fid=33)
+---- Forum: Português/Portuguese (https://sampforum.blast.hk/forumdisplay.php?fid=34)
+---- Thread: [Off] [Ajuda] Meio [Pedido] textdrawn life (/showthread.php?tid=544198)



[Ajuda] Meio [Pedido] textdrawn life - Slipk - 31.10.2014

N/A ..


Re: [Ajuda] Meio [Pedido] textdrawn life - ReyMysterio - 31.10.2014

Crie um SetTimer para atualizar a vida do player.

@EDIT

Exemplo

pawn Код:
//No inicio do GM
new Text:textlife[MAX_PLAYERS], Text:textcolete[MAX_PLAYERS];      

new TimerVida[MAX_PLAYERS];

//Em OnGameModeInit
    for(new i=0; i<MAX_PLAYERS; i++)
    {
        textlife[i] = TextDrawCreate(575.00000,66.20000, "100");
        TextDrawFont(textlife[i], 2);
        TextDrawColor(textlife[i], -1);
        TextDrawLetterSize(textlife[i], 0.220000, 0.880000);
        TextDrawSetOutline(textlife[i], 1);
        TextDrawSetProportional(textlife[i], 1);
        TextDrawAlignment(textlife[i], 2);
        TextDrawBackgroundColor(textlife[i], 0x00000065);
        TextDrawSetShadow(textlife[i], 1);

        textcolete[i] = TextDrawCreate(575.00000,45.00000, "100");
        TextDrawFont(textcolete[i], 2);
        TextDrawColor(textcolete[i], -1);
        TextDrawLetterSize(textcolete[i], 0.220000, 0.880000);
        TextDrawSetOutline(textcolete[i], 1);
        TextDrawSetProportional(textcolete[i], 1);
        TextDrawAlignment(textcolete[i], 2);
        TextDrawBackgroundColor(textcolete[i], 0x00000065);
        TextDrawSetShadow(textcolete[i], 1);
    }

//Em OnPlayerConnect
    TimerVida[playerid] = SetTimerEx("AtualizarVida", 1000, true, "i", playerid);

//Em OnPlayerDisconnect
    KillTimer(TimerVida[playerid]);

//Final do GM
forward AtualizarVida(playerid);
public AtualizarVida(playerid)
{
    new Float:Text_Vida, Float:Text_Colete;
    new string[20], string2[20];
    GetPlayerHealth(playerid, Text_Vida);
    GetPlayerArmour(playerid, Text_Colete);
    format(string, sizeof(string), "%.0f", Text_Vida);
    format(string2, sizeof(string2), "%.0f", Text_Colete);
    if(Text_Colete < 1)
    {
        format(string2, sizeof(string2), " ", Text_Colete);
    }
    TextDrawSetString(textlife[playerid], string);
    TextDrawSetString(textcolete[playerid], string2);
    TextDrawShowForPlayer(playerid, textlife[playerid]);
    TextDrawShowForPlayer(playerid, textcolete[playerid]);
    return 1;
}



Re: [Ajuda] Meio [Pedido] textdrawn life - ipsLuan - 31.10.2014

pawn Код:
SetTimerEx("MostrarTextVida", 5000, true, "i", playerid);
Basicamente isso.


Re: [Ajuda] Meio [Pedido] textdrawn life - Slipk - 31.10.2014

N/A
Vlw cara Obrigado