SA-MP Forums

Go Back   SA-MP Forums > Non-English > Languages > Português/Portuguese

Reply
 
Thread Tools Display Modes
Old 15/11/2015, 10:03 PM   #1
Sennior
Huge Clucker
 
Sennior's Avatar
 
Join Date: Jun 2015
Posts: 340
Reputation: 3
Default Rum timer error

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!
__________________
Brasil Play Vicio
HostName: Brasil Play Vício
Address: bpv.brasilplayvicio.com
Players: x / 100
Ping: 130
Mode: Brasil RPG v3.0
Language: Português

Fórum: www.brasilplayvicio.com.br
Sennior is offline   Reply With Quote
Old 16/11/2015, 10:55 AM   #2
Sennior
Huge Clucker
 
Sennior's Avatar
 
Join Date: Jun 2015
Posts: 340
Reputation: 3
Default Re: Rum timer error

É 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;
    } 
__________________
Brasil Play Vicio
HostName: Brasil Play Vício
Address: bpv.brasilplayvicio.com
Players: x / 100
Ping: 130
Mode: Brasil RPG v3.0
Language: Português

Fórum: www.brasilplayvicio.com.br
Sennior is offline   Reply With Quote
Old 16/11/2015, 12:49 PM   #3
Galhardo
Huge Clucker
 
Galhardo's Avatar
 
Join Date: Dec 2012
Posts: 244
Reputation: 18
Default Re: Rum timer error

Manda o SBan.
Galhardo is offline   Reply With Quote
Old 16/11/2015, 12:58 PM   #4
Sennior
Huge Clucker
 
Sennior's Avatar
 
Join Date: Jun 2015
Posts: 340
Reputation: 3
Default Re: Rum timer error

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...
__________________
Brasil Play Vicio
HostName: Brasil Play Vício
Address: bpv.brasilplayvicio.com
Players: x / 100
Ping: 130
Mode: Brasil RPG v3.0
Language: Português

Fórum: www.brasilplayvicio.com.br
Sennior is offline   Reply With Quote
Old 20/11/2015, 10:48 AM   #5
Sennior
Huge Clucker
 
Sennior's Avatar
 
Join Date: Jun 2015
Posts: 340
Reputation: 3
Default Re: Rum timer error

#UP alguém saberia ajudar?
__________________
Brasil Play Vicio
HostName: Brasil Play Vício
Address: bpv.brasilplayvicio.com
Players: x / 100
Ping: 130
Mode: Brasil RPG v3.0
Language: Português

Fórum: www.brasilplayvicio.com.br
Sennior is offline   Reply With Quote
Old 20/11/2015, 12:53 PM   #6
Cidiei
Gangsta
 
Cidiei's Avatar
 
Join Date: Oct 2012
Location: Cascavel/PR
Posts: 668
Reputation: 39
Default Re: Rum timer error

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,
Cidiei is offline   Reply With Quote
Old 20/11/2015, 01:02 PM   #7
Sennior
Huge Clucker
 
Sennior's Avatar
 
Join Date: Jun 2015
Posts: 340
Reputation: 3
Default Re: Rum timer error

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;
    } 
__________________
Brasil Play Vicio
HostName: Brasil Play Vício
Address: bpv.brasilplayvicio.com
Players: x / 100
Ping: 130
Mode: Brasil RPG v3.0
Language: Português

Fórum: www.brasilplayvicio.com.br
Sennior is offline   Reply With Quote
Old 21/11/2015, 01:50 AM   #8
Sennior
Huge Clucker
 
Sennior's Avatar
 
Join Date: Jun 2015
Posts: 340
Reputation: 3
Default Re: Rum timer error

#UP, alguém?
__________________
Brasil Play Vicio
HostName: Brasil Play Vício
Address: bpv.brasilplayvicio.com
Players: x / 100
Ping: 130
Mode: Brasil RPG v3.0
Language: Português

Fórum: www.brasilplayvicio.com.br
Sennior is offline   Reply With Quote
Old 21/11/2015, 12:44 PM   #9
Nixtren
Huge Clucker
 
Nixtren's Avatar
 
Join Date: Jul 2015
Posts: 328
Reputation: 47
Default Re: Rum timer error

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
__________________

Software Engineering Lover | White-Hat Hacker | PHP Programmer
Check out my MTA to SA-MP Map Converter (converts Remove World Object too!)
Nixtren is offline   Reply With Quote
Old 21/11/2015, 02:28 PM   #10
Sennior
Huge Clucker
 
Sennior's Avatar
 
Join Date: Jun 2015
Posts: 340
Reputation: 3
Default Re: Rum timer error

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
__________________
Brasil Play Vicio
HostName: Brasil Play Vício
Address: bpv.brasilplayvicio.com
Players: x / 100
Ping: 130
Mode: Brasil RPG v3.0
Language: Português

Fórum: www.brasilplayvicio.com.br
Sennior is offline   Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
[Ajuda] Rum timer error Sennior Português/Portuguese 9 11/09/2015 11:57 PM
Timer Error Please Help FisherMan Scripting Help 2 15/09/2014 12:26 PM
timer bug? or error? xXGangstaXx Scripting Help 2 30/08/2014 10:19 PM
Timer Error [SOB]Chris Help Archive 6 19/07/2009 07:46 PM
Error on timer [SOB]Chris Help Archive 1 19/07/2009 12:07 AM


All times are GMT. The time now is 09:55 AM.


Powered by vBulletin® Version 3.8.6
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.