Portal SAMP
[Ajuda] textraw - Versão de Impressão

+- Portal SAMP (https://portalsamp.com)
+-- Fórum: SA-MP (https://portalsamp.com/forumdisplay.php?fid=5)
+--- Fórum: Área de suporte (https://portalsamp.com/forumdisplay.php?fid=6)
+--- Tópico: [Ajuda] textraw (/showthread.php?tid=866)



textraw - Sam2018 - 05/03/2021

qual é a melhor opção? para mostrar o texto, desenhe os exemplos funcionam. 1 ou 2

_1
Código:
new PlayerText:Stat;

new PlayerText:FPG;

public OnPlayerSpawn(playerid)


PlayerTextDrawShow(playerid, FPG);
PlayerTextDrawShow(playerid, Stat);




forward UpdatePlayer(playerid);
public UpdatePlayer(playerid)

{

foreach(new i : Player)

{

new sstring[256];

format(sstring,sizeof(sstring),"~r~~h~score: ~w~%d ~r~~h~kills: ~w~%d ~r~~h~deaths: ~w~%d ~r~~h~vip: ~w~%d ~r~~h~Exp: ~w~%d ~r~~h~HeadShoot: ~w~%d ~r~~h~rank: ~w~%s",GetPlayerScore(i),PlayerInfo[i][Kills],

PlayerInfo[i][Deaths],PlayerInfo[i][vip],PlayerInfo[i][XPX],PlayerInfo[i][HST],GetXP(i));

    PlayerTextDrawSetString(i,Stat, sstring);



new FPSSS = GetPlayerDrunkLevel(i), fps;

if (FPSSS < 100) { SetPlayerDrunkLevel(i, 2000);

} else {

if (FPSSS != FPSS[i])

{

  fps = FPSS[i] - FPSSS;

  if (fps > 0 && fps < 200) FPS[i] = fps; FPSS[i] = FPSSS;

  }

}

new Fstring[60];

format(Fstring,sizeof(Fstring),"~r~~h~fps:~w~ %d  ~r~~h~Ping: ~w~%d",FPS[i],GetPlayerPing(i));

    PlayerTextDrawSetString(i,FPG, Fstring);

}

return 1;
}


stock HCB(playerid)
{

Stat = CreatePlayerTextDraw(playerid, 302.588287, 426.416839, "_");

PlayerTextDrawLetterSize(playerid, Stat, 0.235881, 0.958333);

PlayerTextDrawAlignment(playerid, Stat, 2);

PlayerTextDrawColor(playerid, Stat, -1);

PlayerTextDrawSetShadow(playerid, Stat, 0);

PlayerTextDrawSetOutline(playerid, Stat, 1);

PlayerTextDrawBackgroundColor(playerid, Stat, 51);

PlayerTextDrawFont(playerid, Stat, 2);

PlayerTextDrawSetProportional(playerid, Stat, 1);



FPG = CreatePlayerTextDraw(playerid, 547.765014, 28.000236, "_");

PlayerTextDrawLetterSize(playerid, FPG, 0.155411, 1.284999);

PlayerTextDrawAlignment(playerid, FPG, 1);

PlayerTextDrawColor(playerid, FPG, -1);

PlayerTextDrawSetShadow(playerid, FPG, 0);

PlayerTextDrawSetOutline(playerid, FPG, 1);

PlayerTextDrawBackgroundColor(playerid, FPG, 51);

PlayerTextDrawFont(playerid, FPG, 2);

PlayerTextDrawSetProportional(playerid, FPG, 2);

return 1;
}

____2
Código:
new Text:Stat[MAX_PLAYERS];

new Text:FPG[MAX_PLAYERS];
public OnGameModeInit()
for(new playerid; playerid < MAX_PLAYERS; playerid++)
{

    Stat[playerid] = TextDrawCreate(302.588287, 426.416839, "~r~~h~score: ~h~~w~%d ~r~~h~kills: ~h~~w~%d ~r~~h~deaths: ~h~~w~%d ~r~~h~vip: ~h~~w~%d ~r~~h~Exp: ~h~~w~%d");

TextDrawLetterSize(Stat[playerid], 0.235881, 0.958333);

TextDrawAlignment(Stat[playerid], 2);

TextDrawColor(Stat[playerid], -1);

TextDrawSetShadow(Stat[playerid], 0);

TextDrawSetOutline(Stat[playerid], 1);

TextDrawBackgroundColor(Stat[playerid], 51);

TextDrawFont(Stat[playerid], 2);

TextDrawSetProportional(Stat[playerid], 1);



FPG[playerid] = TextDrawCreate(547.765014, 28.000236, "fps:50 ping:250");

TextDrawLetterSize(FPG[playerid], 0.155411, 1.284999);

TextDrawAlignment(FPG[playerid], 1);

TextDrawColor(FPG[playerid], -16776961);

TextDrawSetShadow(FPG[playerid], 0);

TextDrawSetOutline(FPG[playerid], 0);

TextDrawBackgroundColor(FPG[playerid], 51);

TextDrawFont(FPG[playerid], 2);

TextDrawSetProportional(FPG[playerid], 1);
    }



public OnPlayerSpawn(playerid)


TextDrawShowForPlayer(playerid, Stat[playerid]);
TextDrawShowForPlayer(playerid, FPG[playerid]);



forward UpdatePlayer(playerid);
public UpdatePlayer(playerid)

{

new sstring[256];

format(sstring,sizeof(sstring),"~r~~h~score: ~w~%d ~r~~h~kills: ~w~%d ~r~~h~deaths: ~w~%d ~r~~h~vip: ~w~%d ~r~~h~Exp: ~w~%d ~r~~h~HeadShoot: ~w~%d ~r~~h~rank: ~w~%s",GetPlayerScore(playerid),PlayerInfo[playerid][Kills],

PlayerInfo[playerid][Deaths],PlayerInfo[playerid][vip],PlayerInfo[playerid][XPX],PlayerInfo[playerid][HST],GetXP(playerid));

TextDrawSetString(Stat[playerid],sstring);



new FPSSS = GetPlayerDrunkLevel(playerid), fps;

if (FPSSS < 100) { SetPlayerDrunkLevel(playerid, 2000);

} else {

if (FPSSS != FPSS[playerid])

{

  fps = FPSS[playerid] - FPSSS;

  if (fps > 0 && fps < 200) FPS[playerid] = fps; FPSS[playerid] = FPSSS;

  }

}

new Fstring[60];

format(Fstring,sizeof(Fstring),"~r~~h~fps:~w~ %d  ~r~~h~Ping: ~w~%d",FPS[playerid],GetPlayerPing(playerid));

TextDrawSetString(FPG[playerid],Fstring);

return 1;
}



RE: textraw - Levi.M - 05/03/2021

O segundo, parece ser melhor.


RE: textraw - Sam2018 - 05/03/2021

(05/03/2021 11:41)Levi.M Escreveu: O segundo, parece ser melhor.

e porque não ? playertext


RE: textraw - Levi.M - 05/03/2021

Na verdade playertext seria melhor pra mostrar pra cada jogador.