[Ajuda] Rum timer error
#1

Olб, estou aqui mais uma vez com esse erro bobo que estб quebrando cabeзa, mas sei que ele estб tentando acessar um valor que nгo foi criado, mas minha pergunta й, qual dos 3 parвmetros ali em baixo estб tentando acessar 155?

giveplayerid, result, ou PlayerName ?

[20:22:36] [debug] Run time error 4: "Array index out of bounds"
[20:22:36] [debug] Accessing element at index 155 past array upper bound 23
[20:42:31] [debug] #1 00244310 in public OnPlayerCommandText (playerid=1, cmdtext[]=@00329704 "/ban aand teste") at C:\Users\lucas\Desktop\Mania Gamer\gamemodes\MGR.pwn:36555

A linha 36555 й essa aqui:

PHP Code:
SBan(giveplayeridresultPlayerName(playerid)); 
Poderiam me explicar? Obrigado!
Reply
#2

Й um comando de banir de um GM estilo GF que eu tirei, estб ok o cуdigo, mas consigo banir normalmente 1 pessoa, se eu for banir outra, da o problema e nгo bane, so da a mensagem.

PHP Code:
if(strcmp(cmd"/ban"true) == 0)
    {
        if(
IsPlayerConnected(playerid))
        {
            
tmp strtok(cmdtextidx);
            if(!
strlen(tmp))
            {
                
SendClientMessage(playeridCOLOR_GRAD2"USE: /ban [ id ] [razгo]");
                return 
1;
            }
            
giveplayerid ReturnUser(tmp);
            if(
PlayerInfo[playerid][pAdmin] >= 3)
            {
                if(
admtrampando[playerid] < && PlayerInfo[playerid][pAdmin] != 1340 && PlayerInfo[playerid][pAdmin] != 1341 && PlayerInfo[playerid][pAdmin] != 1342)
                {
                    
SendClientMessage(playeridCOLOR_GRAD1"Vocк nгo estб trabalhando! (/trabalhar)");
                    return 
1;
                }
                if(
IsPlayerConnected(giveplayerid))
                {
                    if(
giveplayerid != INVALID_PLAYER_ID)
                    {
                        if(
PlayerInfo[giveplayerid][pAdmin] >= && PlayerInfo[playerid][pAdmin] != 1342)
                        {
                            if(
giveplayerid != playerid)
                            {
                                 
format(stringsizeof(string), "ID [%d] Nгo estб Online."giveplayerid);
                                 
SendClientMessage(playeridCOLOR_GRAD1string);
                                 return 
1;
                            }
                        }
                        
GetPlayerName(giveplayeridgiveplayersizeof(giveplayer));
                        
GetPlayerName(playeridsendernamesizeof(sendername));
                        new 
length strlen(cmdtext);
                        while ((
idx length) && (cmdtext[idx] <= ' '))
                        {
                            
idx++;
                        }
                        new 
offset idx;
                        new 
result[64];
                        while ((
idx length) && ((idx offset) < (sizeof(result) - 1)))
                        {
                            
result[idx offset] = cmdtext[idx];
                            
idx++;
                        }
                        
result[idx offset] = EOS;
                        if(!
strlen(result))
                        {
                            
SendClientMessage(playeridCOLOR_GRAD2"USE: /banir [ id ] [motivo]");
                            return 
1;
                        }
                        
getdate(yearmonthday);
                        
pban[playerid] += 1;
                        if(
pban[playerid] >= && PlayerInfo[playerid][pAdmin] != 1341 && PlayerInfo[playerid][pAdmin] != 1342)
                        {
                             
SBan(playerid"Baniu mais de 3""Automatico");
                             return 
1;
                        }
                        
format(stringsizeof(string), "ADMIN CMD: %s foi banido por %s, Motivo: %s (%d-%d-%d)"giveplayersendername, (result),day,month,year);
                        
BanLog(string);
                        
format(stringsizeof(string), "ADMIN CMD: %s foi banido por %s, Motivo: %s"giveplayersendername, (result));
                        
SendClientMessageToAll(COLOR_LIGHTREDstring);
                        
SendClientMessage(giveplayeridCOLOR_YELLOW"|________________Instruзхes para Revisгo de Ban________________|");
                        
SendClientMessage(giveplayeridCOR_AL"Tire uma SS da tela apertando F8 imediatamente apуs ser banido");
                        
SendClientMessage(giveplayeridCOR_AL"E acesse o nosso forum: maniagamer.forum-pro.net");
                        
SendClientMessage(giveplayeridCOLOR_LIGHTRED"Atenзгo: Vocк sу serб desbanido se for inocente !");
                        
PlayerInfo[giveplayerid][pBan] = 1;
                           
CarroLost(giveplayerid);
                        
House2Lost(giveplayerid);
                        
EmpLost(giveplayerid);
                        
SBan(giveplayeridresultsendername);
                        return 
1;
                    }
                }
            }
            else
            {
                
SendClientMessage(playeridCOLOR_GRAD1"Esse nгo й um jogador ativo.");
            }
        }
        return 
1;
    } 
