SA-MP Forums Archive
error LOG - 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: error LOG (/showthread.php?tid=500302)



error LOG - norton2 - 12.03.2014

How can I fix this error?
They receive LOG ...

Код HTML:
07:09:14] [debug] Run time error 4: "Array index out of bounds"
[07:09:14] [debug]  Accessing element at negative index -1
[07:09:14] [debug] AMX backtrace:
[07:09:14] [debug] #0 00024824 in public Streamer_OnPlayerDisconnect () from mode.amx
[07:09:14] [debug] #1 native CallLocalFunction () [00472ad0] from samp-server.exe
[07:09:14] [debug] #2 0000d83c in public Itter_OnPlayerDisconnect () from mode.amx
[07:09:14] [debug] #3 native CallLocalFunction () [00472ad0] from samp-server.exe
[07:09:14] [debug] #4 0000ba64 in ?? () from mode.amx
[07:09:14] [debug] #5 00005410 in public OnPlayerDisconnect () from mode.amx
[07:09:14] [part] CaRa has left the server (0:1)



Re: error LOG - norton2 - 12.03.2014

Please helpp


Re: error LOG - CuervO - 12.03.2014

By the looks of the error itself: "Accessing element at negative index -1" you're using an array with a negative index at OnPlayerDisconnect:

array[-1] = x;


Re: error LOG - Clad - 12.03.2014

PHP код:
new array[ MAX_PLAYERS ];
array[ 
65536 ] = Edit



Re: error LOG - CuervO - 12.03.2014

Quote:
Originally Posted by Clad
Посмотреть сообщение
PHP код:
new array[ MAX_PLAYERS ];
array[ 
65536 ] = Edit
What does that have anything to do with his error at all? Infact that would fail, MAX_PLAYERS is 500 by default, 65535 is the definition value for INVALID_PLAYER_ID. If you were trying to explain him his error this still would be wrong, the message clearly says the index used is -1.


Re: error LOG - norton2 - 12.03.2014

to be that?

Quote:

if(HisPrecedentVehicle[playerid] !=(-1))




Re: error LOG - CuervO - 12.03.2014

Quote:
Originally Posted by norton2
Посмотреть сообщение
to be that?
Not really, somewhere in your OnPlayerDisconnect you're doing something similar to

Код:
HisPrecedentVehicle[-1] = ...
-1 Is a negative index and arrays don't support them. This could happen by any variable that is -1 at the moment of setting or even if playerid is -1 (could happen if you call OnPlayerDisconnect manually)


You don't need parenthesis when checking for individual negative values, althought it's recommended in maths you aren't necesarilly doing any mathematical operation here