AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   Fakebot Handling (Crash on start/mapchange/restart) (https://forums.alliedmods.net/showthread.php?t=82057)

XCoder 12-16-2008 12:20

Fakebot Handling (Crash on start/mapchange/restart)
 
Hello,

I hope i got the right Categorie for it...

Made my first Plugin, it's simple but not rly good coded.
I only need it to get more IQ about AMXX

My Problem:
If i'm starting the Server with this Plugin the Server crash.
If i'm starting the Server wirhout the Plugin and put it after into the list and restarting the map, the Plugin works correctly!

BUT after one more mapchange or map restart the Server crash...

I only could get the following Errors at the Console:
SZ_GetSpace: overflow without FSB_ALLOWOVERLOW set on Server Reliable Datagram

and this one until i'm starting the server with the plugin:

Segmentation fault (core dumped) $HL_CMD

I also asking <[RNT]ZODIAC> and show him my Plugin, but he also has no Idea and so i#m asking now here...

THE CODE (I'm using the newest AMXX Version for the Server)
Code:

#include <amxmodx>
#include <fakemeta>
#include <cstrike>
 
#define PLUGIN  "Sabith P.F."
#define VERSION "1.0"
#define AUTHOR  "xcoder"
 
new botteam[3]
 
static const botnames[3][] = {
        "NULL",
        "Botname 1",
        "Botname 2"
        }
 
public plugin_init()
{
        register_plugin("Sabith P.F.", "1.0", "xcoder")
        // joine bots to spectate
        createBots(3)
}
 
public plugin_end()
{
        dropBots(3)
}
 
createBots(anzahl)
{
        new bot, x
        for(x = 1; x<anzahl; x++)
        {
                //is bot in server already?
                bot = find_player("bli", botnames[x] )
                if(bot) {
                        botteam[x] = bot
                        continue
                }
               
                //bot not in server, create them.
                bot = engfunc(EngFunc_CreateFakeClient, botnames[x])
                botteam[x] = bot
                new ptr[128]
                dllfunc(DLLFunc_ClientConnect, bot, botnames[x], "127.0.0.1", ptr )
                dllfunc(DLLFunc_ClientPutInServer, bot)       
        }
}
 
dropBots(anzahl)
{
        new bot, x
        for(x = 1; x<anzahl; x++)
        {
                //is bot in server already?
                bot = find_player("bli", botnames[x] )
                if(bot) {
                        // found bot, remove him
                        new Players[32]
                        new playerCount, i, player
                        get_players(Players, playerCount, "f", botnames[x]) 
                        for (i=0; i<playerCount; i++)
                        {
                          player = Players[i]
 
                          new userid = get_user_userid(player)
                          server_cmd("kick #%d Botkick",userid)
                        }
 
                        continue
                }
 
                // no bot found...
        }
 
 
}


Hope someone knows whats wrong...
Sorry for my broken english!

YamiKaitou 12-16-2008 12:27

Re: Fakebot Handling (Crash on start/mapchange/restart)
 
Scripting Questions/Help belongs in Scripting Help. Moved

XCoder 12-16-2008 12:35

Re: Fakebot Handling (Crash on start/mapchange/restart)
 
Thanks for moving

Styles 12-16-2008 13:50

Re: Fakebot Handling (Crash on start/mapchange/restart)
 
One, check if their valid entites before removing. Second, look at FakeFull, I think there was something in there that prevented crashes. Also, I don't recommend adding 3 entities all at once on plugin_init().


All times are GMT -4. The time now is 09:06.

Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.