SA-MP Forums Archive
amx backtrace here - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: amx backtrace here (/showthread.php?tid=650238)



amx backtrace here - PepsiCola23 - 23.02.2018

why do i get amx backtrace here?i got no big strings or stuff...

i wasnt getting errors before i added this

PHP Code:
    if(PWarehouseCP[playerid] >= && PlayerData[playerid][Job] == 2)
    {
        if(
PWarehouseCP[playerid] == 2)
        {
            
PWarehouseCP[playerid] = 10;
            new 
randn random(sizeof(WarehouseInteriorCP));
            
SetPlayerCheckpoint(playeridWarehouseExteriorCP[randn][0], WarehouseExteriorCP[randn][1], WarehouseExteriorCP[randn][2], 1.0);
            
SetDestination(playeridWarehouseExteriorCP[randn][0], WarehouseExteriorCP[randn][1], WarehouseExteriorCP[randn][2]);
            return 
1;
        }
        if(
PWarehouseCP[playerid] == 10)
        {   
            
PWarehouseCurrent[playerid] ++;
            
PWarehouseCP[playerid] = 2;
            new 
randn random(sizeof(WarehouseExteriorCP));
            
SetPlayerCheckpoint(playeridWarehouseInteriorCP[randn][0], WarehouseInteriorCP[randn][1], WarehouseInteriorCP[randn][2], 1.0);
            
SetDestination(playeridWarehouseInteriorCP[randn][0], WarehouseInteriorCP[randn][1], WarehouseInteriorCP[randn][2]);
            return 
1;
        }
        if(
PWarehouseCurrent[playerid] == 10)
        {
            
SendClientMessage(playeridCOLOR_WHITE"test");
            
PWarehouseCP[playerid] = 0;
            
PWarehouseCurrent[playerid] = 0;
            
IsWorking[playerid] = 0;
            return 
1;
        }
        return 
1;
    } 
log:
PHP Code:
[00:45:26] [debugRun time error 4"Array index out of bounds"
[00:45:26] [debug]  Accessing element at index 30 past array upper bound 10
[00:45:26] [debugAMX backtrace:
[
00:45:26] [debug#0 0007da68 in ?? (0) from serverteste.amx
[00:45:26] [debug#1 00008504 in public OnPlayerEnterCheckpoint (0) from serverteste.amx 
PHP Code:
PWarehouseCurrent[MAX_PLAYERS]; 
PHP Code:
PWarehouseCP[MAX_PLAYERS]; 



Re: amx backtrace here - kingmk - 23.02.2018

Replace this
Code:
new randn = random(sizeof(WarehouseExteriorCP));
Whit this.
Code:
new randn = random(sizeof(WarehouseInteriorCP));
Hope i helped u.


Re: amx backtrace here - PepsiCola23 - 23.02.2018

Quote:
Originally Posted by kingmk
View Post
Replace this
Code:
new randn = random(sizeof(WarehouseExteriorCP));
Whit this.
Code:
new randn = random(sizeof(WarehouseInteriorCP));
Hope i helped u.
thanks buddy ! +repped