[Ajuda] Vida em Textdraw bugado
#1

bom galera fiz esse sistema de vida em Textdraw e tem hora que ele funciona e hora que nгo, as vez a textdraw da vida vai sу atй a metade e para de diminuir e etc alguem pode me ajudar ?? sistema abaixo


public OnGameModeInit()
{
SetTimer("carregartext", 1000, false);
return 1;
}


forward carregartext(playerid);
public carregartext(playerid)
{

Textdraw[16] = TextDrawCreate(641.529418, 1.500000, "usebox");//fundo status
TextDrawLetterSize(Textdraw[16], 0.000000, 7.797604);
TextDrawTextSize(Textdraw[16], 486.470581, 0.000000);
TextDrawAlignment(Textdraw[16], 1);
TextDrawColor(Textdraw[16], 0);
TextDrawUseBox(Textdraw[16], true);
TextDrawBoxColor(Textdraw[16], 102);
TextDrawSetShadow(Textdraw[16], 0);
TextDrawSetOutline(Textdraw[16], 0);
TextDrawFont(Textdraw[16], 0);

Textdraw[17] = TextDrawCreate(571.411743, 4.416666, "usebox");//fundo barra de vida
TextDrawLetterSize(Textdraw[17], 0.000000, 0.572984);
TextDrawTextSize(Textdraw[17], 636.117614, 0.000000);
TextDrawAlignment(Textdraw[17], 1);
TextDrawColor(Textdraw[17], 0);
TextDrawUseBox(Textdraw[17], true);
TextDrawBoxColor(Textdraw[17], -65281);
TextDrawSetShadow(Textdraw[17], 0);
TextDrawSetOutline(Textdraw[17], 0);
TextDrawFont(Textdraw[17], 0);

Textdraw[18] = TextDrawCreate(638.235290, 6.166666, "_");//barra de vida cheia 100%
TextDrawLetterSize(Textdraw[18], 0.000000, 0.195642);
TextDrawTextSize(Textdraw[18], 569.294067, 0.000000);
TextDrawAlignment(Textdraw[18], 1);
TextDrawColor(Textdraw[18], 0);
TextDrawUseBox(Textdraw[18], true);
TextDrawBoxColor(Textdraw[18], 8388863);
TextDrawSetShadow(Textdraw[18], 0);
TextDrawSetOutline(Textdraw[18], 0);
TextDrawFont(Textdraw[18], 0);

Textdraw[19] = TextDrawCreate(635.235290, 6.166666, "_");//barra de vida 95%
TextDrawLetterSize(Textdraw[19], 0.000000, 0.195642);
TextDrawTextSize(Textdraw[19], 569.294067, 0.000000);
TextDrawAlignment(Textdraw[19], 1);
TextDrawColor(Textdraw[19], 0);
TextDrawUseBox(Textdraw[19], true);
TextDrawBoxColor(Textdraw[19], INFOA);
TextDrawSetShadow(Textdraw[19], 0);
TextDrawSetOutline(Textdraw[19], 0);
TextDrawFont(Textdraw[19], 0);

Textdraw[20] = TextDrawCreate(632.235290, 6.166666, "_");//barra de vida 90%
TextDrawLetterSize(Textdraw[20], 0.000000, 0.195642);
TextDrawTextSize(Textdraw[20], 569.294067, 0.000000);
TextDrawAlignment(Textdraw[20], 1);
TextDrawColor(Textdraw[20], 0);
TextDrawUseBox(Textdraw[20], true);
TextDrawBoxColor(Textdraw[20], 8388863);
TextDrawSetShadow(Textdraw[20], 0);
TextDrawSetOutline(Textdraw[20], 0);
TextDrawFont(Textdraw[20], 0);

Textdraw[21] = TextDrawCreate(629.235290, 6.166666, "_");//barra de vida 85%
TextDrawLetterSize(Textdraw[21], 0.000000, 0.195642);
TextDrawTextSize(Textdraw[21], 569.294067, 0.000000);
TextDrawAlignment(Textdraw[21], 1);
TextDrawColor(Textdraw[21], 0);
TextDrawUseBox(Textdraw[21], true);
TextDrawBoxColor(Textdraw[21], 8388863);
TextDrawSetShadow(Textdraw[21], 0);
TextDrawSetOutline(Textdraw[21], 0);
TextDrawFont(Textdraw[21], 0);

Textdraw[22] = TextDrawCreate(626.235290, 6.166666, "_");//barra de vida 80%
TextDrawLetterSize(Textdraw[22], 0.000000, 0.195642);
TextDrawTextSize(Textdraw[22], 569.294067, 0.000000);
TextDrawAlignment(Textdraw[22], 1);
TextDrawColor(Textdraw[22], 0);
TextDrawUseBox(Textdraw[22], true);
TextDrawBoxColor(Textdraw[22], 8388863);
TextDrawSetShadow(Textdraw[22], 0);
TextDrawSetOutline(Textdraw[22], 0);
TextDrawFont(Textdraw[22], 0);

Textdraw[23] = TextDrawCreate(623.235290, 6.166666, "_");//barra de vida 75%
TextDrawLetterSize(Textdraw[23], 0.000000, 0.195642);
TextDrawTextSize(Textdraw[23], 569.294067, 0.000000);
TextDrawAlignment(Textdraw[23], 1);
TextDrawColor(Textdraw[23], 0);
TextDrawUseBox(Textdraw[23], true);
TextDrawBoxColor(Textdraw[23], 8388863);
TextDrawSetShadow(Textdraw[23], 0);
TextDrawSetOutline(Textdraw[23], 0);
TextDrawFont(Textdraw[23], 0);

Textdraw[24] = TextDrawCreate(620.235290, 6.166666, "_");//barra de vida 70%
TextDrawLetterSize(Textdraw[24], 0.000000, 0.195642);
TextDrawTextSize(Textdraw[24], 569.294067, 0.000000);
TextDrawAlignment(Textdraw[24], 1);
TextDrawColor(Textdraw[24], 0);
TextDrawUseBox(Textdraw[24], true);
TextDrawBoxColor(Textdraw[24], 8388863);
TextDrawSetShadow(Textdraw[24], 0);
TextDrawSetOutline(Textdraw[24], 0);
TextDrawFont(Textdraw[24], 0);

Textdraw[25] = TextDrawCreate(618.235290, 6.166666, "_");//barra de vida 65%
TextDrawLetterSize(Textdraw[25], 0.000000, 0.195642);
TextDrawTextSize(Textdraw[25], 569.294067, 0.000000);
TextDrawAlignment(Textdraw[25], 1);
TextDrawColor(Textdraw[25], 0);
TextDrawUseBox(Textdraw[25], true);
TextDrawBoxColor(Textdraw[25], 8388863);
TextDrawSetShadow(Textdraw[25], 0);
TextDrawSetOutline(Textdraw[25], 0);
TextDrawFont(Textdraw[25], 0);

Textdraw[26] = TextDrawCreate(615.235290, 6.166666, "_");//barra de vida 60%
TextDrawLetterSize(Textdraw[26], 0.000000, 0.195642);
TextDrawTextSize(Textdraw[26], 569.294067, 0.000000);
TextDrawAlignment(Textdraw[26], 1);
TextDrawColor(Textdraw[26], 0);
TextDrawUseBox(Textdraw[26], true);
TextDrawBoxColor(Textdraw[26], 8388863);
TextDrawSetShadow(Textdraw[26], 0);
TextDrawSetOutline(Textdraw[26], 0);
TextDrawFont(Textdraw[26], 0);

Textdraw[27] = TextDrawCreate(612.235290, 6.166666, "_");//barra de vida 55%
TextDrawLetterSize(Textdraw[27], 0.000000, 0.195642);
TextDrawTextSize(Textdraw[27], 569.294067, 0.000000);
TextDrawAlignment(Textdraw[27], 1);
TextDrawColor(Textdraw[27], 0);
TextDrawUseBox(Textdraw[27], true);
TextDrawBoxColor(Textdraw[27], 8388863);
TextDrawSetShadow(Textdraw[27], 0);
TextDrawSetOutline(Textdraw[27], 0);
TextDrawFont(Textdraw[27], 0);

Textdraw[28] = TextDrawCreate(609.235290, 6.166666, "_");//barra de vida 50%
TextDrawLetterSize(Textdraw[28], 0.000000, 0.195642);
TextDrawTextSize(Textdraw[28], 569.294067, 0.000000);
TextDrawAlignment(Textdraw[28], 1);
TextDrawColor(Textdraw[28], 0);
TextDrawUseBox(Textdraw[28], true);
TextDrawBoxColor(Textdraw[28], 8388863);
TextDrawSetShadow(Textdraw[28], 0);
TextDrawSetOutline(Textdraw[28], 0);
TextDrawFont(Textdraw[28], 0);

Textdraw[29] = TextDrawCreate(606.235290, 6.166666, "_");//barra de vida 45%
TextDrawLetterSize(Textdraw[29], 0.000000, 0.195642);
TextDrawTextSize(Textdraw[29], 569.294067, 0.000000);
TextDrawAlignment(Textdraw[29], 1);
TextDrawColor(Textdraw[29], 0);
TextDrawUseBox(Textdraw[29], true);
TextDrawBoxColor(Textdraw[29], 8388863);
TextDrawSetShadow(Textdraw[29], 0);
TextDrawSetOutline(Textdraw[29], 0);
TextDrawFont(Textdraw[29], 0);

Textdraw[30] = TextDrawCreate(603.235290, 6.166666, "_");//barra de vida 40%
TextDrawLetterSize(Textdraw[30], 0.000000, 0.195642);
TextDrawTextSize(Textdraw[30], 569.294067, 0.000000);
TextDrawAlignment(Textdraw[30], 1);
TextDrawColor(Textdraw[30], 0);
TextDrawUseBox(Textdraw[30], true);
TextDrawBoxColor(Textdraw[30], 8388863);
TextDrawSetShadow(Textdraw[30], 0);
TextDrawSetOutline(Textdraw[30], 0);
TextDrawFont(Textdraw[30], 0);

Textdraw[31] = TextDrawCreate(600.235290, 6.166666, "_");//barra de vida 35%
TextDrawLetterSize(Textdraw[31], 0.000000, 0.195642);
TextDrawTextSize(Textdraw[31], 569.294067, 0.000000);
TextDrawAlignment(Textdraw[31], 1);
TextDrawColor(Textdraw[31], 0);
TextDrawUseBox(Textdraw[31], true);
TextDrawBoxColor(Textdraw[31], 8388863);
TextDrawSetShadow(Textdraw[31], 0);
TextDrawSetOutline(Textdraw[31], 0);
TextDrawFont(Textdraw[31], 0);

Textdraw[32] = TextDrawCreate(597.235290, 6.166666, "_");//barra de vida 30%
TextDrawLetterSize(Textdraw[32], 0.000000, 0.195642);
TextDrawTextSize(Textdraw[32], 569.294067, 0.000000);
TextDrawAlignment(Textdraw[32], 1);
TextDrawColor(Textdraw[32], 0);
TextDrawUseBox(Textdraw[32], true);
TextDrawBoxColor(Textdraw[32], 8388863);
TextDrawSetShadow(Textdraw[32], 0);
TextDrawSetOutline(Textdraw[32], 0);
TextDrawFont(Textdraw[32], 0);

Textdraw[33] = TextDrawCreate(594.235290, 6.166666, "_");//barra de vida 25%
TextDrawLetterSize(Textdraw[33], 0.000000, 0.195642);
TextDrawTextSize(Textdraw[33], 569.294067, 0.000000);
TextDrawAlignment(Textdraw[33], 1);
TextDrawColor(Textdraw[33], 0);
TextDrawUseBox(Textdraw[3], true);
TextDrawBoxColor(Textdraw[33], 8388863);
TextDrawSetShadow(Textdraw[33], 0);
TextDrawSetOutline(Textdraw[33], 0);
TextDrawFont(Textdraw[33], 0);

Textdraw[34] = TextDrawCreate(591.235290, 6.166666, "_");//barra de vida 20%
TextDrawLetterSize(Textdraw[34], 0.000000, 0.195642);
TextDrawTextSize(Textdraw[34], 569.294067, 0.000000);
TextDrawAlignment(Textdraw[34], 1);
TextDrawColor(Textdraw[34], 0);
TextDrawUseBox(Textdraw[34], true);
TextDrawBoxColor(Textdraw[34], 8388863);
TextDrawSetShadow(Textdraw[34], 0);
TextDrawSetOutline(Textdraw[34], 0);
TextDrawFont(Textdraw[34], 0);

Textdraw[35] = TextDrawCreate(588.235290, 6.166666, "_");//barra de vida 15%
TextDrawLetterSize(Textdraw[35], 0.000000, 0.195642);
TextDrawTextSize(Textdraw[35], 569.294067, 0.000000);
TextDrawAlignment(Textdraw[35], 1);
TextDrawColor(Textdraw[35], 0);
TextDrawUseBox(Textdraw[35], true);
TextDrawBoxColor(Textdraw[35], 8388863);
TextDrawSetShadow(Textdraw[35], 0);
TextDrawSetOutline(Textdraw[35], 0);
TextDrawFont(Textdraw[35], 0);

Textdraw[36] = TextDrawCreate(585.235290, 6.166666, "_");//barra de vida 10%
TextDrawLetterSize(Textdraw[36], 0.000000, 0.195642);
TextDrawTextSize(Textdraw[36], 569.294067, 0.000000);
TextDrawAlignment(Textdraw[36], 1);
TextDrawColor(Textdraw[36], 0);
TextDrawUseBox(Textdraw[36], true);
TextDrawBoxColor(Textdraw[36], 8388863);
TextDrawSetShadow(Textdraw[36], 0);
TextDrawSetOutline(Textdraw[36], 0);
TextDrawFont(Textdraw[36], 0);

Textdraw[37] = TextDrawCreate(582.235290, 6.166666, "_");//barra de vida 5%
TextDrawLetterSize(Textdraw[37], 0.000000, 0.195642);
TextDrawTextSize(Textdraw[37], 569.294067, 0.000000);
TextDrawAlignment(Textdraw[37], 1);
TextDrawColor(Textdraw[37], 0);
TextDrawUseBox(Textdraw[37], true);
TextDrawBoxColor(Textdraw[37], 8388863);
TextDrawSetShadow(Textdraw[37], 0);
TextDrawSetOutline(Textdraw[37], 0);
TextDrawFont(Textdraw[37], 0);

Textdraw[38] = TextDrawCreate(574.235290, 6.166666, "_");//barra de vida vazia
TextDrawLetterSize(Textdraw[38], 0.000000, 0.195642);
TextDrawTextSize(Textdraw[38], 569.294067, 0.000000);
TextDrawAlignment(Textdraw[38], 1);
TextDrawColor(Textdraw[38], 0);
TextDrawUseBox(Textdraw[38], true);
TextDrawBoxColor(Textdraw[38], 8388863);
TextDrawSetShadow(Textdraw[38], 0);
TextDrawSetOutline(Textdraw[38], 0);
TextDrawFont(Textdraw[38], 0);

return 1;
}

