AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   Problem with BOT (https://forums.alliedmods.net/showthread.php?t=84145)

padilha007 01-21-2009 11:11

Problem with BOT
 
1 Attachment(s)
i creat a bot to prevent round end, but dont work 100%

PHP Code:

    new g_oldbotname[32]
        
    static 
botname[32]
    
formatexbotname31"BOT")
    
// Skip Real Players
    
new id find_player("ia"botname)

    if( !
equali(botnameg_oldbotname) )
    {
        if( 
is_user_connected(g_oldbotidct) && is_user_bot(g_oldbotidct) )
        {
            
set_user_info(g_oldbotidct"name"botname)
            return;
        }
    }
    
    
g_oldbotidct id engfunc(EngFunc_CreateFakeClientbotname)
        
    
g_oldbotname botname
        
    
if( pev_validid ) )
    {
        
engfuncEngFunc_FreeEntPrivateDataid)
        
dllfuncMetaFunc_CallGameEntity"player"id)
        
set_user_infoid"rate""3500" )
        
set_user_infoid"cl_updaterate""25" )
        
set_user_infoid"cl_lw""1" )
        
set_user_infoid"cl_lc""1" )
        
set_user_infoid"cl_dlmax""128" )
        
set_user_infoid"cl_righthand""1" )
        
set_user_infoid"_vgui_menus""0" )
        
set_user_infoid"_ah""0" )
        
set_user_infoid"dm""0" )
        
set_user_infoid"tracker""0" )
        
set_user_infoid"friends""0" )
        
set_user_infoid"*bot""1" )
        
set_pevidpev_flagspevidpev_flags ) | FL_FAKECLIENT )
        
set_pevidpev_colormapid )
            
        new 
msg[128]
        
        
dllfuncDLLFunc_ClientConnectidbotname"127.0.0.1"msg )
        
dllfuncDLLFunc_ClientPutInServerid )
        
engfuncEngFunc_RunPlayerMoveidFloat:{0.0,0.0,0.0}, 0.00.00.00076 )
        
        
set_pev(idpev_takedamageDAMAGE_NO)
        
        
dllfunc(DLLFunc_Spawnid


Dores 01-21-2009 11:37

Re: Problem with BOT
 
I think that the is_user_bot() native is only for CZ bots.

Dr.G 01-21-2009 11:45

Re: Problem with BOT
 
Quote:

2) I think that the is_user_bot() native is only for CZ bots.
Works for DoD.. so i thinks its... for bots :)

padilha007 01-21-2009 11:46

Re: Problem with BOT
 
i need use my code

Dores 01-21-2009 13:39

Re: Problem with BOT
 
Quote:

Originally Posted by Dr.G (Post 747621)
Works for DoD.. so i thinks its... for bots :)

Yeah but not self made bots, but hardcoded game bots...

ConnorMcLeod 01-21-2009 14:29

Re: Problem with BOT
 
I think is_user_bot should work, but you have to update the bot each frame (FM_StartFrame), even if you don't plain to use this native.

PHP Code:

public StartFrame()
{
    if(
g_iBot && pev_valid(g_iBot))
    {
        static 
Float:fMSec
        set_pev
(g_iBotpev_flagspev(g_iBotpev_flags) | FL_FAKECLIENT)
        
global_get(glb_frametimefMSec)
        
fMSec *= 1000.0
        engfunc
(EngFunc_RunPlayerMoveg_iBotFloat:{0.0,0.0,0.0}, 0.00.00.000floatround(fMSec))
    }



Dores 01-21-2009 14:46

Re: Problem with BOT
 
@padilha: Did you make it think often?

padilha007 01-21-2009 17:01

Re: Problem with BOT
 
no =z

Dores 01-22-2009 08:00

Re: Problem with BOT
 
Quote:

Originally Posted by padilha007 (Post 747808)
no =z

I'm not sure you must make it think, but do what Connor said(update it every frame).

padilha007 01-22-2009 10:50

Re: Problem with BOT
 
@ConnorMcLeod
I just add this to work perfect:
PHP Code:

public StartFrame()
{
    if(
g_iBot && pev_valid(g_iBot) && is_user_connected(g_iBot) && is_user_alive(g_iBot))
    {
        static 
Float:fMSec
        set_pev
(g_iBotpev_flagspev(g_iBotpev_flags) | FL_FAKECLIENT)
        
global_get(glb_frametimefMSec)
        
fMSec *= 1000.0
        engfunc
(EngFunc_RunPlayerMoveg_iBotFloat:{0.0,0.0,0.0}, 0.00.00.000floatround(fMSec))
    }




All times are GMT -4. The time now is 01:48.

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