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

Hello, anyone can help me fix this error? when i start the server, i got message this error on my server log.
PHP код:
public OnPlayerStateChange(playeridnewstateoldstate)
{
    
//OnAngkotPlayerStateChange(playerid, newstate, oldstate);
    
OnTaxiPlayerStateChange(playeridnewstateoldstate);
    if(
newstate == PLAYER_STATE_DRIVER || newstate == PLAYER_STATE_PASSENGER)
    {
        new 
vehicleid GetPlayerVehicleID(playerid);
        if(
IsHaulingCar(vehicleid) != -1) {
            
HaulingCarTimer[IsHaulingCar(vehicleid)] = 0;
        }
    }
    if(
newstate == PLAYER_STATE_DRIVER)
    {
        if(
IsHaulingCar(GetPlayerVehicleID(playerid)) != -1)
        {
            
/*if(PlayerJobInfo[playerid][pjHaulingDelay] > 0) {
                RemovePlayerFromVehicle(playerid);
                new str[256];
                format(str, sizeof(str), "[Hauling]{FFFFFF} Silahkan menunggu {FFFF00}%d detik{FFFFFF} lagi, untuk menggunakan job hauling kembali", PlayerJobInfo[playerid][pjHaulingDelay]);
                return SendClientMessageEx(playerid, COLOR_LIGHTGREEN, str);
            }*/
            
if(pHaulingRoute[playerid] != -1) {
                
pHaulingTimer[playerid] = 0;
            }
            if(
pHaulingRoute[playerid] == -1) {
                
SendClientMessageEx(playeridCOLOR_LIGHTGREEN"[Hauling]{FFFFFF} Silahkan ambil muatan truk di dekat anda");
            }
        }
    }
    if(
newstate == PLAYER_STATE_ONFOOT && oldstate == PLAYER_STATE_DRIVER)
    {
        if(
pHaulingRoute[playerid] != -1) {
            
pHaulingTimer[playerid] = 15;
             
GameTextForPlayer(playerid"~y~Hauling Fail~w~~n~dalam waktu ~y~15~w~ detik"10005);
        }
    }
    if(
newstate == PLAYER_STATE_DRIVER)
    {
        
OnVehicleShowroomFunction(playerid);
    }
    if(
oldstate == PLAYER_STATE_DRIVER && newstate == PLAYER_STATE_ONFOOT)
    {
        if(
GetPVarInt(playerid"ShowroomCarEdit") == 1)
        {
            new 
GetPVarInt(playerid"ShowroomCarEdit");
            
DeletePVar(playerid"ShowroomCarEdit");
            new 
GetVehicleShowroomID(GetPlayerVehicleID(playerid));
            
SetVehiclePos(ShowroomVehicleInfo[s][v][srvId], ShowroomVehicleInfo[s][v][srvPos][0], ShowroomVehicleInfo[s][v][srvPos][1], ShowroomVehicleInfo[s][v][srvPos][2]);
            
SetVehicleZAngle(ShowroomVehicleInfo[s][v][srvId], ShowroomVehicleInfo[s][v][srvPos][3]);
        }
    }
    if(
newstate == PLAYER_STATE_PASSENGER || newstate == PLAYER_STATE_DRIVERSetPlayerArmedWeapon(playerid0);
    if(
newstate == PLAYER_STATE_DRIVER || newstate == PLAYER_STATE_PASSENGER)
    {
        
ShowVehicleHUDForPlayer(playerid);
    }
    if(
newstate != PLAYER_STATE_DRIVER && newstate != PLAYER_STATE_PASSENGER)
    {
        
HideVehicleHUDForPlayer(playerid);
    }
    if(
newstate != 2NOPTrigger[playerid] = 0;
    if(
IsPlayerNPC(playerid))
    {
        if(
newstate == PLAYER_STATE_SPECTATING)
        {
            
TogglePlayerSpectating(playeridfalse);
        }
        return 
1;
    }
    if(
oldstate == PLAYER_STATE_DRIVER && newstate == PLAYER_STATE_ONFOOT)
    {
        if(
IsValidObject(semnalizari[GetPVarInt(playerid"VehLamp")][0])) DestroyObject(semnalizari[GetPVarInt(playerid"VehLamp")][0]); semnalizari[GetPVarInt(playerid"VehLamp")][0] = INVALID_OBJECT_ID;
        if(
IsValidObject(semnalizari[GetPVarInt(playerid"VehLamp")][2])) DestroyObject(semnalizari[GetPVarInt(playerid"VehLamp")][2]); semnalizari[GetPVarInt(playerid"VehLamp")][2] = INVALID_OBJECT_ID;
         
semnalizareron[GetPVarInt(playerid"VehLamp")] = 0;
         
semnalizarelon[GetPVarInt(playerid"VehLamp")] = 0;
    }
    if(
newstate == PLAYER_STATE_DRIVER)
    {
        
ShowVehicleHUDForPlayer(playerid);
        
pvehicleid[playerid] = GetPlayerVehicleID(playerid);
        
pmodelid[playerid] = GetVehicleModel(pvehicleid[playerid]);
    }
    else { 
PHP код:
SA-MP Dedicated Server
----------------------
v0.3.DL-R1, (C)2005-2018 SA-MP Team
[10:17:38
[
10:17:38Server Plugins
[10:17:38] --------------
[
10:17:38]  Loading plugincrashdetect
[10:17:38]   CrashDetect v4.17 is OK.
[
10:17:38]   Loaded.
[
10:17:38]  Loading pluginstreamer
[10:17:38
*** 
Streamer Plugin v2.9.1 by Incognito loaded ***
[
10:17:38]   Loaded.
[
10:17:38]  Loading pluginsscanf
[10:17:38
[
10:17:38]  ===============================
[
10:17:38]       sscanf plugin loaded.     
[
10:17:38]          Version:  2.8.2        
[10:17:38]    (c2012 Alex "******" Cole  
[10:17:38]  ===============================
[
10:17:38]   Loaded.
[
10:17:38]  Loading pluginWhirlpool
[10:17:38]  
[
10:17:38]  ==================
[
10:17:38]  
[
10:17:38]   Whirlpool loaded
[10:17:38]  
[
10:17:38]  ==================
[
10:17:38]  
[
10:17:38]   Loaded.
[
10:17:38]  Loading pluginaudio
[10:17:38
*** 
Audio Plugin v0.5 R2 by Incognito loaded ***
[
10:17:38]   Loaded.
[
10:17:38]  Loading pluginCTime
[10:17:38]  
 
» CTime Library Plugin For Pawn v0.1.0 Copyright © 2011 RyDeR` 
 
[10:17:38]   Loaded.
[10:17:38]  Loading plugin: Encrypt
[10:17:38] 
[10:17:38] ______________________________________
[10:17:38]  Encrypt Plugin v0.1 loaded
[10:17:38] ______________________________________
[10:17:38]  By: Fro © Copyright <TBG> 2009-2010
[10:17:38] ______________________________________
[10:17:38]   Loaded.
[10:17:38]  Loading plugin: FileFunctions
[10:17:38]   Loaded.
[10:17:38]  Loading plugin: nativechecker
[10:17:38]   Loaded.
[10:17:38]  Loaded 9 plugins.
[10:17:38] 
[10:17:38] Ban list
[10:17:38] --------
[10:17:38]  Loaded: samp.ban
[10:17:38] 
[10:17:38] 
[10:17:38] Filterscripts
[10:17:38] ---------------
[10:17:38]   Loading filterscript 'int.amx'...
[10:17:38]   Loading filterscript 'Buttons.amx'...
[10:17:38]   Loading filterscript 'Hidegun.amx'...
[10:17:38]   Loaded 3 filterscripts.
[10:17:39]  
[10:17:39]  ======================================= 
[10:17:39]  |                                     | 
[10:17:39]  |        YSI version 1.03.0011        | 
[10:17:39]  |        By Alex "******" Cole        | 
[10:17:39]  |                                     | 
[10:17:39]  |  Checking the latest YSI version..  | 
[10:17:39]  |                                     | 
[10:17:39]  ======================================= 
[10:17:39]  
[10:17:39] -mSelection- WARNING: Failed to load list: "sagsskins.txt"
[10:17:39] *** Audio Plugin: Started TCP server on port 7777
[10:17:39] Memuat Database Business Server...
[10:17:39] Memuat Database Stock Server...
[10:17:39] CYBER: Memuat data Harga.ini ..... [SELESAI]
[10:17:39] Loading Black Market Data.....
[10:17:39] Loading Garage Data.....
[10:17:39] Memuat Database TurfWars Server...
[10:17:39] Memuat Database Event Points Server...
[10:17:39] Memuat Database Dynamic Doors Server...
[10:17:39] Memuat Database Dynamic Map Icons Server...
[10:17:39] Memuat Database House Server...
[10:17:39] Gates loaded successfully.
[10:17:39] Memuat Database Workshop Server...
[10:17:39] Buypoint Berhasil Dimuat
[10:17:39] Memuat Database Dynamic Objects Server...
[10:17:39] Memuat Database Stuff Server...
[10:17:39] Memuat Database Server Stats Server...
[10:17:39] Memuat Database Families Server...
[10:17:39] Memuat Database Points Server...
[10:17:39] Memuat Database Dynamic Objects Server...
[10:17:39] [System] Board loaded successfully.
[10:17:39] Load Dealership
[10:17:45] Memuat Database Families HQ Server...
[10:17:45] Memuat Database Motd Server...
[10:17:45] [SCRIPT] 3DTEXTDRAW LIMIT: 1024 (Static, non-streamed) | 3DTEXTDRAW COUNT: 89
[10:17:45] [SCRIPT] PICKUP LIMIT: 4096 (Static, non-streamed) | PICKUP COUNT: 57
[10:17:45] [SCRIPT] OBJECT LIMIT: 2000 (Static, non-streamed) | OBJECT COUNT: 5134
[10:17:45] 
-------------------------------------------
[10:17:45] National Life Roleplay!n
[10:17:45] Copyright © National Life Roleplay! (2018)
[10:17:45] All Rights Reserved
[10:17:45] -------------------------------------------
[10:17:45] Berhasil memulai Gamemode...
[10:17:45] Number of vehicle models: 57
[10:17:45]  
[10:17:45]  ======================================= 
[10:17:45]  |                                     | 
[10:17:45]  |   Error: Could not connect to YSI   | 
[10:17:45]  |  update server (response was 404).  | 
[10:17:45]  |                                     | 
[10:17:45]  ======================================= 
[10:17:45]  
[10:18:35] [connection] incoming connection: 192.168.100.20:62569 id: 0
[10:18:35] [join] Marsha_Catherine has joined the server (0:192.168.100.20)
[10:18:42] Marsha_Catherine has logged in.
[10:18:42] Marsha_Catherine has logged in.
[10:18:42]  Loading Marsha_Catherine's vehicles.
[10:18:42]  Loading all vehicles mods.
[10:18:42]  Loading Vehicle Object.
[10:18:44] [debug] Run time error 4: "Array index out of bounds"
[10:18:44] [debug]  Attempted to read/write array element at negative index -400
[10:18:44] [debug] AMX backtrace:
[10:18:44] [debug] #0 0015d33c in public avt_OnPlayerStateChange (0, 8, 0) from a.amx
[10:18:44] [debug] #1 00016380 in public OnPlayerStateChange (0, 8, 0) from a.amx
[10:18:44] [debug] Run time error 4: "Array index out of bounds"
[10:18:44] [debug]  Attempted to read/write array element at negative index -400
[10:18:44] [debug] AMX backtrace:
[10:18:44] [debug] #0 0015d33c in public avt_OnPlayerStateChange (0, 1, 8) from a.amx
[10:18:44] [debug] #1 00016380 in public OnPlayerStateChange (0, 1, 8) from a.amx
[10:19:52] [zcmd] [Marsha Catherine]: /aod
[10:20:00] [zcmd] [Marsha Catherine]: /gate
[10:20:01] [zcmd] [Marsha Catherine]: /hgate
[10:20:03] [zcmd] [Marsha Catherine]: /hgate 1
[10:20:06] [zcmd] [Marsha Catherine]: /hgate 
[10:20:08] [zcmd] [Marsha Catherine]: /hgate test
[10:20:11]  Unloading Marsha_Catherine's vehicles.
[10:20:11] [part] Marsha_Catherine has left the server (0:1)
[10:20:54] [connection] incoming connection: 192.168.100.20:50830 id: 0
[10:20:54] [join] Marsha_Catherine has joined the server (0:192.168.100.20) 
Reply
#2

Use [PHP] tags and indent your code. Also, it looks like that your code is not complete.
Reply
#3

Quote:
Originally Posted by Logic_
Посмотреть сообщение
Use [PHP] tags and indent your code. Also, it looks like that your code is not complete.
Agreed with Logic_. Indent your code so that we can read it. I dont feel like reading the way you posted.
Reply
#4

Agree with both!

For more information create a file pawn.cfg into pawno folder and write -d3 in it. Re-compile your scripts and restart the server.
After you did that, post the server.log with [PHP] tag.
Reply
#5

Quote:
Originally Posted by UFF
Посмотреть сообщение
Agree with both!

For more information create a file pawn.cfg into pawno folder and write -d3 in it. Re-compile your scripts and restart the server.
After you did that, post the server.log with [PHP] tag.
PHP код:

----------
Loaded log file"server_log.txt".
----------
SA-MP Dedicated Server
----------------------
v0.3.DL-R1, (C)2005-2018 SA-MP Team
[14:49:45
[
14:49:45Server Plugins
[14:49:45] --------------
[
14:49:45]  Loading plugincrashdetect
[14:49:45]   CrashDetect v4.17 is OK.
[
14:49:45]   Loaded.
[
14:49:45]  Loading pluginstreamer
[14:49:46
*** 
Streamer Plugin v2.9.1 by Incognito loaded ***
[
14:49:46]   Loaded.
[
14:49:46]  Loading pluginsscanf
[14:49:46
[
14:49:46]  ===============================
[
14:49:46]       sscanf plugin loaded.     
[
14:49:46]          Version:  2.8.2        
[14:49:46]    (c2012 Alex "******" Cole  
[14:49:46]  ===============================
[
14:49:46]   Loaded.
[
14:49:46]  Loading pluginWhirlpool
[14:49:46]  
[
14:49:46]  ==================
[
14:49:46]  
[
14:49:46]   Whirlpool loaded
[14:49:46]  
[
14:49:46]  ==================
[
14:49:46]  
[
14:49:46]   Loaded.
[
14:49:46]  Loading pluginaudio
[14:49:46
*** 
Audio Plugin v0.5 R2 by Incognito loaded ***
[
14:49:46]   Loaded.
[
14:49:46]  Loading pluginCTime
[14:49:46]  
 
» CTime Library Plugin For Pawn v0.1.0 Copyright © 2011 RyDeR` 
 
[14:49:46]   Loaded.
[14:49:46]  Loading plugin: Encrypt
[14:49:46] 
[14:49:46] ______________________________________
[14:49:46]  Encrypt Plugin v0.1 loaded
[14:49:46] ______________________________________
[14:49:46]  By: Fro © Copyright <TBG> 2009-2010
[14:49:46] ______________________________________
[14:49:46]   Loaded.
[14:49:46]  Loading plugin: FileFunctions
[14:49:46]   Loaded.
[14:49:46]  Loading plugin: nativechecker
[14:49:46]   Loaded.
[14:49:46]  Loaded 9 plugins.
[14:49:46] 
[14:49:46] Ban list
[14:49:46] --------
[14:49:46]  Loaded: samp.ban
[14:49:46] 
[14:49:46] 
[14:49:46] Filterscripts
[14:49:46] ---------------
[14:49:46]   Loading filterscript 'int.amx'...
[14:49:46]   Loading filterscript 'Buttons.amx'...
[14:49:46]   Loading filterscript 'Hidegun.amx'...
[14:49:47]   Loaded 3 filterscripts.
[14:49:47]  
[14:49:47]  ======================================= 
[14:49:47]  |                                     | 
[14:49:47]  |        YSI version 1.03.0011        | 
[14:49:47]  |        By Alex "******" Cole        | 
[14:49:47]  |                                     | 
[14:49:47]  |  Checking the latest YSI version..  | 
[14:49:47]  |                                     | 
[14:49:47]  ======================================= 
[14:49:47]  
[14:49:47] *** Audio Plugin: Started TCP server on port 7777
[14:49:47] -mSelection- WARNING: Failed to load list: "sagsskins.txt"
[14:49:47] Memuat Database Business Server...
[14:49:47] Memuat Database Stock Server...
[14:49:47] CYBER: Memuat data Harga.ini ..... [SELESAI]
[14:49:47] Loading Black Market Data.....
[14:49:47] Loading Garage Data.....
[14:49:47] Memuat Database TurfWars Server...
[14:49:47] Memuat Database Event Points Server...
[14:49:47] Memuat Database Dynamic Doors Server...
[14:49:47] Memuat Database Dynamic Map Icons Server...
[14:49:47] Memuat Database House Server...
[14:49:47] Gates loaded successfully.
[14:49:47] Memuat Database Workshop Server...
[14:49:47] Buypoint Berhasil Dimuat
[14:49:47] Memuat Database Dynamic Objects Server...
[14:49:47] Memuat Database Stuff Server...
[14:49:47] Memuat Database Server Stats Server...
[14:49:47] Memuat Database Families Server...
[14:49:47] Memuat Database Points Server...
[14:49:47] Memuat Database Dynamic Objects Server...
[14:49:47] [System] Board loaded successfully.
[14:49:47] Load Dealership
[14:49:53] Memuat Database Families HQ Server...
[14:49:53] Memuat Database Motd Server...
[14:49:53] [SCRIPT] 3DTEXTDRAW LIMIT: 1024 (Static, non-streamed) | 3DTEXTDRAW COUNT: 94
[14:49:53] [SCRIPT] PICKUP LIMIT: 4096 (Static, non-streamed) | PICKUP COUNT: 61
[14:49:53] [SCRIPT] OBJECT LIMIT: 2000 (Static, non-streamed) | OBJECT COUNT: 5137
[14:49:53] 
-------------------------------------------
[14:49:53] National Life Roleplay!n
[14:49:53] Copyright © National Life Roleplay! (2018)
[14:49:53] All Rights Reserved
[14:49:53] -------------------------------------------
[14:49:53] Berhasil memulai Gamemode...
[14:49:53] Number of vehicle models: 57
[14:49:53]  
[14:49:53]  ======================================= 
[14:49:53]  |                                     | 
[14:49:53]  |   Error: Could not connect to YSI   | 
[14:49:53]  |  update server (response was 404).  | 
[14:49:53]  |                                     | 
[14:49:53]  ======================================= 
[14:49:53]  
[14:50:36] [connection] incoming connection: 192.168.100.20:55530 id: 0
[14:50:36] [join] Marsha_Catherine has joined the server (0:192.168.100.20)
[14:50:42] Marsha_Catherine has logged in.
[14:50:42] Marsha_Catherine has logged in.
[14:50:42]  Loading Marsha_Catherine's vehicles.
[14:50:42]  Loading all vehicles mods.
[14:50:42]  Loading Vehicle Object.
[14:50:44] [connection] incoming connection: 192.168.100.113:2256 id: 1
[14:50:44] [join] Jesica_Amelia has joined the server (1:192.168.100.113)
[14:50:44] [debug] Run time error 4: "Array index out of bounds"
[14:50:44] [debug]  Attempted to read/write array element at negative index -400
[14:50:44] [debug] AMX backtrace:
[14:50:44] [debug] #0 0015d33c in public avt_OnPlayerStateChange (0, 8, 0) from a.amx
[14:50:44] [debug] #1 00016380 in public OnPlayerStateChange (0, 8, 0) from a.amx
[14:50:44] [debug] Run time error 4: "Array index out of bounds"
[14:50:44] [debug]  Attempted to read/write array element at negative index -400
[14:50:44] [debug] AMX backtrace:
[14:50:44] [debug] #0 0015d33c in public avt_OnPlayerStateChange (0, 1, 8) from a.amx
[14:50:44] [debug] #1 00016380 in public OnPlayerStateChange (0, 1, 8) from a.amx
[14:50:51] Jesica_Amelia has logged in.
[14:50:51] Jesica_Amelia has logged in.
[14:50:51]  Loading Jesica_Amelia's vehicles.
[14:50:51]  Loading all vehicles mods.
[14:50:51]  Loading Vehicle Object.
[14:50:53] [debug] Run time error 4: "Array index out of bounds"
[14:50:53] [debug]  Attempted to read/write array element at negative index -400
[14:50:53] [debug] AMX backtrace:
[14:50:53] [debug] #0 0015d33c in public avt_OnPlayerStateChange (1, 8, 0) from a.amx
[14:50:53] [debug] #1 00016380 in public OnPlayerStateChange (1, 8, 0) from a.amx
[14:50:53] [debug] Run time error 4: "Array index out of bounds"
[14:50:53] [debug]  Attempted to read/write array element at negative index -400
[14:50:53] [debug] AMX backtrace:
[14:50:53] [debug] #0 0015d33c in public avt_OnPlayerStateChange (1, 1, 8) from a.amx
[14:50:53] [debug] #1 00016380 in public OnPlayerStateChange (1, 1, 8) from a.amx 
Reply
#6

I recommend you to don't use Romanian scripts if you are not Romanian.
I suggest doing this:

Replace
Код:
 if(IsValidObject(semnalizari[GetPVarInt(playerid, "VehLamp")][2])) DestroyObject(semnalizari[GetPVarInt(playerid, "VehLamp")][2]); semnalizari[GetPVarInt(playerid, "VehLamp")][2] = INVALID_OBJECT_ID;
with
Код:
 if(IsValidObject(semnalizari[GetPVarInt(playerid, "VehLamp")][1])) DestroyObject(semnalizari[GetPVarInt(playerid, "VehLamp")][1]); semnalizari[GetPVarInt(playerid, "VehLamp")][1] = INVALID_OBJECT_ID;
Reply
#7

BUMP
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)