21.04.2014, 15:53
Como vocк nгo falou o problema, fica difнcil, mas vamos lб.
Erros que percebi:
- Quando o gamemode inicia, ele cria a variбvel "contagem" e jб seta em uma textdraw antes mesmo de definir quanto й a contagem.
- A contagem й aumentada quando um player conecta, mas nгo й diminuнda quando o mesmo desconecta.
- O textdraw nгo estб sendo setado, permanecendo o mesmo o tempo todo.
- Sгo "MAX_PLAYERS" de variбveis diferentes, logo diferentes contagens para cada player. Vocк estб setando variбveis diferentes para uma mesma textdraw, dando um verdadeiro choque de informaзхes.
Erros que percebi:
- Quando o gamemode inicia, ele cria a variбvel "contagem" e jб seta em uma textdraw antes mesmo de definir quanto й a contagem.
- A contagem й aumentada quando um player conecta, mas nгo й diminuнda quando o mesmo desconecta.
- O textdraw nгo estб sendo setado, permanecendo o mesmo o tempo todo.
- Sгo "MAX_PLAYERS" de variбveis diferentes, logo diferentes contagens para cada player. Vocк estб setando variбveis diferentes para uma mesma textdraw, dando um verdadeiro choque de informaзхes.
PHP код:
new Text:ContarPlayers;
new Contagem = 0;
OnGameModeInit()
{
ContarPlayers = TextDrawCreate(16.000000,353.000000, "~b~ 0/100");
TextDrawBackgroundColor(ContarPlayers,BRANCO);
TextDrawFont(ContarPlayers,3);
TextDrawLetterSize(ContarPlayers,0.499999,1.300000);
TextDrawBoxColor(ContarPlayers, AZULZAO);
TextDrawColor(ContarPlayers, LILAS);
TextDrawSetOutline(ContarPlayers,2);
TextDrawSetProportional(ContarPlayers,1);
TextDrawSetShadow(ContarPlayers,1);
return 1;
}
public OnPlayerRequestClass(playerid, classid)
{
TextDrawShowForPlayer(playerid, ContarPlayers);
return 1;
}
public OnPlayerConnect(playerid)
{
Contagem++;
new msg[64];
format(msg, sizeof(msg), "~b~ %i/100", Contagem);
TextDrawSetString(ContarPlayers, msg);
return 1;
}
public OnPlayerDisconnect(playerid, reason)
{
Contagem--;
new msg[64];
format(msg, sizeof(msg), "~b~ %i/100", Contagem);
TextDrawSetString(ContarPlayers, msg);
return 1;
}

