SA-MP Forums

Go Back   SA-MP Forums > SA-MP Scripting and Plugins > Scripting Help

Reply
 
Thread Tools Display Modes
Old 20/08/2019, 06:37 PM   #1
GnT
Big Clucker
 
Join Date: Oct 2017
Location: Los Santos
Posts: 63
Reputation: 0
Default Timer backtrace

Hello guys, I have a problem with this global timer. I would appreciate it very much if you could help me. Error:

Code:
[18:41:05] [debug] Run time error 4: "Array index out of bounds"
[18:41:05] [debug]  Accessing element at index 65535 past array upper bound 999
[18:41:05] [debug] AMX backtrace:
[18:41:05] [debug] #0 00086b38 in public GlobalTimer () from ryse.amx
[18:41:06] [debug] Run time error 4: "Array index out of bounds"
[18:41:06] [debug]  Accessing element at index 65535 past array upper bound 999
[18:41:06] [debug] AMX backtrace:
[18:41:06] [debug] #0 00086b38 in public GlobalTimer () from ryse.amx
It is a a very big script but.. if you can help me..

Last edited by GnT; 20/08/2019 at 08:56 PM.
GnT is offline   Reply With Quote
Old 21/08/2019, 02:16 AM   #2
SiaReyes
Huge Clucker
 
SiaReyes's Avatar
 
Join Date: Mar 2019
Location: Coordinates X,Y,Z
Posts: 427
Reputation: 32
Default Re: Timer backtrace

compile the script with -d3 and it will show you the line of the warning in the log
__________________
Offshowtime Fuck It!

Quote:
Originally Posted by Toroi View Post
blackmail people that join your server using their ip address as hostage

or get a job and play sa-mp for fun

Last edited by SiaReyes; 21/08/2019 at 04:19 AM.
SiaReyes is online now   Reply With Quote
Old 21/08/2019, 12:27 PM   #3
GnT
Big Clucker
 
Join Date: Oct 2017
Location: Los Santos
Posts: 63
Reputation: 0
Default Re: Timer backtrace

Quote:
Originally Posted by SiaReyes View Post
compile the script with -d3 and it will show you the line of the warning in the log
I have compiled the gamemode

Code:
Pawn compiler 3.2.3664	 	 	Copyright (c) 1997-2006, ITB CompuPhase

Header size:          24420 bytes
Code size:          2793932 bytes
Data size:         37152404 bytes
Stack/heap size:      16384 bytes; estimated max. usage=4599 cells (18396 bytes)
Total requirements:39987140 bytes
[Finished in 28.8s]
GnT is offline   Reply With Quote
Old 21/08/2019, 08:18 PM   #4
TheToretto
Gangsta
 
TheToretto's Avatar
 
Join Date: Jul 2015
Posts: 586
Reputation: 66
Default Re: Timer backtrace

Can't exactly tell what's wrong if you don't show any code, but I'm pretty sure it refers to an INVALID_PLAYER_ID, it can come from the callback OnPlayerDeath if the killerid is invalid. Again I'm just guessing
__________________






Toretto#9902

Rest in peace grandpa, 03 November 2018
TheToretto is offline   Reply With Quote
Old 25/08/2019, 09:08 AM   #5
GnT
Big Clucker
 
Join Date: Oct 2017
Location: Los Santos
Posts: 63
Reputation: 0
Default Re: Timer backtrace

Quote:
Originally Posted by TheToretto View Post
Can't exactly tell what's wrong if you don't show any code, but I'm pretty sure it refers to an INVALID_PLAYER_ID, it can come from the callback OnPlayerDeath if the killerid is invalid. Again I'm just guessing
I have this in OnPlayerDeath:

Code:
public OnPlayerDeath(playerid, killerid, reason) {
	if(killerid != INVALID_PLAYER_ID) { 
                  code...
        }
       return 1;
}
GnT is offline   Reply With Quote
Old 25/08/2019, 09:15 AM   #6
GnT
Big Clucker
 
Join Date: Oct 2017
Location: Los Santos
Posts: 63
Reputation: 0
Default Re: Timer backtrace

I think the problem is coming from this code

Code:
			if(GetPlayerSurfingVehicleID(i) != INVALID_VEHICLE_ID && !IsABoat(GetPlayerSurfingVehicleID(i)) ) {
				new pid = GetVehicleDriver(GetPlayerSurfingVehicleID(i));
				if(togsurf[pid] > 0 && IsPlayerInVehicle(pid, GetPlayerSurfingVehicleID(i))) {
					SlapPlayer(i);
					SCM(i, COLOR_WHITE, "You have been thrown out the car because player surf is on.");
				} 
			} // this code is in a timer

stock GetVehicleDriver(vid) {
	foreach(Player, i) {
		if(!IsPlayerConnected(i)) continue;
		if(GetPlayerVehicleID(i) == vid) return i;
	}
	return INVALID_PLAYER_ID;
}
GnT is offline   Reply With Quote
Old 25/08/2019, 09:26 AM   #7
Calisthenics
Gangsta
 
Join Date: May 2018
Posts: 958
Reputation: 167
Default Re: Timer backtrace

If players can surf on a vehicle without a driver, then you have to ensure that pid is not equal to INVALID_PLAYER_ID before using it in togsurf array.

Consider splitting the code in your timer, it may cause synchronization problems.
Calisthenics is offline   Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
AMX backtrace Klayton Scripting Help 3 01/11/2017 01:47 PM
AMX Backtrace KnowNN Scripting Help 6 04/02/2016 08:39 PM
AMX backtrace SoNikMells Русский/Russian 7 24/09/2014 11:23 PM
AMX Backtrace Ph0eniX Scripting Help 1 17/08/2014 06:22 PM
Amx Backtrace ReshiramZekrom Scripting Help 2 02/09/2013 11:36 PM


All times are GMT. The time now is 06:37 PM.


Powered by vBulletin® Version 3.8.6
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.