[13:53:26] [debug] Run time error 4: "Array index out of bounds" [13:53:26] [debug] Accessing element at negative index -1 [13:53:26] [debug] AMX backtrace: [13:53:26] [debug] #0 00057518 in public Speedometer_Update (0x00000000) from PPCT.amx
[16:58:12] Incoming connection: 78.1.136.53:56905 [16:58:12] [join] karamboaas has joined the server (3:78.1.136.53) [16:58:12] Kod igraca(karamboaas): 4D48FD504A45A459C8AD904CE999CE44484 [16:58:13] [debug] Run time error 5: "Invalid memory access" [16:58:13] [debug] AMX backtrace: [16:58:13] [debug] #0 000ef014 in public Toll () from PPCT.amx [16:58:13] [debug] Run time error 5: "Invalid memory access" [16:58:13] [debug] AMX backtrace: [16:58:13] [debug] #0 0001a5b8 in public GlobalTimer () from PPCT.amx [16:58:14] [debug] Run time error 5: "Invalid memory access" [16:58:14] [debug] AMX backtrace: [16:58:14] [debug] #0 000ef014 in public Toll () from PPCT.amx [16:58:14] [debug] Run time error 5: "Invalid memory access" [16:58:14] [debug] AMX backtrace: [16:58:14] [debug] #0 0001a5b8 in public GlobalTimer () from PPCT.amx [16:58:15] [debug] Run time error 5: "Invalid memory access" [16:58:15] [debug] AMX backtrace: [16:58:15] [debug] #0 000ef014 in public Toll () from PPCT.amx [16:58:15] [debug] Run time error 5: "Invalid memory access" [16:58:15] [debug] AMX backtrace: [16:58:15] [debug] #0 0001a5b8 in public GlobalTimer () from PPCT.amx [16:58:16] [debug] Run time error 5: "Invalid memory access" [16:58:16] [debug] AMX backtrace: [16:58:16] [debug] #0 000ef014 in public Toll () from PPCT.amx [16:58:16] [debug] Run time error 5: "Invalid memory access" [16:58:16] [debug] AMX backtrace: [16:58:16] [debug] #0 0001a5b8 in public GlobalTimer () from PPCT.amx [16:58:17] [debug] Run time error 5: "Invalid memory access" [16:58:17] [debug] AMX backtrace: [16:58:17] [debug] #0 000ef014 in public Toll () from PPCT.amx [16:58:17] [debug] Run time error 5: "Invalid memory access" [16:58:17] [debug] AMX backtrace: [16:58:17] [debug] #0 0001a5b8 in public GlobalTimer () from PPCT.amx [16:58:18] [debug] Run time error 5: "Invalid memory access" [16:58:18] [debug] AMX backtrace: [16:58:18] [debug] #0 000ef014 in public Toll () from PPCT.amx [16:58:18] [debug] Run time error 5: "Invalid memory access" [16:58:18] [debug] AMX backtrace: [16:58:18] [debug] #0 0001a5b8 in public GlobalTimer () from PPCT.amx [16:58:19] [debug] Run time error 5: "Invalid memory access" [16:58:19] [debug] AMX backtrace: [16:58:19] [debug] #0 000ef014 in public Toll () from PPCT.amx [16:58:19] [debug] Run time error 5: "Invalid memory access" [16:58:19] [debug] AMX backtrace: [16:58:19] [debug] #0 0001a5b8 in public GlobalTimer () from PPCT.amx [16:58:20] [debug] Run time error 5: "Invalid memory access" [16:58:20] [debug] AMX backtrace: [16:58:20] [debug] #0 000ef014 in public Toll () from PPCT.amx [16:58:20] [debug] Run time error 5: "Invalid memory access" [16:58:20] [debug] AMX backtrace: [16:58:20] [debug] #0 0001a5b8 in public GlobalTimer () from PPCT.amx [16:58:21] [debug] Run time error 5: "Invalid memory access" [16:58:21] [debug] AMX backtrace: [16:58:21] [debug] #0 000ef014 in public Toll () from PPCT.amx [16:58:21] [debug] Run time error 5: "Invalid memory access" [16:58:21] [debug] AMX backtrace: [16:58:21] [debug] #0 0001a5b8 in public GlobalTimer () from PPCT.amx [16:58:22] [debug] Run time error 5: "Invalid memory access" [16:58:22] [debug] AMX backtrace: [16:58:22] [debug] #0 0001cec4 in ?? (0x00000001, 0x00f318a0, 0x00f69714) from PPCT.amx [16:58:22] [debug] #1 000c9814 in public cmd_izbavi (0x00000001, 0x00f69714) from PPCT.amx [16:58:22] [debug] #2 native CallLocalFunction () [080dbf60] from samp03svr [16:58:22] [debug] #3 00007f40 in public FIXES_OnPlayerCommandText (0x00000001, 0x00f696f4) from PPCT.amx [16:58:22] [debug] #4 00002ff0 in public OnPlayerCommandText (0x00000001, 0x00f696f4) from PPCT.amx [16:58:22] [debug] Run time error 5: "Invalid memory access" [16:58:22] [debug] AMX backtrace: [16:58:22] [debug] #0 000ef014 in public Toll () from PPCT.amx [16:58:22] [debug] Run time error 5: "Invalid memory access" [16:58:22] [debug] AMX backtrace: [16:58:22] [debug] #0 0001a5b8 in public GlobalTimer () from PPCT.amx [16:58:22] [debug] Server crashed while executing PPCT.amx [16:58:22] [debug] AMX backtrace: [16:58:22] [debug] #0 native fwrite () [0809aa10] from samp03svr [16:58:22] [debug] #1 0004a6ec in ?? (0x00000002) from PPCT.amx [16:58:22] [debug] #2 000f6d68 in public Streamer_OnPlayerDisconnect (0x00000002, 0x00000001) from PPCT.amx [16:58:22] [debug] #3 0000e09c in public SSCANF_OnPlayerDisconnect (0x00000002, 0x00000001) from PPCT.amx [16:58:22] [debug] #4 00008538 in public FIXES_OnPlayerDisconnect (0x00000002, 0x00000001) from PPCT.amx [16:58:22] [debug] #5 00003334 in public OnPlayerDisconnect (0x00000002, 0x00000001) from PPCT.amx [16:58:22] [debug] Native backtrace: [16:58:22] [debug] #0 f738231b in _ZN10StackTraceC1EPv () from plugins/crashdetect.so [16:58:22] [debug] #1 f737c7c2 in _ZN11CrashDetect20PrintNativeBacktraceERSoPv () from plugins/crashdetect.so [16:58:22] [debug] #2 f737d3ac in _ZN11CrashDetect20PrintNativeBacktraceEPv () from plugins/crashdetect.so [16:58:22] [debug] #3 f737d856 in _ZN11CrashDetect11OnExceptionEPv () from plugins/crashdetect.so [16:58:22] [debug] #4 f7381f6c in ?? () from plugins/crashdetect.so [16:58:22] [debug] #5 f7760410 in __kernel_rt_sigreturn () from linux-gate.so.1 [16:58:22] [debug] #6 f7760430 in __kernel_vsyscall () from linux-gate.so.1 [16:58:22] [debug] #7 f745cabf in gsignal () from /lib32/libc.so.6 [16:58:22] [debug] #8 f745ff73 in abort () from /lib32/libc.so.6 [16:58:22] [debug] #9 f7455747 in ?? () from /lib32/libc.so.6 [16:58:22] [debug] #10 f74557f7 in ?? () from /lib32/libc.so.6 [16:58:22] [debug] #11 0809a63c in ?? () from ./samp03svr [16:58:22] [debug] #12 0809aa9f in ?? () from ./samp03svr [16:58:22] [debug] #13 08093d84 in ?? () from ./samp03svr [16:58:22] [debug] #14 f737a03c in _ZN11CrashDetect13DoAmxCallbackEiPiS0_ () from plugins/crashdetect.so [16:58:22] [debug] #15 f7380458 in ?? () from plugins/crashdetect.so [16:58:22] [debug] #16 f7384c61 in amx_Exec () from plugins/crashdetect.so [16:58:22] [debug] #17 f737c708 in _ZN11CrashDetect9DoAmxExecEPii () from plugins/crashdetect.so [16:58:22] [debug] #18 f73801c9 in ?? () from plugins/crashdetect.so [16:58:22] [debug] #19 080a38ba in ?? () from ./samp03svr [16:58:22] [debug] #20 080cdc11 in ?? () from ./samp03svr [16:58:22] [debug] #21 080ab487 in ?? () from ./samp03svr [16:58:22] [debug] #22 080acd60 in ?? () from ./samp03svr [16:58:22] [debug] #23 080acda2 in ?? () from ./samp03svr [16:58:22] [debug] #24 080a81ae in ?? () from ./samp03svr [16:58:22] [debug] #25 f74478c5 in __libc_start_main () from /lib32/libc.so.6
#pragma tabsize 0 #pragma dynamic 5576
forward GlobalTimer(); public GlobalTimer() { // Setup local variables new OldVehicleID, NewVehicleID, OldTrailerID, NewTrailerID; // Loop through all players for (new playerid; playerid < MAX_PLAYERS; playerid++) { // Check if this player is logged in if (APlayerData[playerid][LoggedIn] == true) { // Get the vehicle-id's from this player OldVehicleID = APlayerData[playerid][VehicleID]; NewVehicleID = GetPlayerVehicleID(playerid); OldTrailerID = APlayerData[playerid][TrailerID]; NewTrailerID = GetVehicleTrailer(GetPlayerVehicleID(playerid)); // Check the class of the player switch (APlayerData[playerid][PlayerClass]) { case ClassTruckDriver: { // Check if the trucker has a job if (APlayerData[playerid][JobStarted] == true) { // Check if the vehicletimer didn't run out yet if (APlayerData[playerid][VehicleTimerTime] != 0) { // If VehicleID and TrailerID are still the same as when the player accepted the job if ((OldVehicleID == NewVehicleID) && (OldTrailerID == NewTrailerID)) APlayerData[playerid][VehicleTimerTime] = Job_TimeToFailMission; // Reset the time before the mission fails else // One (or both) aren't still the same (player lost his trailer or vehicle) PlayerLeftVehicle(playerid); // Inform the player that he left his vehicle and that he must re-enter it } else // Time left has reached 0 FailJob(playerid); } } case ClassBusDriver: { // Check if the busdriver has a job if (APlayerData[playerid][JobStarted] == true) { if (APlayerData[playerid][VehicleTimerTime] != 0) { // If VehicleID is still the same as when the player accepted the job if (OldVehicleID == NewVehicleID) APlayerData[playerid][VehicleTimerTime] = Job_TimeToFailMission; // Reset the time before the mission fails else // Player got out of his bus PlayerLeftVehicle(playerid); // Inform the player that he left his vehicle and that he must re-enter it } else // Time left has reached 0 FailJob(playerid); } } case ClassMafia: { // Check if the mafia has a job if (APlayerData[playerid][JobStarted] == true) { if (APlayerData[playerid][VehicleTimerTime] != 0) { // If VehicleID is still the same as when the player accepted the job if (OldVehicleID == NewVehicleID) APlayerData[playerid][VehicleTimerTime] = Job_TimeToFailMission; // Reset the time before the mission fails else // Player left his vehicle PlayerLeftVehicle(playerid); // Inform the player that he left his vehicle and that he must re-enter it } else // Time left has reached 0 FailJob(playerid); } } case ClassCourier: { // Check if the courier has a job if (APlayerData[playerid][JobStarted] == true) { if (APlayerData[playerid][VehicleTimerTime] != 0) { // If VehicleID and TrailerID are still the same as when the player accepted the job if (OldVehicleID == NewVehicleID) APlayerData[playerid][VehicleTimerTime] = Job_TimeToFailMission; // Reset the time before the mission fails else // Player stepped out of his vehicle PlayerLeftVehicle(playerid); // Inform the player that he left his vehicle and that he must re-enter it } else // Time left has reached 0 FailJob(playerid); } } case ClassRoadWorker: { // Check if the roadworker has a job if (APlayerData[playerid][JobStarted] == true) { // Check if the vehicletimer didn't run out yet if (APlayerData[playerid][VehicleTimerTime] != 0) { // If VehicleID and TrailerID are still the same as when the player accepted the job // In case of the "tow broken vehicle" jobtype, the mission starts without a trailer (so it's 0), // but gets updated when the player enters the checkpoint to set the broken vehicle as trailer if ((OldVehicleID == NewVehicleID) && (OldTrailerID == NewTrailerID)) APlayerData[playerid][VehicleTimerTime] = Job_TimeToFailMission; // Reset the time before the mission fails else // VehicleID isn't still the same (player lost his vehicle or trailer) PlayerLeftVehicle(playerid); // Inform the player that he left his vehicle and that he must re-enter it } else // Time left has reached 0 FailJob(playerid); } } case ClassTashMaster: { // Check if the courier has a job if (APlayerData[playerid][JobStarted] == true) { if (APlayerData[playerid][VehicleTimerTime] != 0) { // If VehicleID and TrailerID are still the same as when the player accepted the job if (OldVehicleID == NewVehicleID) APlayerData[playerid][VehicleTimerTime] = Job_TimeToFailMission; // Reset the time before the mission fails else // Player stepped out of his vehicle PlayerLeftVehicle(playerid); // Inform the player that he left his vehicle and that he must re-enter it } else // Time left has reached 0 FailJob(playerid); } } case ClassTaxi: { // Check if the courier has a job if (APlayerData[playerid][JobStarted] == true) { if (APlayerData[playerid][VehicleTimerTime] != 0) { // If VehicleID and TrailerID are still the same as when the player accepted the job if (OldVehicleID == NewVehicleID) APlayerData[playerid][VehicleTimerTime] = Job_TimeToFailMission; // Reset the time before the mission fails else // Player stepped out of his vehicle PlayerLeftVehicle(playerid); // Inform the player that he left his vehicle and that he must re-enter it } else // Time left has reached 0 FailJob(playerid); } } case ClassIce: { // Check if the courier has a job if (APlayerData[playerid][JobStarted] == true) { if (APlayerData[playerid][VehicleTimerTime] != 0) { // If VehicleID and TrailerID are still the same as when the player accepted the job if (OldVehicleID == NewVehicleID) APlayerData[playerid][VehicleTimerTime] = Job_TimeToFailMission; // Reset the time before the mission fails else // Player stepped out of his vehicle PlayerLeftVehicle(playerid); // Inform the player that he left his vehicle and that he must re-enter it } else // Time left has reached 0 FailJob(playerid); } } case ClassFarmer: { // Check if the courier has a job if (APlayerData[playerid][JobStarted] == true) { if (APlayerData[playerid][VehicleTimerTime] != 0) { // If VehicleID and TrailerID are still the same as when the player accepted the job if (OldVehicleID == NewVehicleID) APlayerData[playerid][VehicleTimerTime] = Job_TimeToFailMission; // Reset the time before the mission fails else // Player stepped out of his vehicle PlayerLeftVehicle(playerid); // Inform the player that he left his vehicle and that he must re-enter it } else // Time left has reached 0 FailJob(playerid); } } case ClassMilitary: { // Check if the courier has a job if (APlayerData[playerid][JobStarted] == true) { if (APlayerData[playerid][VehicleTimerTime] != 0) { // If VehicleID and TrailerID are still the same as when the player accepted the job if (OldVehicleID == NewVehicleID) APlayerData[playerid][VehicleTimerTime] = Job_TimeToFailMission; // Reset the time before the mission fails else // Player stepped out of his vehicle PlayerLeftVehicle(playerid); // Inform the player that he left his vehicle and that he must re-enter it } else // Time left has reached 0 FailJob(playerid); } } case ClassSumar: { // Check if the courier has a job if (APlayerData[playerid][JobStarted] == true) { if (APlayerData[playerid][VehicleTimerTime] != 0) { // If VehicleID and TrailerID are still the same as when the player accepted the job if (OldVehicleID == NewVehicleID) APlayerData[playerid][VehicleTimerTime] = Job_TimeToFailMission; // Reset the time before the mission fails else // Player stepped out of his vehicle PlayerLeftVehicle(playerid); // Inform the player that he left his vehicle and that he must re-enter it } else // Time left has reached 0 FailJob(playerid); } } case ClassZastitar: { // Check if the courier has a job if (APlayerData[playerid][JobStarted] == true) { if (APlayerData[playerid][VehicleTimerTime] != 0) { // If VehicleID and TrailerID are still the same as when the player accepted the job if (OldVehicleID == NewVehicleID) APlayerData[playerid][VehicleTimerTime] = Job_TimeToFailMission; // Reset the time before the mission fails else // Player stepped out of his vehicle PlayerLeftVehicle(playerid); // Inform the player that he left his vehicle and that he must re-enter it } else // Time left has reached 0 FailJob(playerid); } } case ClassTrain: { // Check if the courier has a job if (APlayerData[playerid][JobStarted] == true) { if (APlayerData[playerid][VehicleTimerTime] != 0) { // If VehicleID and TrailerID are still the same as when the player accepted the job if (OldVehicleID == NewVehicleID) APlayerData[playerid][VehicleTimerTime] = Job_TimeToFailMission; // Reset the time before the mission fails else // Player stepped out of his vehicle PlayerLeftVehicle(playerid); // Inform the player that he left his vehicle and that he must re-enter it } else // Time left has reached 0 FailJob(playerid); } } } } } return 1; } forward Toll(); public Toll() { // Loop through all players for(new playerid; playerid < MAX_PLAYERS; playerid++) { // If the player isn't connected, skip to the next player if(APlayerData[playerid][LoggedIn] == false) continue; // Check if the player is the driver of a vehicle if (GetPlayerVehicleSeat(playerid) == 0) { // Loop through all toll-gates for (new TollGate; TollGate < MAX_TOLLGATES; TollGate++) { // Check if this toll-gate exists if (ATollGates[TollGate][GateID] != 0) { // Check if the player is in range of the tollgate if(IsPlayerInRangeOfPoint(playerid, 7.5, ATollGates[TollGate][CloseX], ATollGates[TollGate][CloseY], ATollGates[TollGate][CloseZ])) { // Check if the toll-gate is closed if(ATollGates[TollGate][GateStatus] == 0) { // Open the gate MoveObject(ATollGates[TollGate][GateID], ATollGates[TollGate][OpenX], ATollGates[TollGate][OpenY], ATollGates[TollGate][OpenZ], 3.0); // Set status to OPEN ATollGates[TollGate][GateStatus] = 1; // Let the player pay the toll RewardPlayer(playerid, -ATollGates[TollGate][TollPrice], 0); new string[50]; format(string, sizeof(string), TXT_PlayerPaysToll, ATollGates[TollGate][TollPrice]); GameTextForPlayer(playerid, string, 3000, 4); // Start a timer that closes the gate after 5 seconds SetTimerEx("CloseGate", 5000, false, "i", TollGate); } } } } } } } forward CloseGate(TollGate); public CloseGate(TollGate) { // Close the gate MoveObject(ATollGates[TollGate][GateID], ATollGates[TollGate][CloseX], ATollGates[TollGate][CloseY], ATollGates[TollGate][CloseZ], 3.0); // Set status to CLOSED ATollGates[TollGate][GateStatus] = 0; }
What's going on is that you're sending a value that's below 0 to an array that starts at 0. You need to put debug prints around anything that calls Speedometer_Update as such.
printf("Speedometer_Update(%d) - line 1", value); Speedometer_Update(value); If you compile using debug d3 options then you can even find the line that's causing you problems. |
new OtherPlayer = APlayerData[playerid][SpectateID];
if (GetPlayerVehicleSeat(OtherPlayer) != -1)
if (IsPlayerInAnyVehicle(OtherPlayer))
// OR
if (GetPlayerVehicleID(OtherPlayer))