SA-MP Forums

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

Reply
 
Thread Tools Display Modes
Old 06/08/2019, 10:54 PM   #1
Goku
Little Clucker
 
Goku's Avatar
 
Join Date: Aug 2019
Location: X, Y, Z
Posts: 16
Reputation: 0
Default spaming messages idk why

Code:
[debug] AMX backtrace:
[debug] #0 0000604c in public OnZombieCreate () from lolwtf.amx
[debug] Run time error 4: "Array index out of bounds"
[debug]  Attempted to read/write array element at index 100 in array of size 100
[debug] AMX backtrace:
[debug] #0 00006090 in public OnZombieCreate () from lolwtf.amx
i am getting this spamming msg when i start the server i am using rnpc filter-script can anyone tell me why this happening?

here are the codes:

Code:
public OnZombieCreate()
{
	RNPC_SetUpdateRate(80);

	new type = random(4), name[MAX_PLAYER_NAME], zombieid = ServerData[server_zombies];
	if(type == SPRINTER_ZOMBIE)
	{
		ZombieData[zombieid][zombie_species] = SPRINTER_ZOMBIE;
	}
	else
	{
		ZombieData[zombieid][zombie_species] = RUNNER_ZOMBIE;
	}

	ZombieData[zombieid][zombie_victim]= INVALID_PLAYER_ID;

	format(name, sizeof(name), "Zombie_%i", zombieid + 1);
	ConnectRNPC(name);

	ServerData[server_zombies]++;

	if(ServerData[server_zombies] >= MAX_ZOMBIES)
	{
		KillTimer(ServerData[server_zombietimer]);
		printf("Number of zombies created: %i", ServerData[server_zombies]);
	}
	return 1;
}
here is the server log:

Code:
----------
Loaded log file: "server_log.txt".
----------

SA-MP Dedicated Server
----------------------
v0.3.7-R2, (C)2005-2015 SA-MP Team

[03:48:58] 
[03:48:58] Server Plugins
[03:48:58] --------------
[03:48:58]  Loading plugin: crashdetect.dll
[03:48:59]   CrashDetect plugin 4.19
[03:48:59]   Loaded.
[03:48:59]  Loading plugin: streamer.dll
[03:48:59] 

*** Streamer Plugin v2.9.3 by Incognito loaded ***

[03:48:59]   Loaded.
[03:48:59]  Loading plugin: sscanf.dll
[03:49:00] 

[03:49:00]  ===============================

[03:49:00]       sscanf plugin loaded.     

[03:49:00]          Version:  2.8.2        

[03:49:00]    (c) 2012 Alex "******" Cole  

[03:49:00]  ===============================

[03:49:00]   Loaded.
[03:49:00]  Loading plugin: RNPC.dll
[03:49:00] RNPC V0.3.1 by Mauzen (21.12.2012)
[03:49:00]   Loaded.
[03:49:00]  Loading plugin: MapAndreas.dll
[03:49:00]   Loaded.
[03:49:00]  Loaded 5 plugins.

[03:49:01] 
[03:49:01] Filterscripts
[03:49:01] ---------------
[03:49:01]   Loading filterscript 'lolwtf.amx'...
[03:49:01]   Loaded 1 filterscripts.

[03:49:01]   RNPC versionchecker: checking for updates...
[03:49:01] 
----------------------------------
[03:49:01]  Blank Gamemode by your name here
[03:49:01] ----------------------------------