public OnPlayerUpdate(playerid)
{
if(logado[playerid] == 2)
{
SCM(playerid, INFOA, "0");
vidaemtext(playerid);
}
return 0;
}

stock vidaemtext(playerid)
{
new Float: vida;
GetPlayerHealth(playerid, vida);

if(vida >= 100)
{
TextDrawShowForPlayer(playerid, Textdraw[18]);
}

else if(vida >= 95 && vida <= 100)
{
TextDrawDestroy(Textdraw[18]);
TextDrawShowForPlayer(playerid, Textdraw[19]);
}

else if(vida >= 90 && vida <= 95)
{
TextDrawDestroy(Textdraw[19]);
TextDrawShowForPlayer(playerid, Textdraw[20]);
}

else if(vida >= 85 && vida <= 90)
{
TextDrawDestroy(Textdraw[20]);
TextDrawShowForPlayer(playerid, Textdraw[21]);
}

else if(vida >= 80 && vida <= 85)
{
TextDrawDestroy(Textdraw[21]);
TextDrawShowForPlayer(playerid, Textdraw[22]);
}

else if(vida >= 75 && vida <= 80)
{
TextDrawDestroy(Textdraw[22]);
TextDrawShowForPlayer(playerid, Textdraw[23]);
}

else if(vida >= 70 && vida <= 75)
{
TextDrawDestroy(Textdraw[23]);
TextDrawShowForPlayer(playerid, Textdraw[24]);
}

else if(vida >= 65 && vida <= 70)
{
TextDrawDestroy(Textdraw[24]);
TextDrawShowForPlayer(playerid, Textdraw[25]);
}

else if(vida >= 60 && vida <= 65)
{
TextDrawDestroy(Textdraw[25]);
TextDrawShowForPlayer(playerid, Textdraw[26]);
}

else if(vida >= 55 && vida <= 60)
{
TextDrawDestroy(Textdraw[26]);
TextDrawShowForPlayer(playerid, Textdraw[27]);
}

else if(vida >= 50 && vida <= 55)
{
TextDrawDestroy(Textdraw[27]);
TextDrawShowForPlayer(playerid, Textdraw[28]);
}

else if(vida >= 45 && vida <= 50)
{
TextDrawDestroy(Textdraw[28]);
TextDrawShowForPlayer(playerid, Textdraw[29]);
}

else if(vida >= 40 && vida <= 45)
{
TextDrawDestroy(Textdraw[29]);
TextDrawShowForPlayer(playerid, Textdraw[30]);
}

else if(vida >= 35 && vida <= 40)
{
TextDrawDestroy(Textdraw[30]);
TextDrawShowForPlayer(playerid, Textdraw[31]);
}

else if(vida >= 30 && vida <= 35)
{
TextDrawDestroy(Textdraw[31]);
TextDrawShowForPlayer(playerid, Textdraw[32]);
}

else if(vida >= 25 && vida <= 30)
{
TextDrawDestroy(Textdraw[32]);
TextDrawShowForPlayer(playerid, Textdraw[33]);
}

else if(vida >= 20 && vida <= 25)
{
TextDrawDestroy(Textdraw[33]);
TextDrawShowForPlayer(playerid, Textdraw[34]);
}

else if(vida >= 15 && vida <= 20)
{
TextDrawDestroy(Textdraw[34]);
TextDrawShowForPlayer(playerid, Textdraw[35]);
}

else if(vida >= 10 && vida <= 15)
{
TextDrawDestroy(Textdraw[35]);
TextDrawShowForPlayer(playerid, Textdraw[36]);
}

else if(vida >= 5 && vida <= 10)
{
TextDrawDestroy(Textdraw[36]);
TextDrawShowForPlayer(playerid, Textdraw[37]);
}

else if(vida >= 0 && vida <= 5)
{
TextDrawDestroy(Textdraw[37]);
TextDrawShowForPlayer(playerid, Textdraw[38]);
}
return 1;
}
Reply
#2

