SA-MP Forums

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

Reply
 
Thread Tools Display Modes
Old 20/04/2020, 01:11 AM   #1
Poseidon4625
Huge Clucker
 
Poseidon4625's Avatar
 
Join Date: Mar 2017
Location: São Paulo - SP
Posts: 221
Reputation: 8
Default Bug OnPlayerStateChange

Pessoal estou tendo problema na callback, alguém sabe oque pode ser?

PHP Code:
[02:21:28] [debugRun time error 4"Array index out of bounds"
[02:21:28] [debug]  Attempted to read/write array element at index 121 in array of size 121
[02:21:28] [debugAMX backtrace:
[
02:21:28] [debug#0 0003f840 in public OnPlayerStateChange (0, 2, 1) in Servidor.amx
[02:21:30] [debugRun time error 4"Array index out of bounds"
[02:21:30] [debug]  Attempted to read/write array element at index 121 in array of size 121
[02:21:30] [debugAMX backtrace:
[
02:21:30] [debug#0 0003f840 in public OnPlayerStateChange (1, 2, 1) in Servidor.amx
[02:24:48] [debugRun time error 4"Array index out of bounds"
[02:24:48] [debug]  Attempted to read/write array element at index 121 in array of size 121
[02:24:48] [debugAMX backtrace:
[
02:24:48] [debug#0 0003f840 in public OnPlayerStateChange (0, 2, 1) in Servidor.amx
[02:25:13] [debugRun time error 4"Array index out of bounds"
[02:25:13] [debug]  Attempted to read/write array element at index 121 in array of size 121
[02:25:13] [debugAMX backtrace:
[
02:25:13] [debug#0 0003f840 in public OnPlayerStateChange (1, 2, 1) in Servidor.amx 



se alguém souber oque é, agradeço.


PHP Code:
public OnPlayerStateChange(playeridnewstateoldstate)
{
    new 
Float:posicao[3];
    new 
modelo GetVehicleModel(GetPlayerVehicleID(playerid));
    if(
oldstate == PLAYER_STATE_ONFOOT && newstate == PLAYER_STATE_DRIVER)
    {
        
GetVehiclePos(GetPlayerVehicleID(playerid), v@_P[0][playerid], v@_P[1][playerid], v@_P[2][playerid]);
        
TSTimer[playerid] = SetTimerEx("E@_At"2000true"i"playerid);
    }
     if(
newstate == PLAYER_STATE_DRIVER)
    {
        if(
GetPlayerVehicleID(playerid) >= vehiclesI[0] && GetPlayerVehicleID(playerid) <= vehiclesI[sizeof(vehiclesI) - 1])
        {
            if(
PlayerInfo[playerid][pTransProf] != 1)return Ret(playerid);
        }
        if(
GetPlayerVehicleID(playerid) >= Motoboys[0] && GetPlayerVehicleID(playerid) <= Motoboys[sizeof(Motoboys) - 1])
        {
            if(
PlayerInfo[playerid][pProfissao] != 1)return Ret(playerid);
        }
        if(
GetPlayerVehicleID(playerid) >= EntregadorJ[0] && GetPlayerVehicleID(playerid) <= EntregadorJ[sizeof(EntregadorJ) - 1])
        {
            if(
PlayerInfo[playerid][pProfissao] != 2)return Ret(playerid);
        }
        if(
GetPlayerVehicleID(playerid) >= EntregadorC[0] && GetPlayerVehicleID(playerid) <= EntregadorC[sizeof(EntregadorC) - 1])
        {
            if(
PlayerInfo[playerid][pProfissao] != 3)return Ret(playerid);
        }
        if(
barcos(GetPlayerVehicleID(playerid)) ||avioes(GetPlayerVehicleID(playerid)) ||Motocicletas(GetPlayerVehicleID(playerid)) || carros(GetPlayerVehicleID(playerid)) || VeiculoDiesel(GetPlayerVehicleID(playerid)))
        {
            
SendClientMessage(playerid,Amarelo,"| INFO | Para Ligar ou Desligar o Veículo Aperte 'Y'!");
            
ShowPlayerVelocimetro(playerid);
        }
    }else{
        
HidePlayerVelocimetro(playerid);
    }
    if(
oldstate == PLAYER_STATE_DRIVER)
    {
        new 
string[95];
        
GetVehicleParamsEx(GetPlayerVehicleID(playerid),engine,lights,alarm,doors,bonnet,boot,objective);
        if(
barcos(GetPlayerVehicleID(playerid)) ||avioes(GetPlayerVehicleID(playerid)) ||Motocicletas(GetPlayerVehicleID(playerid)) || carros(GetPlayerVehicleID(playerid)) || VeiculoDiesel(GetPlayerVehicleID(playerid)))
        {
            
SetVehicleParamsEx(GetPlayerVehicleID(playerid), VEHICLE_PARAMS_OFFlightsalarmdoorsbonnetbootobjective);
        }
        if(
NewGlobal[playerid] == 500)
        {
            if(
VeiculoDiesel(GetPlayerVehicleID(playerid)) || barcos(GetPlayerVehicleID(playerid)))
            {
                
format(stringsizeof (string),"| INFO | Você Abasteceu Alguns Litros de {FFF000}Diesel {FFFFFF}e Pagou {008000}$%d",GranaB[playerid]);
                
SendClientMessage(playerid, -1,string);
                
perexc(playerid);
            }
            if(
Motocicletas(GetPlayerVehicleID(playerid)) || carros(GetPlayerVehicleID(playerid)))
            {
                
format(stringsizeof (string),"| INFO | Você Abasteceu Alguns Litros de {FFF000}Gasolina {FFFFFF}e Pagou {008000}$%d",GranaB[playerid]);
                
SendClientMessage(playerid, -1,string);
                
perexc(playerid);
            }
            if(
avioes(GetPlayerVehicleID(playerid)))
            {
                
format(stringsizeof (string),"| INFO | Você Abasteceu Alguns Litros de {FFF000}QAV/1 {FFFFFF}e Pagou {008000}$%d",GranaB[playerid]);
                
SendClientMessage(playerid, -1,string);
                
perexc(playerid);
            }
        }
        if(
pegvehicle[playerid] == true)
        {
            
SendClientMessage(playerid,Amarelo,"| AVISO | Você Tem 90 Segundos Para Voltar ao Veículo da Profissão!");
            
TempProf[playerid] = SetTimerEx("CancelamentoProf"90000false"i"playerid);
            
Timer[6][playerid] = SetTimerEx("temps"1000true"i"playerid);
            
SetPVarInt(playerid,"SaiuVehicle",90);
        }
    }
    if(
newstate == PLAYER_STATE_DRIVER)
    {
        if(
modelo == 430 )
        {
            if(
PlayerInfo[playerid][pHELG] == false)
            {
                
SendClientMessage(playeridVermelho"| ERRO | Você Não Tem Habilitação Especial 'HELG'!");
                
GetPlayerPos(playerid,posicao[0],posicao[1],posicao[2]);
                
SetPlayerPos(playerid,posicao[0],posicao[1],posicao[2]+1);
               }
        }
        if(
modelo == 476 || modelo == 520 || modelo == 425 || modelo == 548 || modelo == 447 )
        {
            if(
PlayerInfo[playerid][pHEAG] == false)
            {
                
SendClientMessage(playeridVermelho"| ERRO | Você Não Tem Habilitação Especial 'HEAG'!");
                
GetPlayerPos(playerid,posicao[0],posicao[1],posicao[2]);
                
SetPlayerPos(playerid,posicao[0],posicao[1],posicao[2]+1);
               }
        }
        if(
modelo == 432 || modelo == 433 || modelo == 470 )
        {
            if(
PlayerInfo[playerid][pHEVG] == false)
            {
                
SendClientMessage(playeridVermelho"| ERRO | Você Não Tem Habilitação Especial 'HEVG'!");
                
GetPlayerPos(playerid,posicao[0],posicao[1],posicao[2]);
                
SetPlayerPos(playerid,posicao[0],posicao[1],posicao[2]+1);
               }
        }
        if(
GetPVarInt(playerid,"TestO")>= 1)
        {
        }else{
            if(
modelo == 448 || modelo == 461 || modelo == 462 || modelo == 463 || modelo == 468 || modelo == 471 || modelo == 521 || modelo == 581 || modelo == 586)
            {
                 if(
PlayerInfo[playerid][pMotos] == false)
                {
                    
SendClientMessage(playeridVermelho"| ERRO | Você Não Tem Habilitação Para Conduzir Motos!");
                    
GetPlayerPos(playerid,posicao[0],posicao[1],posicao[2]);
                    
SetPlayerPos(playerid,posicao[0],posicao[1],posicao[2]+1);
                }
            }
            if(
modelo == 403 || modelo == 406 || modelo == 443 || modelo == 514 || modelo == 515)
            {
                 if(
PlayerInfo[playerid][pCarretas] == false)
                {
                    
SendClientMessage(playeridVermelho"| ERRO | Você Não Tem Habilitação Para Conduzir Carretas!");
                    
GetPlayerPos(playerid,posicao[0],posicao[1],posicao[2]);
                    
SetPlayerPos(playerid,posicao[0],posicao[1],posicao[2]+1);
                }
            }
            if(
modelo == 446 || modelo == 452 || modelo == 453 || modelo == 454 || modelo == 472 || modelo == 473 || modelo == 484 || modelo == 493 || modelo == 595)
            {
                 if(
PlayerInfo[playerid][pBarcos] == false)
                {
                    
SendClientMessage(playeridVermelho"| ERRO | Você Não Tem Habilitação Para Conduzir Barcos!");
                    
GetPlayerPos(playerid,posicao[0],posicao[1],posicao[2]);
                    
SetPlayerPos(playerid,posicao[0],posicao[1],posicao[2]+1);
                }
            }
            if(
modelo == 460 || modelo == 511 || modelo == 512 || modelo == 513 || modelo == 519 || modelo == 553 || modelo == 577 || modelo == 592 || modelo == 593)
            {
                 if(
PlayerInfo[playerid][pAvioes] == false)
                {
                    
SendClientMessage(playeridVermelho"| ERRO | Você Não Tem Habilitação Para Conduzir Aviões!");
                    
GetPlayerPos(playerid,posicao[0],posicao[1],posicao[2]);
                    
SetPlayerPos(playerid,posicao[0],posicao[1],posicao[2]+1);
                }
            }
            if(
modelo == 417 || modelo == 447 || modelo == 469 || modelo == 487 || modelo == 488 || modelo == 497 || modelo == 548 || modelo == 563)
            {
                 if(
PlayerInfo[playerid][pHelicopteros] == false)
                {
                    
SendClientMessage(playeridVermelho"| ERRO | Você Não Tem Habilitação Para Conduzir Helicópteros!");
                    
GetPlayerPos(playerid,posicao[0],posicao[1],posicao[2]);
                    
SetPlayerPos(playerid,posicao[0],posicao[1],posicao[2]+1);
                }
            }
            if(
modelo == 431 || modelo == 437)
            {
                 if(
PlayerInfo[playerid][pOnibus] == false)
                {
                    
SendClientMessage(playeridVermelho"| ERRO | Você Não Tem Habilitação Para Conduzir Ônibus!");
                    
GetPlayerPos(playerid,posicao[0],posicao[1],posicao[2]);
                    
SetPlayerPos(playerid,posicao[0],posicao[1],posicao[2]+1);
                }
            }
            if(
modelo == 407 || modelo == 428 || modelo == 427 || modelo == 455 || modelo == 456 || modelo == 443 || modelo == 408 || modelo == 424 || modelo == 478 || modelo == 609
            
|| modelo == 406 || modelo == 407 || modelo == 544 || modelo == 573 || modelo == 578 || modelo == 424 || modelo == 544)
            {
                 if(
PlayerInfo[playerid][pCaminhoes] == false)
                {
                    
SendClientMessage(playeridVermelho"| ERRO | Você Não Tem Habilitação Para Conduzir Caminhões!");
                    
GetPlayerPos(playerid,posicao[0],posicao[1],posicao[2]);
                    
SetPlayerPos(playerid,posicao[0],posicao[1],posicao[2]+1);
                }
            }
            for(new 
0122i++)
            {
                if(
modelo == VehiclesCarros[i])
                {
                    if(
PlayerInfo[playerid][pCarros] == false)
                    {
                        
SendClientMessage(playeridVermelho"| ERRO | Você Não Tem Habilitação Para Conduzir Carros!");
                        
GetPlayerPos(playerid,posicao[0],posicao[1],posicao[2]);
                        
SetPlayerPos(playerid,posicao[0],posicao[1],posicao[2]+1);
                    }
                }
            }
            if((
GetTickCount() - GetPVarInt(playerid"cartime")) < 100)
            {
                
SetPVarInt(playerid"carspam"GetPVarInt(playerid"carspam") + 1);
                if(
GetPVarInt(playerid"carspam") >= 5)
                {
                    new 
cs_string[85 MAX_PLAYER_NAME],namePlayerState[MAX_PLAYER_NAME];
                    
GetPlayerName(playeridnamePlayerStatesizeof(namePlayerState));
                    
format(cs_string,sizeof(cs_string),"| INFO | O(A) Jogador(a) %s Foi Kickado(a) Pelo Anti-Cheater ( Motivo: Car Spam. )",namePlayerState);
                    
SendClientMessageToAll(Vermelho,cs_string);
                    return 
SavePlayer(playerid), Kick(playerid);
                }
            }
            
SetPVarInt(playerid"cartime"GetTickCount());
        }
    }
    return 
1;

Poseidon4625 is offline   Reply With Quote
Old 20/04/2020, 03:49 PM   #2
Poseidon4625
Huge Clucker
 
Poseidon4625's Avatar
 
Join Date: Mar 2017
Location: São Paulo - SP
Posts: 221
Reputation: 8
Default Re: Bug OnPlayerStateChange

alguém?
Poseidon4625 is offline   Reply With Quote
Old 20/04/2020, 03:53 PM   #3
RiqueP
Gangsta
 
RiqueP's Avatar
 
Join Date: Jan 2014
Location: 01010011 01010000
Posts: 875
Reputation: 66
Default Re: Bug OnPlayerStateChange

Normalmente esse erro é apontado quando você tenta acessar um valor de uma array maior do que o limite dela. Exemplo:
PHP Code:
new matriz[10];
matriz[12] = 1
RiqueP is offline   Reply With Quote
Old 20/04/2020, 06:24 PM   #4
Poseidon4625
Huge Clucker
 
Poseidon4625's Avatar
 
Join Date: Mar 2017
Location: São Paulo - SP
Posts: 221
Reputation: 8
Default Re: Bug OnPlayerStateChange

Quote:
Originally Posted by RiqueP View Post
Normalmente esse erro é apontado quando você tenta acessar um valor de uma array maior do que o limite dela. Exemplo:
PHP Code:
new matriz[10];
matriz[12] = 1
Entendi, obrigado.
Poseidon4625 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
OnPlayerStateChange kesarthakur Scripting Help 2 25/12/2014 03:02 PM
[HELP]OnPlayerStateChange[HELP] Justinclaveria123 Scripting Help 2 07/11/2014 05:23 PM
onplayerstatechange xyzcod2 Scripting Help 7 15/12/2013 10:07 AM
OnPlayerStateChange [JnA]DukeNukem Help Archive 5 09/08/2011 08:48 PM


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


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