[03:49:01] Number of vehicle models: 0
[03:49:10] Number of zombies created: 100
[03:49:37] [connection] 127.0.0.1:61243 requests connection cookie.
[03:49:38] [connection] incoming connection: 127.0.0.1:61243 id: 0
[03:49:38] [join] [PAK]Broly has joined the server (0:127.0.0.1)
[03:49:43] [debug] Run time error 4: "Array index out of bounds"
[03:49:43] [debug]  Attempted to read/write array element at index 100 in array of size 100
[03:49:43] [debug] AMX backtrace:
[03:49:43] [debug] #0 00006090 in public OnZombieCreate () from lolwtf.amx
[03:49:43] [debug] Run time error 4: "Array index out of bounds"
[03:49:43] [debug]  Attempted to read/write array element at index 100 in array of size 100
[03:49:43] [debug] AMX backtrace:
[03:49:43] [debug] #0 00006090 in public OnZombieCreate () from lolwtf.amx
[03:49:43] [debug] Run time error 4: "Array index out of bounds"
[03:49:43] [debug]  Attempted to read/write array element at index 100 in array of size 100
[03:49:43] [debug] AMX backtrace:
[03:49:43] [debug] #0 00006090 in public OnZombieCreate () from lolwtf.amx
[03:49:43] [debug] Run time error 4: "Array index out of bounds"
[03:49:43] [debug]  Attempted to read/write array element at index 100 in array of size 100
[03:49:43] [debug] AMX backtrace:
[03:49:43] [debug] #0 00006090 in public OnZombieCreate () from lolwtf.amx
[03:49:43] [debug] Run time error 4: "Array index out of bounds"
[03:49:43] [debug]  Attempted to read/write array element at index 100 in array of size 100
[03:49:43] [debug] AMX backtrace:
[03:49:43] [debug] #0 00006090 in public OnZombieCreate () from lolwtf.amx
[03:49:43] [debug] Run time error 4: "Array index out of bounds"
[03:49:43] [debug]  Attempted to read/write array element at index 100 in array of size 100
[03:49:43] [debug] AMX backtrace:
[03:49:43] [debug] #0 00006090 in public OnZombieCreate () from lolwtf.amx
[03:49:43] [debug] Run time error 4: "Array index out of bounds"
[03:49:43] [debug]  Attempted to read/write array element at index 100 in array of size 100
[03:49:43] [debug] AMX backtrace:
[03:49:43] [debug] #0 0000604c in public OnZombieCreate () from lolwtf.amx
[03:49:43] [debug] Run time error 4: "Array index out of bounds"
[03:49:43] [debug]  Attempted to read/write array element at index 100 in array of size 100
[03:49:43] [debug] AMX backtrace:
[03:49:43] [debug] #0 00006090 in public OnZombieCreate () from lolwtf.amx
[03:49:43] [debug] Run time error 4: "Array index out of bounds"
[03:49:43] [debug]  Attempted to read/write array element at index 100 in array of size 100
[03:49:43] [debug] AMX backtrace:
[03:49:43] [debug] #0 00006090 in public OnZombieCreate () from lolwtf.amx
[03:49:43] [debug] Run time error 4: "Array index out of bounds"
[03:49:43] [debug]  Attempted to read/write array element at index 100 in array of size 100
[03:49:43] [debug] AMX backtrace:
[03:49:43] [debug] #0 00006090 in public OnZombieCreate () from lolwtf.amx
[03:49:43] [debug] Run time error 4: "Array index out of bounds"
[03:49:43] [debug]  Attempted to read/write array element at index 100 in array of size 100
[03:49:43] [debug] AMX backtrace:
[03:49:43] [debug] #0 0000604c in public OnZombieCreate () from lolwtf.amx
[03:49:43] [debug] Run time error 4: "Array index out of bounds"
[03:49:43] [debug]  Attempted to read/write array element at index 100 in array of size 100
[03:49:43] [debug] AMX backtrace:
[03:49:43] [debug] #0 00006090 in public OnZombieCreate () from lolwtf.amx
[03:49:44] [debug] Run time error 4: "Array index out of bounds"
[03:49:44] [debug]  Attempted to read/write array element at index 100 in array of size 100
[03:49:44] [debug] AMX backtrace:
[03:49:44] [debug] #0 0000604c in public OnZombieCreate () from lolwtf.amx
[03:49:44] [debug] Run time error 4: "Array index out of bounds"
[03:49:44] [debug]  Attempted to read/write array element at index 100 in array of size 100
[03:49:44] [debug] AMX backtrace:
[03:49:44] [debug] #0 0000604c in public OnZombieCreate () from lolwtf.amx
[03:49:44] [debug] Run time error 4: "Array index out of bounds"
[03:49:44] [debug]  Attempted to read/write array element at index 100 in array of size 100
[03:49:44] [debug] AMX backtrace:
[03:49:44] [debug] #0 00006090 in public OnZombieCreate () from lolwtf.amx
[03:49:44] [debug] Run time error 4: "Array index out of bounds"
[03:49:44] [debug]  Attempted to read/write array element at index 100 in array of size 100
[03:49:44] [debug] AMX backtrace:
[03:49:44] [debug] #0 0000604c in public OnZombieCreate () from lolwtf.amx
[03:49:44] [debug] Run time error 4: "Array index out of bounds"
[03:49:44] [debug]  Attempted to read/write array element at index 100 in array of size 100
[03:49:44] [debug] AMX backtrace:
[03:49:44] [debug] #0 0000604c in public OnZombieCreate () from lolwtf.amx
[03:49:44] [debug] Run time error 4: "Array index out of bounds"
[03:49:44] [debug]  Attempted to read/write array element at index 100 in array of size 100
[03:49:44] [debug] AMX backtrace:
[03:49:44] [debug] #0 00006090 in public OnZombieCreate () from lolwtf.amx
[03:49:44] [debug] Run time error 4: "Array index out of bounds"
[03:49:44] [debug]  Attempted to read/write array element at index 100 in array of size 100
[03:49:44] [debug] AMX backtrace:
[03:49:44] [debug] #0 00006090 in public OnZombieCreate () from lolwtf.amx
[03:49:44] [debug] Run time error 4: "Array index out of bounds"
[03:49:44] [debug]  Attempted to read/write array element at index 100 in array of size 100
Thanks in advance
__________________
Code:
public OnPlayerConnect(playerid)
{
     SendClientMessage(playerid,-1,Welcome to my server and now good bye :p);
     Kick(playerid);
     return 1;
}
Goku is offline   Reply With Quote
Old 07/08/2019, 04:32 AM   #2
Libbyphay
Big Clucker
 
