Hello, i some problem with error 4
#1

[debug] Run time error 4: "Array index out of bounds"
[debug] AMX backtrace:
[debug] #0 001dd5a4 in public WC_OnPlayerPickUpPickup (0, 4 from SAIW.amx
[debug] #1 0000a280 in public OnPlayerPickUpPickup (0, 4 from SAIW.amx
any one know how to fix it?
tell if need to share the lines.
Reply
#2

show the line
Reply
#3

Quote:
Originally Posted by AzaMx
Посмотреть сообщение
show the line
i cant found this line, using mw3 script.
any idea?
Public OnPlayerPickUpPickup (0, 48 )"
Reply
#4

You're trying to access an array with an invalid index.

Example:

PHP код:
new playerKills[MAX_PLAYERS];
// And somewhere in on player death
playerKills[killerid]++; 
In this code, killerid could be INVALID_PLAYER_ID which exceed the MAX_PLAYERS therefor you get the invalid index error.

Share your code so we can help you.
Reply
#5

Quote:
Originally Posted by Danielknow
Посмотреть сообщение
i cant found this line, using mw3 script.
any idea?
Public OnPlayerPickUpPickup (0, 48 )"
Just copy the full OnPlayerPickUpPickup callback.
Reply
#6

Quote:
Originally Posted by Danielknow
Посмотреть сообщение
i cant found this line, using mw3 script.
any idea?
Public OnPlayerPickUpPickup (0, 48 )"
If you had this code in a repo I could fix it for you, but I assume you don't.

You should know which line it is in the debug lines but if you can't find it, search for "OnPlayerPickUpPickup" in you gamemode.
Reply
#7

Quote:
Originally Posted by AzaMx
Посмотреть сообщение
show the line
Quote:
Originally Posted by KinderClans
Посмотреть сообщение
Just copy the full OnPlayerPickUpPickup callback.
Quote:
Originally Posted by AmirSavand
Посмотреть сообщение
If you had this code in a repo I could fix it for you, but I assume you don't.

You should know which line it is in the debug lines but if you can't find it, search for "OnPlayerPickUpPickup" in you gamemode.
https://github.com/DanielKnow/Error-...%204%20problem
Reply
#8

Quote:
Originally Posted by Danielknow
Посмотреть сообщение
Wow, did you just make an entire repo for a simple error?

Show more from the server log. The code is pretty big.

There's lots of arrays, where's the rest of the log and line number?

Код:
[debug] Run time error 4: "Array index out of bounds"
[debug] AMX backtrace:
[debug] #0 001dd5a4 in public WC_OnPlayerPickUpPickup (0, 4 from SAIW.amx
[debug] #1 0000a280 in public OnPlayerPickUpPickup (0, 4 from SAIW.amx
Reply
#9

Compile the script with -d3 flag and run the server (https://github.com/Zeex/samp-plugin-...ith-debug-info), you will be able to find the specific line caused this run time error and will also help for future run time errors.

Looking at the code, this is a part that could cause it if "gt" is out of bounds: https://github.com/DanielKnow/Error-...blem#L202-L204
Reply
#10

Quote:
Originally Posted by Calisthenics
Посмотреть сообщение
Compile the script with -d3 flag and run the server (https://github.com/Zeex/samp-plugin-...ith-debug-info), you will be able to find the specific line caused this run time error and will also help for future run time errors.

Looking at the code, this is a part that could cause it if "gt" is out of bounds: https://github.com/DanielKnow/Error-...blem#L202-L204
PHP код:
        new cat[250], gt gTeam[playerid];
        
strcat(cat"{FFFFFF}Remote AirStrike  Control System (RACS){FF0000}\t{FFFFFF}Cost :{45FF00} 50XP\n{FFFFFF}Base Defence (");
        new 
CMDBaseDeftic CMDBaseDeftick[gt]; 
Could be but it's wasting time unless he finds out the exact line of error.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)