error LOG
#1

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)
Reply
#2

Please helpp
Reply
#3

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;
Reply
#4

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

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.
Reply
#6

to be that?

Quote:

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

Reply
#7

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
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)