Reply
#3

Manda o SBan.
Reply
#4

PHP Code:
public SBan(playeridstring[], string2[]) {
        new 
arquivo[64], tmp[20], tmp2[20], ip[16];
        
GetPlayerIp(playeridipsizeof ip);
        
format(arquivosizeof(arquivo), "Banned/%s.ini"PlayerName(playerid));
        
getdate(AnoMesDia);
        
format(tmp20"%d/%d/%d"DiaMesAno);
        
gettime(HoraMinutoSegundo);
        
format(tmp220"%d:%d:%d"HoraMinutoSegundo);
        
format(gstring128"[%d/%d/%d] [%d:%d:%d] %s IP:%s foi banido pelo admin %s, motivo: %s"v[2], v[1], v[0], v[3], v[4], v[5], PlayerName(playerid), ipstring2string);
        
SBanLog(gstring);
        if (
DOF2_FileExists(arquivo)) {
            
Kick(playerid);
        } else {
            
DOF2_CreateFile(arquivo);
            
DOF2_SetString(arquivo"Motivo"string);
            
DOF2_SetString(arquivo"Admin"string2);
            
DOF2_SetString(arquivo"Data"tmp);
            
DOF2_SetString(arquivo"Hora"tmp2);
            
DOF2_SaveFile();
            
Ban(playerid);
        }
        return 
true;
    } 
Vocкs acham que pode dar problema, eu colocar um valor sempre alto nas variбveis? Para nгo dar esses problemas...
Reply
#5

#UP alguйm saberia ajudar?
Reply
#6

Caro amigo, no caso estб sendo acessado um index da matriz o qual nгo й existente, no momento estou sem meu computador e estou saindo para o almoзo, quando eu voltar do almoзo irei verificar esta causa,
Reply
#7

Cidiei obrigado, eu sei que estou acessando 155 onde so tem 23 mas nгo encontro, estб na public SBan
Sу que tenho que descobrir a onde, atualmente minha public estб assim:

PHP Code:
public SBan(playeridstring[], string2[MAX_PLAYER_NAME]) {
        new 
arquivo[64], tmp[20], tmp2[20], ip[16], stri[64];
        
GetPlayerIp(playeridipsizeof ip);
        
GetPlayerName(playeridstring2sizeof string2);
        
format(arquivosizeof(arquivo), "Banned/%s.ini"PlayerName(playerid));
        
getdate(AnoMesDia);
        
format(tmp20"%d/%d/%d"DiaMesAno);
        
gettime(HoraMinutoSegundo);
        
format(tmp220"%d:%d:%d"HoraMinutoSegundo);
        
format(gstring128"[%d/%d/%d] [%d:%d:%d] %s IP:%s foi banido pelo admin %s, motivo: %s"v[2], v[1], v[0], v[3], v[4], v[5], PlayerName(playerid), ipstring2string);
        
SBanLog(gstring);
        if (
DOF2_FileExists(arquivo)) {
            
Kick(playerid);
        } else {
        
DOF2_CreateFile(arquivo);
        
DOF2_SetString(arquivo,"Motivo",string);
        
DOF2_SetString(arquivo,"Admin",string2);
        
DOF2_SetString(arquivo,"Data",tmp);
        
DOF2_SetString(arquivo,"Hora",tmp2);
        
DOF2_SetString(arquivo,"IP",ip);

        
format(strisizeof(stri), "IPsBanidos/%s.ini",ip);
        
DOF2_CreateFile(stri);
        
DOF2_SetString(stri,"Motivo",string);
        
DOF2_SetString(stri,"Admin",string2);
        
DOF2_SetString(stri,"Data",tmp);
        
DOF2_SetString(stri,"Hora",tmp2);
        
DOF2_SetString(stri,"Nick",PlayerName(playerid));
        
DOF2_SetString(arquivo,"IP",ip);
        
Kick(playerid);

        }
        return 
true;
    } 
Reply
#8

#UP, alguйm?
Reply
#9

