Quantcast
Channel: SA-MP Forums
Viewing all articles
Browse latest Browse all 18226

Run time error 4: "Array index out of bounds"

$
0
0
Hi,

I'm having a problem with this command and I've done everything I could to try and troubleshoot it. I don't understand what's causing this error but, this IS the error:
Code:

[09:05:23] [debug] Run time error 4: "Array index out of bounds"
[09:05:23] [debug]  Attempted to read/write array element at index 65535 in array of size 1000
[09:05:23] [debug] AMX backtrace:
[09:05:23] [debug] #0 00057d60 in public cmd_pickup (playerid=0, params[]=@015c5ed8 "") at newScript.pwn:5212
[09:05:23] [debug] #1 native CallLocalFunction () from sampsvr-port_9886
[09:05:23] [debug] #2 00000968 in public OnPlayerCommandText (playerid=0, cmdtext[]=@015c5eb8 "/pickup")

The command is:
PHP Code:

CMD:pickup(playeridparams[])
{
    new 
playerb PlayerData[playerid][pPhoneline];
    if(!
pLoggedIn[playerid])return true;
    
    if (
PlayerData[playerid][pPhoneline] != INVALID_PLAYER_ID)return SendClientMessage(playeridCOLOR_ADM".. You're on a call already. Use /hangup");
    if (
PlayerData[playerid][pPhoneOff])return SendClientMessage(playeridCOLOR_ADM".. Your cellphone is turned off right now.");
    if (
PlayerData[playerid][pHandcuff])return SendClientMessage(playeridCOLOR_ADM".. You can't do this right now.");


    
PlayerData[playerb][pCalling] = 0;   - LINE 5212
    PlayerData
[playerid][pCalling] = 0;
    return 
true;
}

enum PLAYER_DATA{
    
pPhoneline,
    
pCalling,
    
pPhoneOff
}

OnPlayerConnect(playerid)
{
           
PlayerData[playerid][pCalling] = 0;
    
PlayerData[playerid][pPhoneline] = INVALID_PLAYER_ID;
    
PlayerData[playerid][pPhoneOff] = 0


This shows during the compile:
Code:

Header size:          13044 bytes
Code size:          641320 bytes
Data size:        22830776 bytes
Stack/heap size:      16384 bytes; estimated max. usage: unknown, due to recursion
Total requirements:23501524 bytes


Viewing all articles
Browse latest Browse all 18226

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>