[Ajuda] Repetiзгo
#1

Estou testando algumas coisas e esse cуdigo estб repetindo as mensagens. Caso o player for administrador aparece desta forma:

http://imgur.com/a/ToFMF

Nesse caso, era apenas aparecer o da tag [Administrador]...

Код:
			foreach(Player, i)
			{
				if(aInfo[playerid][Admin] == 1)
				{
					format(gstring, sizeof(gstring), "{009999}({009966}Canal /n{009999}) [Administrador] %s (%d): %s", PlayerName(playerid), playerid, tmp);
					SendClientMessage(i, GetPlayerColor(playerid), gstring);
				}
				if(aInfo[playerid][Moderador] == 1)
				{
					format(gstring, sizeof(gstring), "{009999}({009966}Canal /n{009999}) [Moderador] %s (%d): %s", PlayerName(playerid), playerid, tmp);
					SendClientMessage(i, GetPlayerColor(playerid), gstring);
				}
  	 			else if(aInfo[playerid][Helper] == 1)
				{
					format(gstring, sizeof(gstring), "{009999}({009966}Canal /n{009999}) [Helper] %s (%d): %s", PlayerName(playerid), playerid, tmp);
					SendClientMessage(i, GetPlayerColor(playerid), gstring);
				}
				else
				{
					if(pInfo[i][Prof] == pInfo[playerid][Prof])
					{
						format(gstring, sizeof(gstring), "{009999}({009966}Canal /n{009999}) [Nнvel %d] %s (%d): %s", pInfo[playerid][Level], PlayerName(playerid), playerid, tmp);
						SendClientMessage(i, GetPlayerColor(playerid), gstring);
					}
				}
			}
Reply
#2

tente:
Код:
			foreach(Player, i)
			{
				if(aInfo[playerid][Admin] == 1)
				{
					format(gstring, sizeof(gstring), "{009999}({009966}Canal /n{009999}) [Administrador] %s (%d): %s", PlayerName(playerid), playerid, tmp);
					SendClientMessage(i, GetPlayerColor(playerid), gstring);
				}
				if(aInfo[playerid][Moderador] == 1)
				{
					format(gstring, sizeof(gstring), "{009999}({009966}Canal /n{009999}) [Moderador] %s (%d): %s", PlayerName(playerid), playerid, tmp);
					SendClientMessage(i, GetPlayerColor(playerid), gstring);
				}
  	 			else if(aInfo[playerid][Helper] == 1)
				{
					format(gstring, sizeof(gstring), "{009999}({009966}Canal /n{009999}) [Helper] %s (%d): %s", PlayerName(playerid), playerid, tmp);
					SendClientMessage(i, GetPlayerColor(playerid), gstring);
				}
				else if
				{
					if(pInfo[i][Prof] == pInfo[playerid][Prof])
					{
						format(gstring, sizeof(gstring), "{009999}({009966}Canal /n{009999}) [Nнvel %d] %s (%d): %s", pInfo[playerid][Level], PlayerName(playerid), playerid, tmp);
						SendClientMessage(i, GetPlayerColor(playerid), gstring);
					}
				}
			}
Reply
#3

vocк esta usando o loop para correr os ids certo ? entгo no lugar de playerid vocк colocar "i" que recebe o valor no loop se nгo apenas vai correr o id do player que digitar.

PHP код:
aInfo[i][Admin] == 
Reply
#4

Pawno para de funcionar.

@Whoo

Farei um teste.
Reply
#5

Quote:
Originally Posted by Whoo
Посмотреть сообщение
vocк esta usando o loop para correr os ids certo ? entгo no lugar de playerid vocк colocar "i" que recebe o valor no loop se nгo apenas vai correr o id do player que digitar.

PHP код:
aInfo[i][Admin] == 
Fiz a mudanзa e verifiquei algumas coisas e sem soluзгo.
Reply
#6

