AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   [ Solved ] server crush (https://forums.alliedmods.net/showthread.php?t=74523)

xPaw 07-20-2008 12:44

[ Solved ] server crush
 
my plugin crushes server, why ?

PHP Code:

#include <amxmodx>
#include <fakemeta>
#include <cstrike>

//Set botname here.
#define BOTNAME "botname here"

public plugin_init() 
{
    
register_plugin("FakePlayer""1.0""xPaw")

    
createBot()
}

public 
createBot()
{
    new 
bot;
    
        
//is bot in server already?
        
bot find_player("bi"BOTNAME)
        if(
bot) {
            return 
PLUGIN_HANDLED
        
}
        
        
//bot not in server, create them.
        
bot engfunc(EngFunc_CreateFakeClientBOTNAME)
        new 
ptr[128];
        
dllfunc(DLLFunc_ClientConnectbotBOTNAME"127.0.0.1"ptr)
        
dllfunc(DLLFunc_ClientPutInServerbot)
        
cs_set_user_team(botCS_TEAM_SPECTATORCS_DONTCHANGE)

        return 
PLUGIN_CONTINUE



atomen 07-20-2008 13:42

Re: server crush
 
Donno, I know that your bot creation code should work on 1.76d.
Though something was changed with 1.8.0 which made the server crash.

This has happened to me before when I attempted to create fake players.

Look at Jim_Yangs bot plugin, no round end.

xPaw 07-21-2008 08:07

Re: server crush
 
how i can fix it ?

atomen 07-21-2008 08:30

Re: server crush
 
Quote:

Originally Posted by atomen (Post 655604)
[...]

Look at Jim_Yangs bot plugin, no round end.

Jim_Yang is creating bots in his plugin which doesn't crash the server. therefore I told you to look how he did it in his code.

xPaw 07-21-2008 10:01

Re: server crush
 
i look'd his code, and his bot like my bot :(

atomen 07-21-2008 10:25

Re: server crush
 
It's crashing because you are creating it in plugin initialization.
Create it with a command or some function like client_connect.

xPaw 07-21-2008 15:13

Re: server crush
 
thanks! i made it with
PHP Code:

set_task(5.0"createBot"

works fine !:)


All times are GMT -4. The time now is 05:31.

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