Join Date: May 2017
Posts: 188
Reputation: 0
Default Re: spaming messages idk why :/

PHP Code:
ServerData[server_zombies
PHP Code:
server_zombies 
It error, I think so.
Libbyphay is offline   Reply With Quote
Old 07/08/2019, 08:26 AM   #3
Calisthenics
Gangsta
 
Join Date: May 2018
Posts: 662
Reputation: 96
Default Re: spaming messages idk why :/

Check if it reaches array size before you create another bot.
pawn Code:
new zombieid = ServerData[server_zombies];

if(zombieid + 1 >= MAX_ZOMBIES)
{
    KillTimer(ServerData[server_zombietimer]);
    printf("Number of zombies created: %i", MAX_ZOMBIES);
    return 1;
}

new type = random(4), name[MAX_PLAYER_NAME];

if(type == SPRINTER_ZOMBIE)
{
    ZombieData[zombieid][zombie_species] = SPRINTER_ZOMBIE;
}
else
{
    ZombieData[zombieid][zombie_species] = RUNNER_ZOMBIE;
}

ZombieData[zombieid][zombie_victim] = INVALID_PLAYER_ID;

format(name, sizeof(name), "Zombie_%i", zombieid + 1);
ConnectRNPC(name);

ServerData[server_zombies]++;

Last edited by Calisthenics; 07/08/2019 at 09:01 AM.
Calisthenics is offline   Reply With Quote
Old 07/08/2019, 05:16 PM   #4
Goku
Little Clucker
 
Goku's Avatar
 
Join Date: Aug 2019
Location: X, Y, Z
Posts: 16
Reputation: 0
Default Re: spaming messages idk why :/

Quote:
Originally Posted by Calisthenics View Post
Check if it reaches array size before you create another bot.
pawn Code:
new zombieid = ServerData[server_zombies];

if(zombieid + 1 >= MAX_ZOMBIES)
{
    KillTimer(ServerData[server_zombietimer]);
    printf("Number of zombies created: %i", MAX_ZOMBIES);
    return 1;
}

new type = random(4), name[MAX_PLAYER_NAME];

if(type == SPRINTER_ZOMBIE)
{
    ZombieData[zombieid][zombie_species] = SPRINTER_ZOMBIE;
}
else
{
    ZombieData[zombieid][zombie_species] = RUNNER_ZOMBIE;
}

ZombieData[zombieid][zombie_victim] = INVALID_PLAYER_ID;

format(name, sizeof(name), "Zombie_%i", zombieid + 1);
ConnectRNPC(name);

ServerData[server_zombies]++;
Code:
Number of zombies created: 100
Number of zombies created: 100
Number of zombies created: 100
Number of zombies created: 100
Number of zombies created: 100
Number of zombies created: 100
Number of zombies created: 100
Number of zombies created: 100
Number of zombies created: 100
Number of zombies created: 100
Number of zombies created: 100
Number of zombies created: 100
Number of zombies created: 100
Number of zombies created: 100
Number of zombies created: 100
Number of zombies created: 100
Number of zombies created: 100
Number of zombies created: 100
Number of zombies created: 100
Number of zombies created: 100
Number of zombies created: 100
Number of zombies created: 100
Number of zombies created: 100
Number of zombies created: 100
Number of zombies created: 100
Number of zombies created: 100
Number of zombies created: 100
Number of zombies created: 100
Number of zombies created: 100
Number of zombies created: 100
Number of zombies created: 100
Number of zombies created: 100
Number of zombies created: 100
Number of zombies created: 100
Number of zombies created: 100
Number of zombies created: 100
Number of zombies created: 100
Number of zombies created: 100
Number of zombies created: 100
Number of zombies created: 100
Number of zombies created: 100
Number of zombies created: 100
Number of zombies created: 100
Number of zombies created: 100
Number of zombies created: 100
Number of zombies created: 100
Number of zombies created: 100
Number of zombies created: 100
Number of zombies created: 100
Number of zombies created: 100
Number of zombies created: 100
Number of zombies created: 100
Number of zombies created: 100
Number of zombies created: 100
Number of zombies created: 100
Number of zombies created: 100
Number of zombies created: 100
Number of zombies created: 100
now its spaming with this message :/
__________________
Code:
public OnPlayerConnect(playerid)
{
     SendClientMessage(playerid,-1,Welcome to my server and now good bye :p);
     Kick(playerid);
     return 1;
}
Goku is offline   Reply With Quote
Old 07/08/2019, 05:19 PM   #5
Goku
Little Clucker
 
Goku's Avatar
 
Join Date: Aug 2019
Location: X, Y, Z
Posts: 16
Reputation: 0
Default Re: spaming messages idk why :/

Quote:
Originally Posted by Libbyphay View Post
PHP Code:
ServerData[server_zombies
PHP Code:
server_zombies 
It error, I think so.
what do u mean i didn't understand nothing wrong with this code i checked already any other idea
__________________
Code:
public OnPlayerConnect(playerid)
{
     SendClientMessage(playerid,-1,Welcome to my server and now good bye :p);
     Kick(playerid);
     return 1;
}
Goku is offline   Reply With Quote
Old 08/08/2019, 04:51 AM   #6
SiaReyes
Huge Clucker
 
SiaReyes's Avatar
 
Join Date: Mar 2019
Location: Coordinates X,Y,Z
Posts: 299
Reputation: 20
Default Re: spaming messages idk why :/

pawn Code:
public OnZombieCreate()
{
    RNPC_SetUpdateRate(80);

    if(ServerData[server_zombies] >= MAX_ZOMBIES)
    {
        KillTimer(ServerData[server_zombietimer]);
        printf("Number of zombies created: %i", ServerData[server_zombies]);
    }
    new name[MAX_PLAYER_NAME];
    switch(random(2))
    {
         case 0: ZombieData[server_zombies][zombie_species] = SPRINTER_ZOMBIE;
         case 1: ZombieData[server_zombies][zombie_species] = RUNNER_ZOMBIE;
    }

    ZombieData[server_zombies][zombie_victim]= INVALID_PLAYER_ID;

    format(name, sizeof(name), "Zombie_%i", server_zombies + 1);
    ConnectRNPC(name);

    ServerData[server_zombies]++;
    return 1;
}
__________________
Hey guys,
We've just started up our own hosting company and we are offering cheap game hosting. Our SAMP servers start at only $0.50 cents for 32 slots per month, or $1.50 for 64. We have ONE FREE spot left for a first month free subscription for any game host of your choice. We host most many major games such as SAMP, Call of Duty, 7 Days to Die, Minecraft, CounterStrike, ARK: Survival Evolved, and many more!

Cheapest hosting company official site : http://main-hosts.com/

Cheap Hosting Company is looking for an experience staff.

Sign up to our forums and Control Panel and order one of our cheap game servers. First to sign up will receive a free SA:MP server! Join on discord https://discord.gg/J82JgQJ for more information!

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
SiaReyes is offline   Reply With Quote
Old 08/08/2019, 07:57 AM   #7
Calisthenics
Gangsta
 
Join Date: May 2018
Posts: 662
Reputation: 96
Default Re: spaming messages idk why :/

Quote:
Originally Posted by Goku View Post
now its spaming with this message :/
The ID of the timer is wrong then.

pawn Code:
KillTimer(ServerData[server_zombietimer]);

You create a repeated timer with callback `OnZombieCreate` and store its id in ServerData[server_zombietimer]? Killing the correct timer, it should not call `OnZombieCreate` again.
Calisthenics is offline   Reply With Quote
Old 08/08/2019, 10:13 AM   #8
Mugala
High-roller
 
Mugala's Avatar
 
Join Date: Nov 2012
Location: Georgia, Tbilisi
Posts: 1,066
Reputation: 50
Default Re: spaming messages idk why :/

I don't understand what is this?
PHP Code:
printf("Number of zombies created: %i"MAX_ZOMBIES); 
doesn't makes sense for me, I think he have defined MAX_ZOMBIES, not as variable, so it'll be allways 100.
check current zombie count with other variable.
__________________
Coding in 8 languages including Pawn, C#, C++ and SQL.
Available for hiring.

If you have a coding question or need an assistance in a code, just PM me.
If you want me to create something for you, here is a Discord Mugala#5651

Currently helping Community members in a coding.
Mugala is offline   Reply With Quote
Old 08/08/2019, 11:16 AM   #9
TheToretto
Gangsta
 
TheToretto's Avatar
 
Join Date: Jul 2015
Posts: 600
Reputation: 66
Default Re: spaming messages idk why :/

Quote:
Originally Posted by Mugala View Post
I don't understand what is this?
PHP Code:
printf("Number of zombies created: %i"MAX_ZOMBIES); 
doesn't makes sense for me, I think he have defined MAX_ZOMBIES, not as variable, so it'll be allways 100.
check current zombie count with other variable.
I think @Calisthenics forgot about it, surely, should be

pawn Code:
printf("Number of zombies created: %i", zombieid + 1);
__________________






Toretto#9902

Rest in peace grandpa, 03 November 2018
TheToretto is offline   Reply With Quote
Old 08/08/2019, 01:27 PM   #10
Calisthenics
Gangsta
 
Join Date: May 2018
Posts: 662
Reputation: 96
Default Re: spaming messages idk why :/

Quote:
Originally Posted by Mugala View Post
I don't understand what is this?
PHP Code:
printf("Number of zombies created: %i"MAX_ZOMBIES); 
doesn't makes sense for me, I think he have defined MAX_ZOMBIES, not as variable, so it'll be allways 100.
check current zombie count with other variable.
Quote:
Originally Posted by TheToretto View Post
I think @Calisthenics forgot about it, surely, should be

pawn Code:
printf("Number of zombies created: %i", zombieid + 1);
It is only printed when the limit is reached (100 connected bots) and the timer is supposed to be killed. Using a constant value or a counter+1 does not make any difference.
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
[quer] spaming carl0o0s Server Support 1 23/03/2014 10:03 AM
IC chat and Commands spaming - Help! FL3GM4 Scripting Help 2 13/01/2013 01:11 AM
spaming with killing player dud Scripting Help 1 08/12/2012 08:52 PM
command spaming TouR Help Archive 14 24/02/2010 01:05 PM


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


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