Porque nгo faz assim?

PHP код:
forward GetarVida(id);
public 
GetarVida(id)
{
    new 
string[128], Floatvida;
    
GetPlayerHealth(idvida);
    
format(stringsizeof(string), "Vida: %.1f"vida);
    return 
1;

Tente algo desse jeito espero ter ajudado '-'
Reply
#3

Veja este tutorial: https://sampforum.blast.hk/showthread.php?tid=578442
Reply
#4

Quote:
Originally Posted by HelderPT
Посмотреть сообщение
Porque nгo faz assim?

PHP код:
forward GetarVida(id);
public 
GetarVida(id)
{
    new 
string[128], Floatvida;
    
GetPlayerHealth(idvida);
    
format(stringsizeof(string), "Vida: %.1f"vida);
    return 
1;

Tente algo desse jeito espero ter ajudado '-'
pq eu quero em textdraw e nгo em string
Reply
#5

Quote:
Originally Posted by ipsLuan
Посмотреть сообщение
PHP код:
///й pq eu estudei esse codigo ai e fiz o meu propio, ps: esse ai funciona certinho
new Text:HealthBar[19];
public 
OnFilterScriptInit()
{
    
HealthBar[0] = TextDrawCreate(611.0,68.5,"_");                              // BBG
    
TextDrawLetterSize(HealthBar[0],0.5,0.449999);
    
TextDrawUseBox(HealthBar[0],1);
    
TextDrawBoxColor(HealthBar[0],COLOR_HPBAR_BG);
    
TextDrawTextSize(HealthBar[0],543.0,0.0);
    
HealthBar[1] = TextDrawCreate(608.5,71.0,"_");                              // BG (75-100)
    
TextDrawLetterSize(HealthBar[1],0.5,0.0);
    
TextDrawUseBox(HealthBar[1],1);
    
TextDrawBoxColor(HealthBar[1],COLOR_HPBAR_75100BG);
    
TextDrawTextSize(HealthBar[1],545.0,0.0);
    
HealthBar[2] = TextDrawCreate(609.0,71.0,"_");                              // >= 95
    
TextDrawLetterSize(HealthBar[2],0.5,0.0);
    
TextDrawUseBox(HealthBar[2],1);
    
TextDrawBoxColor(HealthBar[2],COLOR_HPBAR_75100);
    
TextDrawTextSize(HealthBar[2],545.0,0.0);
    
HealthBar[3] = TextDrawCreate(604.0,71.0,"_");                              // >= 90
    
TextDrawLetterSize(HealthBar[3],0.5,0.0);
    
TextDrawUseBox(HealthBar[3],1);
    
TextDrawBoxColor(HealthBar[3],COLOR_HPBAR_75100);
    
TextDrawTextSize(HealthBar[3],545.0,0.0);
    
HealthBar[4] = TextDrawCreate(601.0,71.0,"_");                              // >= 85
    
TextDrawLetterSize(HealthBar[4],0.5,0.0);
    
TextDrawUseBox(HealthBar[4],1);
    
TextDrawBoxColor(HealthBar[4],COLOR_HPBAR_75100);
    
TextDrawTextSize(HealthBar[4],545.0,0.0);
    
HealthBar[5] = TextDrawCreate(598.0,71.0,"_");                              // >= 80
    
TextDrawLetterSize(HealthBar[5],0.5,0.0);
    
TextDrawUseBox(HealthBar[5],1);
    
TextDrawBoxColor(HealthBar[5],COLOR_HPBAR_75100);
    
TextDrawTextSize(HealthBar[5],545.0,0.0);
    
HealthBar[6] = TextDrawCreate(595.0,71.0,"_");                              // >= 75
    
TextDrawLetterSize(HealthBar[6],0.5,0.0);
    
TextDrawUseBox(HealthBar[6],1);
    
TextDrawBoxColor(HealthBar[6],COLOR_HPBAR_75100);
    
TextDrawTextSize(HealthBar[6],545.0,0.0);
    
HealthBar[7] = TextDrawCreate(608.5,71.0,"_");                              // Задний фон (50-75)
    
TextDrawLetterSize(HealthBar[7],0.5,0.0);
    
TextDrawUseBox(HealthBar[7],1);
    
TextDrawBoxColor(HealthBar[7],COLOR_HPBAR_5075BG);
    
TextDrawTextSize(HealthBar[7],545.0,0.0);
    
HealthBar[8] = TextDrawCreate(591.5,71.0,"_");                              // >= 70
    
TextDrawLetterSize(HealthBar[8],0.5,0.0);
    
TextDrawUseBox(HealthBar[8],1);
    
TextDrawBoxColor(HealthBar[8],COLOR_HPBAR_5075);
    
TextDrawTextSize(HealthBar[8],545.0,0.0);
    
HealthBar[9] = TextDrawCreate(588.5,71.0,"_");                              // >= 65
    
TextDrawLetterSize(HealthBar[9],0.5,0.0);
    
TextDrawUseBox(HealthBar[9],1);
    
TextDrawBoxColor(HealthBar[9],COLOR_HPBAR_5075);
    
TextDrawTextSize(HealthBar[9],545.0,0.0);
    
HealthBar[10] = TextDrawCreate(585.5,71.0,"_");                             // >= 60
    
TextDrawLetterSize(HealthBar[10],0.5,0.0);
    
TextDrawUseBox(HealthBar[10],1);
    
TextDrawBoxColor(HealthBar[10],COLOR_HPBAR_5075);
    
TextDrawTextSize(HealthBar[10],545.0,0.0);
    
HealthBar[11] = TextDrawCreate(582.5,71.0,"_");                             // >= 55
    
TextDrawLetterSize(HealthBar[11],0.5,0.0);
    
TextDrawUseBox(HealthBar[11],1);
    
TextDrawBoxColor(HealthBar[11],COLOR_HPBAR_5075);
    
TextDrawTextSize(HealthBar[11],545.0,0.0);
    
HealthBar[12] = TextDrawCreate(579.0,71.0,"_");                             // >= 50
    
TextDrawLetterSize(HealthBar[12],0.5,0.0);
    
TextDrawUseBox(HealthBar[12],1);
    
TextDrawBoxColor(HealthBar[12],COLOR_HPBAR_5075);
    
TextDrawTextSize(HealthBar[12],545.0,0.0);
    
HealthBar[13] = TextDrawCreate(608.5,71.0,"_");                             // BG (25-50)
    
TextDrawLetterSize(HealthBar[13],0.5,0.0);
    
TextDrawUseBox(HealthBar[13],1);
    
TextDrawBoxColor(HealthBar[13],COLOR_HPBAR_2550BG);
    
TextDrawTextSize(HealthBar[13],545.0,0.0);
    
HealthBar[14] = TextDrawCreate(576.0,71.0,"_");                             // >= 45
    
TextDrawLetterSize(HealthBar[14],0.5,0.0);
    
TextDrawUseBox(HealthBar[14],1);
    
TextDrawBoxColor(HealthBar[14],COLOR_HPBAR_2550);
    
TextDrawTextSize(HealthBar[14],545.0,0.0);
    
HealthBar[15] = TextDrawCreate(573.0,71.0,"_");                             // >= 40
    
TextDrawLetterSize(HealthBar[15],0.5,0.0);
    
TextDrawUseBox(HealthBar[15],1);
    
TextDrawBoxColor(HealthBar[15],COLOR_HPBAR_2550);
    
TextDrawTextSize(HealthBar[15],545.0,0.0);
    
HealthBar[16] = TextDrawCreate(570.5,71.0"_");                            // >= 35
    
TextDrawLetterSize(HealthBar[16],0.5,0.0);
    
TextDrawUseBox(HealthBar[16],1);
    
TextDrawBoxColor(HealthBar[16],COLOR_HPBAR_2550);
    
TextDrawTextSize(HealthBar[16],545.0,0.0);
    
HealthBar[17] = TextDrawCreate(567.5,71.0,"_");                             // >= 30
    
TextDrawLetterSize(HealthBar[17],0.5,0.0);
    
TextDrawUseBox(HealthBar[17],1);
    
TextDrawBoxColor(HealthBar[17],COLOR_HPBAR_2550);
    
TextDrawTextSize(HealthBar[17],545.0,0.0);
    
HealthBar[18] = TextDrawCreate(564.0,71.0,"_");                             // >= 25
    
TextDrawLetterSize(HealthBar[18],0.5,0.0);
    
TextDrawUseBox(HealthBar[18],1);
    
TextDrawBoxColor(HealthBar[18],COLOR_HPBAR_2550);
    
TextDrawTextSize(HealthBar[18],545.0,0.0);
    return 
1;
}
public 
OnFilterScriptExit()
{
    for(new 
i=0i<19i++)
    {
        
TextDrawHideForAll(HealthBar[i]);
        
TextDrawDestroy(HealthBar[i]);
    }
    return 
1;
}
public 
OnPlayerSpawn(playerid)
{
    
TextDrawShowForPlayer(playerid,HealthBar[0]);
    return 
1;
}
public 
OnPlayerDeath(playerid,killerid,reason)
{
    for(new 
i=0i<19i++) TextDrawHideForPlayer(playerid,HealthBar[i]);
    return 
1;
}
public 
OnPlayerUpdate(playerid)
{
    new 
Float:Health;
    
GetPlayerHealth(playerid,Health);
    if(
Health >= 95)
    {
        for(new 
i=1i<19i++) TextDrawHideForPlayer(playerid,HealthBar[i]);
        
TextDrawShowForPlayer(playerid,HealthBar[1]);
        
TextDrawShowForPlayer(playerid,HealthBar[2]);
    }
    else if(
Health >= 90 && Health 95)
    {
        for(new 
i=1i<19i++) TextDrawHideForPlayer(playerid,HealthBar[i]);
        
TextDrawShowForPlayer(playerid,HealthBar[1]);
        
TextDrawShowForPlayer(playerid,HealthBar[3]);
    }
    else if(
Health >= 85 && Health 90)
    {
        for(new 
i=1i<19i++) TextDrawHideForPlayer(playerid,HealthBar[i]);
        
TextDrawShowForPlayer(playerid,HealthBar[1]);
        
TextDrawShowForPlayer(playerid,HealthBar[4]);
    }
    else if(
Health >= 80 && Health 85)
    {
        for(new 
i=1i<19i++) TextDrawHideForPlayer(playerid,HealthBar[i]);
        
TextDrawShowForPlayer(playerid,HealthBar[1]);
        
TextDrawShowForPlayer(playerid,HealthBar[5]);
    }
    else if(
Health >= 75 && Health 80)
    {
        for(new 
i=1i<19i++) TextDrawHideForPlayer(playerid,HealthBar[i]);
        
TextDrawShowForPlayer(playerid,HealthBar[1]);
        
TextDrawShowForPlayer(playerid,HealthBar[6]);
    }
    else if(
Health >= 70 && Health 75)
    {
        for(new 
i=1i<19i++) TextDrawHideForPlayer(playerid,HealthBar[i]);
        
TextDrawShowForPlayer(playerid,HealthBar[7]);
        
TextDrawShowForPlayer(playerid,HealthBar[8]);
    }
    else if(
Health >= 65 && Health 70)
    {
        for(new 
i=1i<19i++) TextDrawHideForPlayer(playerid,HealthBar[i]);
        
TextDrawShowForPlayer(playerid,HealthBar[7]);
        
TextDrawShowForPlayer(playerid,HealthBar[9]);
    }
    else if(
Health >= 60 && Health 65)
    {
        for(new 
i=1i<19i++) TextDrawHideForPlayer(playerid,HealthBar[i]);
        
TextDrawShowForPlayer(playerid,HealthBar[7]);
        
TextDrawShowForPlayer(playerid,HealthBar[10]);
    }
    else if(
Health >= 55 && Health 60)
    {
        for(new 
i=1i<19i++) TextDrawHideForPlayer(playerid,HealthBar[i]);
        
TextDrawShowForPlayer(playerid,HealthBar[7]);
        
TextDrawShowForPlayer(playerid,HealthBar[11]);
    }
    else if(
Health >= 50 && Health 55)
    {
        for(new 
i=1i<19i++) TextDrawHideForPlayer(playerid,HealthBar[i]);
        
TextDrawShowForPlayer(playerid,HealthBar[7]);
        
TextDrawShowForPlayer(playerid,HealthBar[12]);
    }
    else if(
Health >= 45 && Health 50)
    {
        for(new 
i=1i<19i++) TextDrawHideForPlayer(playerid,HealthBar[i]);
        
TextDrawShowForPlayer(playerid,HealthBar[13]);
        
TextDrawShowForPlayer(playerid,HealthBar[14]);
    }
    else if(
Health >= 40 && Health 45)
    {
        for(new 
i=1i<19i++) TextDrawHideForPlayer(playerid,HealthBar[i]);
        
TextDrawShowForPlayer(playerid,HealthBar[13]);
        
TextDrawShowForPlayer(playerid,HealthBar[15]);
    }
    else if(
Health >= 35 && Health 40)
    {
        for(new 
i=1i<19i++) TextDrawHideForPlayer(playerid,HealthBar[i]);
        
TextDrawShowForPlayer(playerid,HealthBar[13]);
        
TextDrawShowForPlayer(playerid,HealthBar[16]);
    }
    else if(
Health >= 30 && Health 35)
    {
        for(new 
i=1i<19i++) TextDrawHideForPlayer(playerid,HealthBar[i]);
        
TextDrawShowForPlayer(playerid,HealthBar[13]);
        
TextDrawShowForPlayer(playerid,HealthBar[17]);
    }
    else if(
Health >= 25 && Health 30)
    {
        for(new 
i=1i<19i++) TextDrawHideForPlayer(playerid,HealthBar[i]);
        
TextDrawShowForPlayer(playerid,HealthBar[13]);
        
TextDrawShowForPlayer(playerid,HealthBar[18]);
    }
    else
    {
        for(new 
i=0i<19i++) TextDrawHideForPlayer(playerid,HealthBar[i]);
    }
    return 
1;

Reply
#6

Deve ser em PlayerTextdraw.
Reply
#7

PHP код:
forward GetarVida(id); 
public 
GetarVida(id

    new 
string[128], Floatvida
    
GetPlayerHealth(idvida); 
    
format(stringsizeof(string), "Vida: %.1f"vida);
    
TextDrawSetString(playeridvida);
    return 
1

Pronto agora so colocar a textdraw visivel
Reply
#8

Quote:
Originally Posted by FerrariL
Посмотреть сообщение
Deve ser em PlayerTextdraw.
acho que vai ser isso msm, jб estou convertendo tudo de goblal para player, espero que de tudo certo
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)