Raised This Month: $ Target: $400
 0% 

Create fake player or bot (problem)


  
 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
Bugsy
AMX Mod X Moderator
Join Date: Feb 2005
Location: NJ, USA
Old 01-27-2009 , 11:11   Re: Create fake player or bot (problem)
Reply With Quote #5

Quote:
Originally Posted by 4JOKE View Post
This is my function to create fake player which I have found somewhere in this forum:
PHP Code:
new bot_id engfunc(EngFunc_CreateFakeClient"Fake_player")
new 
ptr[128]
dllfunc(DLLFunc_ClientConnectbot_id"Fake_player""127.0.0.1"ptr)
dllfunc(DLLFunc_ClientPutInServerbot_id)
cs_set_user_team(bot_idCS_TEAM_CTCS_CT_URBAN)
set_pev(bot_idpev_effects, (pev(bot_idpev_effects) | 128))
set_pev(bot_idpev_solid0)
dllfunc(DLLFunc_Spawnbot_id
The problem is, that when I create and put bot to server, he is invisible until I attack him. And when he is visible, he is not on floor, he is like flying.

I have function in my plugin which saves position of player and after few seconds it will create fake player on previous original player position. So I need to create there fake player which will be standing (not moving/flying..etc) as normal player.

Thnx.
This is working code from my aimbot detection plugin. I think all you may need is the set_user_rendering line. You will need fakemeta_util for the fm_set_user_rendering cmd. Fun module has set_user_rendering.

PHP Code:
new g_BotID

public AddBot()
{        
    new 
szTeam[2]
    new 
szName[6]

    
formatszName "xyz%2d" random_num (10,99) )
    
g_BotID engfunc(EngFunc_CreateFakeClientszName )
    
    if(!
g_BotID
        return 
PLUGIN_HANDLED
    
    engfunc
(EngFunc_FreeEntPrivateDatag_BotID )

    static 
szRejectReason[128]
    
dllfunc(DLLFunc_ClientConnectg_BotID szName"127.0.0.1"szRejectReason)
    
    if( !
is_user_connected(g_BotID) ) 
        return 
PLUGIN_HANDLED

    dllfunc
(DLLFunc_ClientPutInServerg_BotID)
    
set_pev(g_BotID,pev_spawnflagspev(g_BotIDpev_spawnflags) | FL_FAKECLIENT)
    
set_pev(g_BotID,pev_flagspev(g_BotID,pev_flags) | FL_FAKECLIENT)

    
//Bot created, assign to appropriate team. 
    //format( szTeam , 1 , "%d" , (fm_cs_get_user_team( g_PlayerToWatch ) == CS_TEAM_T) ? CS_TEAM_CT : CS_TEAM_T ) 
    //engclient_cmd(g_BotID, "jointeam", szTeam)
    //engclient_cmd(g_BotID, "joinclass", "1")
    
    //Spawn bot
    
fm_user_spawn(g_BotID)
    
    
//Uncomment this line to make bot invisible
    //fm_set_rendering(g_BotID, kRenderFxNone, 0, 0, 0, kRenderTransAlpha,0)

    //Render fake player normal
    //Comment out below if using the above invisible line
    
fm_set_user_rendering(g_BotID,kRenderFxGlowShell,0,0,0,kRenderNormal,25

    return 
PLUGIN_HANDLED

__________________

Last edited by Bugsy; 01-27-2009 at 11:15.
Bugsy is offline
 



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 01:44.


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