Quote:
Originally Posted by Sennior
View Post
A linha 36555 й essa aqui:

PHP Code:
SBan(giveplayeridresultPlayerName(playerid)); 
Nгo encontrei essa linha em nenhum dos cуdigos que vocк postou
Reply
#10

Aqui Nixtren, no /ban que postei ali em cima ^^

PHP Code:
if(strcmp(cmd"/ban"true) == 0)
    {
        if(
IsPlayerConnected(playerid))
        {
            
tmp strtok(cmdtextidx);
            if(!
strlen(tmp))
            {
                
SendClientMessage(playeridCOLOR_GRAD2"USE: /ban [ id ] [razгo]");
                return 
1;
            }
            
giveplayerid ReturnUser(tmp);
            if(
PlayerInfo[playerid][pAdmin] >= 3)
            {
                if(
admtrampando[playerid] < && PlayerInfo[playerid][pAdmin] != 1340 && PlayerInfo[playerid][pAdmin] != 1341 && PlayerInfo[playerid][pAdmin] != 1342)
                {
                    
SendClientMessage(playeridCOLOR_GRAD1"Vocк nгo estб trabalhando! (/trabalhar)");
                    return 
1;
                }
                if(
IsPlayerConnected(giveplayerid))
                {
                    if(
giveplayerid != INVALID_PLAYER_ID)
                    {
                        if(
PlayerInfo[giveplayerid][pAdmin] >= && PlayerInfo[playerid][pAdmin] != 1342)
                        {
                            if(
giveplayerid != playerid)
                            {
                                 
format(stringsizeof(string), "ID [%d] Nгo estб Online."giveplayerid);
                                 
SendClientMessage(playeridCOLOR_GRAD1string);
                                 return 
1;
                            }
                        }
                        
GetPlayerName(giveplayeridgiveplayersizeof(giveplayer));
                        
GetPlayerName(playeridsendernamesizeof(sendername));
                        new 
length strlen(cmdtext);
                        while ((
idx length) && (cmdtext[idx] <= ' '))
                        {
                            
idx++;
                        }
                        new 
offset idx;
                        new 
result[64];
                        while ((
idx length) && ((idx offset) < (sizeof(result) - 1)))
                        {
                            
result[idx offset] = cmdtext[idx];
                            
idx++;
                        }
                        
result[idx offset] = EOS;
                        if(!
strlen(result))
                        {
                            
SendClientMessage(playeridCOLOR_GRAD2"USE: /banir [ id ] [motivo]");
                            return 
1;
                        }
                        
getdate(yearmonthday);
                        
pban[playerid] += 1;
                        if(
pban[playerid] >= && PlayerInfo[playerid][pAdmin] != 1341 && PlayerInfo[playerid][pAdmin] != 1342)
                        {
                             
SBan(playerid"Baniu mais de 3""Automatico");
                             return 
1;
                        }
                        
format(stringsizeof(string), "ADMIN CMD: %s foi banido por %s, Motivo: %s (%d-%d-%d)"giveplayersendername, (result),day,month,year);
                        
BanLog(string);
                        
format(stringsizeof(string), "ADMIN CMD: %s foi banido por %s, Motivo: %s"giveplayersendername, (result));
                        
SendClientMessageToAll(COLOR_LIGHTREDstring);
                        
SendClientMessage(giveplayeridCOLOR_YELLOW"|________________Instruзхes para Revisгo de Ban________________|");
                        
SendClientMessage(giveplayeridCOR_AL"Tire uma SS da tela apertando F8 imediatamente apуs ser banido");
                        
SendClientMessage(giveplayeridCOR_AL"E acesse o nosso forum: maniagamer.forum-pro.net");
                        
SendClientMessage(giveplayeridCOLOR_LIGHTRED"Atenзгo: Vocк sу serб desbanido se for inocente !");
                        
GameTextForPlayer(giveplayerid,"~r~banido"25003);
                        
PlayerInfo[giveplayerid][pBan] = 1;
                           
CarroLost(giveplayerid);
                        
House2Lost(giveplayerid);
                        
EmpLost(giveplayerid);
                        
SBan(giveplayeridresultsendername); //ESSA LINHA AQUI
                        
return 1;
                    }
                }
//not connected
            
}
            else
            {
                
SendClientMessage(playeridCOLOR_GRAD1"Esse nгo й um jogador ativo.");
            }
        }
        return 
1;
    } 
Coloquei um comentбrio! "//ESSA LINHA AQUI"

Eu troquei po sendername
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)