SA-MP Forums

SA-MP Forums (https://forum.sa-mp.com/index.php)
-   Scripting Help (https://forum.sa-mp.com/forumdisplay.php?f=12)
-   -   spaming messages idk why (https://forum.sa-mp.com/showthread.php?t=668520)

Goku 06/08/2019 11:54 PM

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 :cool:

Libbyphay 07/08/2019 05:32 AM

Re: spaming messages idk why :/
 
PHP Code:

ServerData[server_zombies

PHP Code:

server_zombies 

It error, I think so.

Calisthenics 07/08/2019 09:26 AM

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]++;

Goku 07/08/2019 06:16 PM

Re: spaming messages idk why :/
 
Quote:

Originally Posted by Calisthenics (Post 4109166)
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 :/ :confused:

Goku 07/08/2019 06:19 PM

Re: spaming messages idk why :/
 
Quote:

Originally Posted by Libbyphay (Post 4109154)
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 :confused::confused:

SiaReyes 08/08/2019 05:51 AM

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;
}

Calisthenics 08/08/2019 08:57 AM

Re: spaming messages idk why :/
 
Quote:

Originally Posted by Goku (Post 4109209)
now its spaming with this message :/ :confused:

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.

Mugala 08/08/2019 11:13 AM

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.

TheToretto 08/08/2019 12:16 PM

Re: spaming messages idk why :/
 
Quote:

Originally Posted by Mugala (Post 4109285)
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);

Calisthenics 08/08/2019 02:27 PM

Re: spaming messages idk why :/
 
Quote:

Originally Posted by Mugala (Post 4109285)
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 (Post 4109294)
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.


All times are GMT. The time now is 03:13 AM.

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