Raised This Month: $ Target: $400
 0% 

[ Solved ] server crush


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
xPaw
Retired AMX Mod X Moderator
Join Date: Jul 2008
Old 07-20-2008 , 12:44   [ Solved ] server crush
Reply With Quote #1

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


Last edited by xPaw; 08-26-2008 at 09:05.
xPaw is offline
atomen
Veteran Member
Join Date: Oct 2006
Location: Stockholm, Sweden
Old 07-20-2008 , 13:42   Re: server crush
Reply With Quote #2

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.
__________________
atomen is offline
Send a message via MSN to atomen
xPaw
Retired AMX Mod X Moderator
Join Date: Jul 2008
Old 07-21-2008 , 08:07   Re: server crush
Reply With Quote #3

how i can fix it ?
xPaw is offline
atomen
Veteran Member
Join Date: Oct 2006
Location: Stockholm, Sweden
Old 07-21-2008 , 08:30   Re: server crush
Reply With Quote #4

Quote:
Originally Posted by atomen View Post
[...]

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.
__________________
atomen is offline
Send a message via MSN to atomen
xPaw
Retired AMX Mod X Moderator
Join Date: Jul 2008
Old 07-21-2008 , 10:01   Re: server crush
Reply With Quote #5

i look'd his code, and his bot like my bot
xPaw is offline
atomen
Veteran Member
Join Date: Oct 2006
Location: Stockholm, Sweden
Old 07-21-2008 , 10:25   Re: server crush
Reply With Quote #6

It's crashing because you are creating it in plugin initialization.
Create it with a command or some function like client_connect.
__________________
atomen is offline
Send a message via MSN to atomen
xPaw
Retired AMX Mod X Moderator
Join Date: Jul 2008
Old 07-21-2008 , 15:13   Re: server crush
Reply With Quote #7

thanks! i made it with
PHP Code:
set_task(5.0"createBot"
works fine !
xPaw is offline
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

Forum Jump


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


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