[Ajuda] Comando sу vai para o ID 0
#1

pawn Code:
if(strcmp(cmd, "/iniciarderby", true) == 0)
    {
   for(new i=0; i<MAX_PLAYERS; i++)
        {
        if(IsPlayerConnected(i))
        {
            if (PlayerInfo[playerid][pAdmin] < 4)
            {
                SendClientMessage(playerid, COLOR_GRAD1, "   Vocк nгo tem permiзгo para ultilizar este comando!");
                return 1;
                }
                if(carroderby[i] == 0)
                {
                SendClientMessage(playerid, COLOR_GREY,"Nгo hб carros criados, crie os veнculos para poder iniciar o evento!");
                return 1;
                }
                if(derbyiniciado[i] == 0)
                {
                SendClientMessage(playerid, COLOR_GREY,"Jб estб acontecendo um evento de Derby, espere atй que o inicial termine!");
                return 1;
                }
                if(entrouderby[i] == 1)
                {
                GetPlayerName(playerid, sendername, sizeof(sendername));
                format(string, sizeof(string), "Notнcias do Evento: O Admin %s iniciou o evento de Derby e o evento foi trancado!",sendername);
                SendClientMessageToAll(TEAM_CYAN_COLOR, string);
                TogglePlayerControllable(i, 1);
                SendClientMessage(i, COLOR_LIGHTBLUE,"Sinal verde, GO, GO, GO!");
                format(gstring, sizeof(gstring), "~g~GO, GO, GO!");
                GameTextForPlayer(i, gstring, 15000, 6);
                derbyiniciado[i] = 1;
                derbyevento = 0;
                return 1;
                }
            return 1;
            }
        return 1;
        }
    return 1;
    }
O que tem de errado nгo consigo achar o prуblema, a mensagem "GO, GO, GO!" e o descongelamento sу vai ao ID 0, alguйm pode me ajudar sobre isso?
Obrigado.
Alguйm pode me ajudar?
Reply
#2

tenta ae
PHP Code:
if(strcmp(cmdtext,"/iniciarderby"true) == 0)
{
    if (
PlayerInfo[playerid][pAdmin] < 4) return SendClientMessage(playeridCOLOR_GRAD1"   Vocк nгo tem permissгo para utilizar este comando!");
    for(new 
0MAX_PLAYERSi++)
    {
        if(
IsPlayerConnected(i))
        {
            if(
carroderby[i] == 0) return SendClientMessage(playeridCOLOR_GREY,"Nгo hб carros criados, crie os veнculos para poder iniciar o evento!");
            if(
derbyiniciado[i] == 0) return SendClientMessage(playeridCOLOR_GREY,"Jб estб acontecendo um evento de Derby, espere atй que o inicial termine!");
            if(
entrouderby[i] == 1)
            {
                
GetPlayerName(playeridsendernamesizeof(sendername));
                
format(stringsizeof(string), "Notнcias do Evento: O Admin %s iniciou o evento de Derby e o evento foi trancado!",sendername);
                
SendClientMessage(i,TEAM_CYAN_COLORstring);
                
TogglePlayerControllable(i1);
                
SendClientMessage(i,COLOR_LIGHTBLUE,"Sinal verde, GO, GO, GO!");
                
GameTextForPlayer(i,"~g~GO, GO, GO!"150006);
                
derbyiniciado[i] = 1,derbyevento 0;
                return 
1;
            }
            return 
1;
        }
        return 
1;
    }
    return 
1;

Reply
#3

PHP Code:
if( !strcmpcmdtext"/iniciarderby"true ) )
{
   if( 
PlayerInfoplayerid ][ pAdmin ] < ) return SendClientMessageplayeridCOLOR_GRAD1"Vocк nгo tem permissгo para usar este comando!" );
   for( new 
0<= MAX_PLAYERSi++ )
   {
      if( 
IsPlayerConnected) )
      {
         if( 
carroderby] == ) return SendClientMessageCOLOR_GREY"Nгo hб carros criados. Crie os veiculos para poder iniciar o evento!" );         
         if( 
derbyiniciado] == ) return SendClientMessageplayeridCOLOR_GREY"Jб estб acontecendo um evento de Derby, espere atй que o inicial termine!" );
         if( 
entrouderby] == )
         {
            
GetPlayerNameplayeridsendernamesizeofsendername ) );
            
formatstringsizeof( string ), "Notнcias do Evento: O Admin %s iniciou o evento de Derby e o evento foi trancado!"sendername );
            
SendClientMessageToAllTEAM_CYAN_COLORstring );
            
TogglePlayerControllablei);
            
SendClientMessageiCOLOR_LIGHTBLUE"Sinal verde, GO, GO, GO!" );
            
formatgstringsizeofgstring ), "~g~GO, GO, GO!" );
            
GameTextForPlayerigstring15000);
            
derbyiniciado] = 1;
            
derbyevento 0;
         }
      }
   }
   return 
true;

O comando estб certo, se continuar a dar o mesmo erro й porque vocк criou as arrays mal.
vocк criou:
PHP Code:
new derbyiniciadoMAX_PLAYERS ]; 
e essa funзгo deveria ser sem MAX_PLAYERS, deveria ser usada:
PHP Code:
derbyiniciado == 0/
Sem necessidade de alguma de usar max_players mesmo.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)