PHP код:
foreach(Playeri)
{
    if(
aInfo[playerid][Admin] == 1)
        
format(gstringsizeof(gstring), "{009999}({009966}Canal /n{009999}) [Administrador] %s (%d): %s"PlayerName(playerid), playeridtmp);
    else if(
aInfo[playerid][Moderador] == 1)
        
format(gstringsizeof(gstring), "{009999}({009966}Canal /n{009999}) [Moderador] %s (%d): %s"PlayerName(playerid), playeridtmp);
    else if(
aInfo[playerid][Helper] == 1)
        
format(gstringsizeof(gstring), "{009999}({009966}Canal /n{009999}) [Helper] %s (%d): %s"PlayerName(playerid), playeridtmp);
        
    else
    {
        if(
pInfo[i][Prof] == pInfo[playerid][Prof])
        {
            
format(gstringsizeof(gstring), "{009999}({009966}Canal /n{009999}) [Nнvel %d] %s (%d): %s"pInfo[playerid][Level], PlayerName(playerid), playeridtmp);
        }
    }
    
SendClientMessage(i, -1gstring);

Reply
#7

PHP код:
foreach(Playeri)
{
    if(
aInfo[i][Admin] == 1)
    {
        
format(gstringsizeof(gstring), "{009999}({009966}Canal /n{009999}) [Administrador] %s (%d): %s"PlayerName(i), itmp);
        
SendClientMessage(playeridGetPlayerColor(i), gstring);
    }
    if(
aInfo[i][Moderador] == 1)
    {
        
format(gstringsizeof(gstring), "{009999}({009966}Canal /n{009999}) [Moderador] %s (%d): %s"PlayerName(i), itmp);
        
SendClientMessage(playeridGetPlayerColor(i), gstring);
    }
    else if(
aInfo[i][Helper] == 1)
    {
        
format(gstringsizeof(gstring), "{009999}({009966}Canal /n{009999}) [Helper] %s (%d): %s"PlayerName(i), itmp);
        
SendClientMessage(playeridGetPlayerColor(i), gstring);
    }
    else if
    {
        if(
pInfo[i][Prof] == pInfo[playerid][Prof] && !aInfo[i][Admin] && !aInfo[i][Moderador] && !aInfo[i][Helper])
        {
            
format(gstringsizeof(gstring), "{009999}({009966}Canal /n{009999}) [Nнvel %d] %s (%d): %s"pInfo[i][Level], PlayerName(i), itmp);
            
SendClientMessage(playeridGetPlayerColor(i), gstring);
        }
    }

Reply
#8

Quote:
Originally Posted by 1sbedx
Посмотреть сообщение
PHP код:
foreach(Playeri)
{
    if(
aInfo[playerid][Admin] == 1)
        
format(gstringsizeof(gstring), "{009999}({009966}Canal /n{009999}) [Administrador] %s (%d): %s"PlayerName(playerid), playeridtmp);
    else if(
aInfo[playerid][Moderador] == 1)
        
format(gstringsizeof(gstring), "{009999}({009966}Canal /n{009999}) [Moderador] %s (%d): %s"PlayerName(playerid), playeridtmp);
    else if(
aInfo[playerid][Helper] == 1)
        
format(gstringsizeof(gstring), "{009999}({009966}Canal /n{009999}) [Helper] %s (%d): %s"PlayerName(playerid), playeridtmp);
        
    else
    {
        if(
pInfo[i][Prof] == pInfo[playerid][Prof])
        {
            
format(gstringsizeof(gstring), "{009999}({009966}Canal /n{009999}) [Nнvel %d] %s (%d): %s"pInfo[playerid][Level], PlayerName(playerid), playeridtmp);
        }
    }
    
SendClientMessage(i, -1gstring);

Deu certo. Obrigado. Qual foi a mudanзa?

@Whoo
Seu cуdigo acabou que o pawno parou de funcionar.
Reply
#9

Quote:
Originally Posted by ThuuGLif3
Посмотреть сообщение
Deu certo. Obrigado. Qual foi a mudanзa?

@Whoo
Seu cуdigo acabou que o pawno parou de funcionar.
PHP код:
foreach(Playeri)
{
    if(
aInfo[playerid][Admin] == 1)
    {
        
format(gstringsizeof(gstring), "{009999}({009966}Canal /n{009999}) [Administrador] %s (%d): %s"PlayerName(playerid), playeridtmp);
        
SendClientMessage(iGetPlayerColor(playerid), gstring);
    }
    if(
aInfo[playerid][Moderador] == 1)
    {
        
format(gstringsizeof(gstring), "{009999}({009966}Canal /n{009999}) [Moderador] %s (%d): %s"PlayerName(playerid), playeridtmp);
        
SendClientMessage(iGetPlayerColor(playerid), gstring);
    }
    else if(
aInfo[playerid][Helper] == 1)
    {
        
format(gstringsizeof(gstring), "{009999}({009966}Canal /n{009999}) [Helper] %s (%d): %s"PlayerName(playerid), playeridtmp);
        
SendClientMessage(iGetPlayerColor(playerid), gstring);
    }
    else
    {
        if(
pInfo[i][Prof] == pInfo[playerid][Prof])
        {
            
format(gstringsizeof(gstring), "{009999}({009966}Canal /n{009999}) [Nнvel %d] %s (%d): %s"pInfo[playerid][Level], PlayerName(playerid), playeridtmp);
            
SendClientMessage(iGetPlayerColor(playerid), gstring);
        }
    }

if, if, else if, else.

PHP код:
foreach(Playeri)
{
    if(
aInfo[playerid][Admin] == 1)
        
format(gstringsizeof(gstring), "{009999}({009966}Canal /n{009999}) [Administrador] %s (%d): %s"PlayerName(playerid), playeridtmp);
    else if(
aInfo[playerid][Moderador] == 1)
        
format(gstringsizeof(gstring), "{009999}({009966}Canal /n{009999}) [Moderador] %s (%d): %s"PlayerName(playerid), playeridtmp);
    else if(
aInfo[playerid][Helper] == 1)
        
format(gstringsizeof(gstring), "{009999}({009966}Canal /n{009999}) [Helper] %s (%d): %s"PlayerName(playerid), playeridtmp);
        
    else
    {
        if(
pInfo[i][Prof] == pInfo[playerid][Prof])
        {
            
format(gstringsizeof(gstring), "{009999}({009966}Canal /n{009999}) [Nнvel %d] %s (%d): %s"pInfo[playerid][Level], PlayerName(playerid), playeridtmp);
        }
    }
    
SendClientMessage(i, -1gstring);

if, else if, else if, else.
Reply


Forum Jump:


Users browsing this thread: 4 Guest(s)