SA-MP Forums

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

Reply
 
Thread Tools Display Modes
Old 29/06/2020, 04:46 PM   #1
_GHT_MarK445
Huge Clucker
 
Join Date: Oct 2010
Posts: 307
Reputation: 11
Default Timer error

Hi guys, this is info, that I see in my server_log:
Code:
[18:46:08] [debug] Run time error 4: "Array index out of bounds"
[18:46:08] [debug]  Attempted to read/write array element at index 65535 in array of size 100
[18:46:08] [debug] AMX backtrace:
[18:46:08] [debug] #0 0004e060 in public miniguntimer () in jb.amx
And this is the code:
Code:
forward miniguntimer();
public miniguntimer()
{
	new string[128], mostkills = INVALID_PLAYER_ID;
	for(new i = 0; i < MAX_PLAYERS; i++)
	{
	    if(IsPlayerConnected(i) && InEvent[i] == true)
	    {
			if(MgKills[i] > MgKills[mostkills]) mostkills = i;
		}
	}
	format(string, sizeof(string), "The player with Most Kills is %s with %d kills.", GetName(mostkills), MgKills[mostkills]);
	SendClientMessageToAll(MGDM, string);
	return 1;
}
Do you guys have any idea, what could be the problem?
_GHT_MarK445 is offline   Reply With Quote
Old 29/06/2020, 06:28 PM   #2
GameOvr
Huge Clucker
 
GameOvr's Avatar
 
Join Date: Jun 2018
Posts: 296
Reputation: 9
Default Re: Timer error

Code:
mostkills = INVALID_PLAYER_ID
if(MgKills[i] > MgKills[mostkills])
If you still didnt understand the problem just repost I'll explain...

Here you go, I guess its a mistake
Code:
forward miniguntimer();
public miniguntimer()
{
    new string[128], mostkills = INVALID_PLAYER_ID;
    for(new i = 0; i < MAX_PLAYERS; i++)
    {
        if(IsPlayerConnected(i) && InEvent[i] == true)
        {
            if(mostkills == INVALID_PLAYER_ID) mostkills = i;
            if(MgKills[i] > MgKills[mostkills]) mostkills = i;
        }
    }
    format(string, sizeof(string), "The player with Most Kills is %s with %d kills.", GetName(mostkills), MgKills[mostkills]);
    SendClientMessageToAll(MGDM, string);
    return 1;
}
__________________
GameOvr 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
Run Timer Error 17 Help RyderX Scripting Help 1 03/01/2017 07:05 PM
TIMER error Pearson Scripting Help 2 07/10/2016 10:29 PM
[Ajuda] Rum timer error Sennior Português/Portuguese 14 24/11/2015 01:42 PM
[Ajuda] Rum timer error Sennior Português/Portuguese 9 11/09/2015 11:57 PM
Timer Error [SOB]Chris Help Archive 6 19/07/2009 07:46 PM


All times are GMT. The time now is 12:02 PM.


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