Problema com TextDraw. -
JacKPanK - 17.07.2016
Gente pelo amor de deus me ajuda nisso.
Eu entro no servidor e fica tudo perfeito, sу que quando entra outro player ele se mistura com a hora jб fiz de tudo pra tentar arrumar e nгo consigo.
PHP код:
#include <a_samp>
#include <dini>
new Text:ScoreTextDraw[MAX_PLAYERS],Text:Kill[MAX_PLAYERS],Text:morte[MAX_PLAYERS];
public OnPlayerConnect(playerid)
{
SetTimer("AtualizarKill", 1000, true);
SetTimer("AtualizarMorte", 1000, true);
SetTimer("AtualizarScore", 1000, true);
new x = 0;
ScoreTextDraw[x] = TextDrawCreate(52.0000, 316.0000, "Level:");
TextDrawBackgroundColor(ScoreTextDraw[x], 255);
TextDrawFont(ScoreTextDraw[x], 1);
TextDrawLetterSize(ScoreTextDraw[x], 0.5199, 1.6000);
TextDrawColor(ScoreTextDraw[x], -1);
TextDrawSetOutline(ScoreTextDraw[x], 1);
new k = 0;
Kill[k] = TextDrawCreate(52.0000, 286.0000, "");
TextDrawBackgroundColor(Kill[k], 255);
TextDrawFont(Kill[k], 1);
TextDrawLetterSize(Kill[k], 0.5199, 1.6000);
TextDrawColor(Kill[k], -1);
TextDrawSetOutline(Kill[k], 1);
new m = 0;
morte[m] = TextDrawCreate(52.0000, 301.0000, "");
TextDrawBackgroundColor(morte[m], 255);
TextDrawFont(morte[m], 1);
TextDrawLetterSize(morte[m], 0.5199, 1.6000);
TextDrawColor(morte[m], -1);
TextDrawSetOutline(morte[m], 1);
return 1;
}
forward AtualizarScore();
public AtualizarScore()
{
for(new x = 0, y = GetMaxPlayers(); x != y; x++)
{
if(!IsPlayerConnected(x)) continue;
new STR[26];
format(STR, 26, "~r~Level:~w~%d", GetPlayerScore(x));
TextDrawShowForPlayer(x, ScoreTextDraw[x]);
TextDrawSetString(ScoreTextDraw[x], STR);
}
return true;
}
forward AtualizarKill(playerid);
public AtualizarKill(playerid)
{
for(new k = 0, l = GetMaxPlayers(); k != l; k++)
{
new nome[30];
new arq[30];
format(arq,sizeof arq,"CONTAS/%s.ini",nome[playerid]);
if(!IsPlayerConnected(k)) continue;
new Killl[31];
format(Killl, 31, "~r~Matou:~w~%d", dini_Int(arq,"Kill"));
TextDrawShowForPlayer(k, Kill[k]);
TextDrawSetString(Kill[k], Killl);
}
return true;
}
forward AtualizarMorte(playerid);
public AtualizarMorte(playerid)
{
for(new m = 0, e = GetMaxPlayers(); m != e; m++)
{
new nome[30];
new arq[30];
format(arq,sizeof arq,"CONTAS/%s.ini",nome[playerid]);
if(!IsPlayerConnected(m)) continue;
new mortee[30];
format(mortee, 30, "~r~Morreu:~w~%d", dini_Int(arq,"Morte"));
TextDrawShowForPlayer(m,morte[m]);
TextDrawSetString(morte[m], mortee);
}
return true;
}
Re: Problema com TextDraw. -
moura98 - 17.07.2016
Tem que criar PlayerTextDraw e usar SetTimerEx
Re: Problema com TextDraw. -
Eddye - 17.07.2016
altere o "Text:" para "PlayerText:" e troque as configuraзхes da textdraws pra esses:
PHP код:
PlayerTextDrawDestroy: Destroy a player-textdraw.
PlayerTextDrawColor: Set the color of the text in a player-textdraw.
PlayerTextDrawBoxColor: Set the color of a player-textdraw's box.
PlayerTextDrawBackgroundColor: Set the background color of a player-textdraw.
PlayerTextDrawAlignment: Set the alignment of a player-textdraw.
PlayerTextDrawFont: Set the font of a player-textdraw.
PlayerTextDrawLetterSize: Set the letter size of the text in a player-textdraw.
PlayerTextDrawTextSize: Set the size of a player-textdraw box (or clickable area for PlayerTextDrawSetSelectable).
PlayerTextDrawSetOutline: Toggle the outline on a player-textdraw.
PlayerTextDrawSetShadow: Set the shadow on a player-textdraw.
PlayerTextDrawSetProportional: Scale the text spacing in a player-textdraw to a proportional ratio.
PlayerTextDrawUseBox: Toggle the box on a player-textdraw.
PlayerTextDrawSetString: Set the text of a player-textdraw.
creio que irб resolver
Re: Problema com TextDraw. -
RDM - 21.07.2016
new x = 0;

vocк estб a criar sempre a textdraw para o id 0 .. utilize
public OnPlayerConnect(playerid)
{
SetTimer("AtualizarKill", 1000, true);
SetTimer("AtualizarMorte", 1000, true);
SetTimer("AtualizarScore", 1000, true);
new x = playerid;
ScoreTextDraw[x] = TextDrawCreate(52.0000, 316.0000, "Level:");
TextDrawBackgroundColor(ScoreTextDraw[x], 255);
TextDrawFont(ScoreTextDraw[x], 1);
TextDrawLetterSize(ScoreTextDraw[x], 0.5199, 1.6000);
TextDrawColor(ScoreTextDraw[x], -1);
TextDrawSetOutline(ScoreTextDraw[x], 1);
Kill[x] = TextDrawCreate(52.0000, 286.0000, "");
TextDrawBackgroundColor(Kill[x], 255);
TextDrawFont(Kill[x], 1);
TextDrawLetterSize(Kill[k], 0.5199, 1.6000);
TextDrawColor(Kill[x], -1);
TextDrawSetOutline(Kill[x], 1);
morte[x] = TextDrawCreate(52.0000, 301.0000, "");
TextDrawBackgroundColor(morte[x], 255);
TextDrawFont(morte[x], 1);
TextDrawLetterSize(morte[x], 0.5199, 1.6000);
TextDrawColor(morte[x], -1);
TextDrawSetOutline(morte[x], 1);
return 1;
}