[Ajuda] TextDraw Para contar Players
#1

Olб estou com algumas duvidas nisto aqui:

pawn Код:
new Text:ContarPlayers;
new Contagem[MAX_PLAYERS];
OnGameModeInit()
{
 ContarPlayers = TextDrawCreate(16.000000,353.000000, "~b~ %s/100", Contagem);
    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[playerid]++;
 return 1;
}
Eu Retirei so estas partes do GM para vocкs ver o que estб errado ai.. Obrigado
Reply
#2

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.

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(ContarPlayersAZULZAO);
    
TextDrawColor(ContarPlayersLILAS);
    
TextDrawSetOutline(ContarPlayers,2);
    
TextDrawSetProportional(ContarPlayers,1);
    
TextDrawSetShadow(ContarPlayers,1);
    return 
1;
}
public 
OnPlayerRequestClass(playeridclassid)
{
 
TextDrawShowForPlayer(playeridContarPlayers);
 return 
1;
}
public 
OnPlayerConnect(playerid)

 
Contagem++;
 new 
msg[64];
 
format(msgsizeof(msg), "~b~ %i/100"Contagem);
 
TextDrawSetString(ContarPlayersmsg);
 return 
1;
}
public 
OnPlayerDisconnect(playeridreason)
{
 
Contagem--;
 new 
msg[64];
 
format(msgsizeof(msg), "~b~ %i/100"Contagem);
 
TextDrawSetString(ContarPlayersmsg);
 return 
1;

Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)