[AJUDA] TextDraw Sumindo -
Mattos - 22.08.2011
Pessoal tenho uma funзгo aqui no meu adm, que em cima dos dados dos aruivos de cada player, ele gera um score. No meu caso, a cada 1 kill o player ganha 1 de repeito e com 5 de respeito o player ganha 1 score. A fуrmula esta toda correta mesmo sendo gigante nao me corrijam sobre isso. O problema й que o Text draw estб sumindo, nao faзo a minima idйia e nem quanto tempo ele ta durando la. Sei que eu lio o sv, e sl, dia seguinte eu to jogando e percebo que ele sumiu.
Ai nao sei se й alguma interferencia do meu adm... eu sei que eu tenho que desligar e ligar o sv todo dia a noite quando nao tem ninguem pro textdraw reaparecer. Talvez se nao houver nenhum problema com o code do textdraw e o problema й um conflito, eu estava pensando se existe a possibilidade de um comando que faz o textdraw aparecer.
Em baixo o cуdigo
pawn Код:
new Text:Coisa[MAX_PLAYERS];
public OnPlayerConnect(playerid)
{
SetTimer("Killstreak", 5000, true);
}
public OnPlayerSpawn(playerid)
{
Coisa[playerid] = TextDrawCreate(160.000000, 360.000000, "__");
TextDrawBackgroundColor(Coisa[playerid], 255);
TextDrawFont(Coisa[playerid], 1);
TextDrawLetterSize(Coisa[playerid], 0.300000, 1.000000);
TextDrawColor(Coisa[playerid], -1);
TextDrawSetOutline(Coisa[playerid], 1);
TextDrawSetProportional(Coisa[playerid], 1);
TextDrawUseBox(Coisa[playerid], 0);
TextDrawBoxColor(Coisa[playerid], 255);
TextDrawTextSize(Coisa[playerid], 620.000000, 0.000000);
TextDrawShowForPlayer(playerid, Coisa[playerid]);
}
forward Killstreak();
public Killstreak()
{
for(new playerid = 0; playerid < MAX_PLAYERS; playerid ++)
{
if(IsPlayerConnected(playerid))
{
new str[128];
new lvl2;
new lvl = (pDataInfo[playerid][Matou]+pDataInfo[playerid][Kills]-lvl2/5)/5;
if(lvl < 0)
{
lvl2=0;
}
else lvl2=lvl;
format(str, 128, "~w~Info /score /vip : ~n~~g~Matou: ~w~%d ~n~~g~Morreu: ~w~%d ~n~~y~Respeito: ~w~%d ~n~~b~Score: ~w~%d" , pDataInfo[playerid][Matou]+ pDataInfo[playerid][Kills], pDataInfo[playerid][Morreu]+ pDataInfo[playerid][Deaths], pDataInfo[playerid][Matou]+ pDataInfo[playerid][Kills]-(5*lvl2), lvl2);
TextDrawSetString(Text:Coisa[playerid], str);
}
}
}
public OnPlayerUpdate(playerid)
{
new lvl2;
new lvl = (pDataInfo[playerid][Matou]+pDataInfo[playerid][Kills]-lvl2/5)/5;
if(lvl < 0)
{
lvl2=0;
}
else lvl2=lvl;
SetPlayerScore(playerid, lvl2);
return 1;
}
Se precisar de mais cуdigo й sу pedir que posto toda a public. Se for o caso atй meu adm pra resolver esse problema .... de saco cheio ja ¬¬
Desde jб agradeзo
Re: [AJUDA] TextDraw Sumindo -
Mattos - 22.08.2011
Pessoal, eu adicionei mais uma parte do cуdigo que estava faltando, e venho acrescentar no meu pedido mais uma coisa. Os numeros quando se alteram ficam sobrepostos:
Re: [AJUDA] TextDraw Sumindo -
Rickye - 23.08.2011
TextDrawShowForPlayer ... TextDrawShowForAll
TextDrawHideForPlayer... TextDrawHideForAll
tudo no wiki
Re: [AJUDA] TextDraw Sumindo -
Mattos - 23.08.2011
cara... eu fiz tudo que o wiki disse mais ele some... alguem pode ajudar?
Re: [AJUDA] TextDraw Sumindo -
StrondA_ - 23.08.2011
tem return ?
Код:
new Text:Coisa[MAX_PLAYERS];
forward Killstreak();
public OnPlayerConnect(playerid)
{
SetTimer("Killstreak", 5000, true);
return true;
}
public OnPlayerSpawn(playerid)
{
Coisa[playerid] = TextDrawCreate(160.000000, 360.000000, "__");
TextDrawBackgroundColor(Coisa[playerid], 255);
TextDrawFont(Coisa[playerid], 1);
TextDrawLetterSize(Coisa[playerid], 0.300000, 1.000000);
TextDrawColor(Coisa[playerid], -1);
TextDrawSetOutline(Coisa[playerid], 1);
TextDrawSetProportional(Coisa[playerid], 1);
TextDrawUseBox(Coisa[playerid], 0);
TextDrawBoxColor(Coisa[playerid], 255);
TextDrawTextSize(Coisa[playerid], 620.000000, 0.000000);
TextDrawShowForPlayer(playerid, Coisa[playerid]); // Irб fazer aparecer o TextDraw ao nascer..
return true;
}
public Killstreak()
{
for(new playerid = 0; playerid < MAX_PLAYERS; playerid ++)
{
if(IsPlayerConnected(playerid))
{
new str[128];
new lvl2;
new lvl = (pDataInfo[playerid][Matou]+pDataInfo[playerid][Kills]-lvl2/5)/5;
if(lvl < 0)
{
lvl2=0;
}
else lvl2=lvl;
format(str, 128, "~w~Info /score /vip : ~n~~g~Matou: ~w~%d ~n~~g~Morreu: ~w~%d ~n~~y~Respeito: ~w~%d ~n~~b~Score: ~w~%d" , pDataInfo[playerid][Matou]+ pDataInfo[playerid][Kills], pDataInfo[playerid][Morreu]+ pDataInfo[playerid][Deaths], pDataInfo[playerid][Matou]+ pDataInfo[playerid][Kills]-(5*lvl2), lvl2);
TextDrawSetString(Text:Coisa[playerid], str);
}
}
return true;
}
public OnPlayerUpdate(playerid)
{
new lvl2;
new lvl = (pDataInfo[playerid][Matou]+pDataInfo[playerid][Kills]-lvl2/5)/5;
if(lvl < 0)
{
lvl2=0;
}
else lvl2=lvl;
SetPlayerScore(playerid, lvl2);
return true;
}
Cloused...
Re: [AJUDA] TextDraw Sumindo -
Mattos - 23.08.2011
Tipo, deu pra por o return true; sу no public KillStreak() ja no onplanerspawn e no public OnPlayerUpdate nao vejo necessidade de por o Return True pq ja tem la o return 1; sу nao tinha posto ali no post acimao return 1 do onplayerspawn pq tinha mais codigos abaixo...
Bom acho que й isso, vou ver se resolve o retrun true ali no KillStreak.... Muito Obrigado Qualqur coisa eu volto a falr aqui...
Re: [AJUDA] TextDraw Sumindo -
Lуs - 23.08.2011
Isso pra mim parece que ele tб lendo 1 textdraw para todos os players, ou seja ele tб criando 1 textdraw para todos os players do servidor, jб tive um problema com isso e minha soluзгo foi criar a textdraw somente para 1 player por parte, vocк deve tб atribuindo ela para criar para todos no OnGameModeInit, tenta atribuir no OnPlayerSpawn e sem loop.
Re: [AJUDA] TextDraw Sumindo -
Mattos - 23.08.2011
Nгo to nao *-*
Cada um tem seu textdraw e o code nao ta no GM
O problema nao tem relaзгo com isso... o problema й ele sumir, mais ainda totestando o return que o Stronda Propos... tenho que analisar por uns dois dias pelo menos pra ver se vai sumir ou nao... em dois dias eu volto a postar pra falar se funcionou...
Re: [AJUDA] TextDraw Sumindo -
JonathanFeitosa - 23.08.2011
pawn Код:
new Text:Coisa[MAX_PLAYERS];
public OnGameModeInit()
{
SetTimer("Killstreak", 5000, true);
Coisa[playerid] = TextDrawCreate(160.000000, 360.000000, "__");
TextDrawBackgroundColor(Coisa[playerid], 255);
TextDrawFont(Coisa[playerid], 1);
TextDrawLetterSize(Coisa[playerid], 0.300000, 1.000000);
TextDrawColor(Coisa[playerid], -1);
TextDrawSetOutline(Coisa[playerid], 1);
TextDrawSetProportional(Coisa[playerid], 1);
TextDrawUseBox(Coisa[playerid], 0);
TextDrawBoxColor(Coisa[playerid], 255);
TextDrawTextSize(Coisa[playerid], 620.000000, 0.000000);
TextDrawShowForPlayer(playerid, Coisa[playerid]);
return true;
}
public OnPlayerConnect(playerid)
{
TextDrawShowForPlayer(playerid, Coisa[playerid]);
return true;
}
public OnGameModeExit()
{
TextDrawHideForAll(Coisa[playerid]);
TextDrawDestroy(Coisa[playerid]);
return true;
}
forward Killstreak();
public Killstreak()
{
for(new playerid = 0; playerid < MAX_PLAYERS; playerid ++)
{
if(IsPlayerConnected(playerid))
{
new str[128];
new lvl2;
new lvl = (pDataInfo[playerid][Matou]+pDataInfo[playerid][Kills]-lvl2/5)/5;
if(lvl < 0)
{
lvl2=0;
}
else lvl2=lvl;
format(str, 128, "~w~Info /score /vip : ~n~~g~Matou: ~w~%d ~n~~g~Morreu: ~w~%d ~n~~y~Respeito: ~w~%d ~n~~b~Score: ~w~%d" , pDataInfo[playerid][Matou]+ pDataInfo[playerid][Kills], pDataInfo[playerid][Morreu]+ pDataInfo[playerid][Deaths], pDataInfo[playerid][Matou]+ pDataInfo[playerid][Kills]-(5*lvl2), lvl2);
TextDrawSetString(Text:Coisa[playerid], str);
return true;
}
return true;
}
return true;
}
Acho que vai ^^
Re: [AJUDA] TextDraw Sumindo -
JonathanFeitosa - 23.08.2011
pawn Код:
new Text:Coisa[MAX_PLAYERS];
public OnFilterScriptInit()
{
SetTimer("Killstreak", 5000, true);
Coisa[playerid] = TextDrawCreate(160.000000, 360.000000, "__");
TextDrawBackgroundColor(Coisa[playerid], 255);
TextDrawFont(Coisa[playerid], 1);
TextDrawLetterSize(Coisa[playerid], 0.300000, 1.000000);
TextDrawColor(Coisa[playerid], -1);
TextDrawSetOutline(Coisa[playerid], 1);
TextDrawSetProportional(Coisa[playerid], 1);
TextDrawUseBox(Coisa[playerid], 0);
TextDrawBoxColor(Coisa[playerid], 255);
TextDrawTextSize(Coisa[playerid], 620.000000, 0.000000);
TextDrawShowForPlayer(playerid, Coisa[playerid]);
return true;
}
public OnPlayerConnect(playerid)
{
TextDrawShowForPlayer(playerid, Coisa[playerid]);
return true;
}
public OnFilterScriptExit()
{
TextDrawHideForAll(Coisa[playerid]);
TextDrawDestroy(Coisa[playerid]);
return true;
}
forward Killstreak();
public Killstreak()
{
for(new playerid = 0; playerid < MAX_PLAYERS; playerid ++)
{
if(IsPlayerConnected(playerid))
{
new str[128];
new lvl2;
new lvl = (pDataInfo[playerid][Matou]+pDataInfo[playerid][Kills]-lvl2/5)/5;
if(lvl < 0)
{
lvl2=0;
}
else lvl2=lvl;
format(str, 128, "~w~Info /score /vip : ~n~~g~Matou: ~w~%d ~n~~g~Morreu: ~w~%d ~n~~y~Respeito: ~w~%d ~n~~b~Score: ~w~%d" , pDataInfo[playerid][Matou]+ pDataInfo[playerid][Kills], pDataInfo[playerid][Morreu]+ pDataInfo[playerid][Deaths], pDataInfo[playerid][Matou]+ pDataInfo[playerid][Kills]-(5*lvl2), lvl2);
TextDrawSetString(Text:Coisa[playerid], str);
return true;
}
return true;
}
return true;
}
PS: й Porque quando o servidor for desligado, o TextDraw se auto destruirб para todos ^^