|
AMX Mod X Moderator
Join Date: Feb 2005
Location: NJ, USA
|

01-27-2009
, 11:11
Re: Create fake player or bot (problem)
|
#5
|
Quote:
Originally Posted by 4JOKE
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_ClientConnect, bot_id, "Fake_player", "127.0.0.1", ptr) dllfunc(DLLFunc_ClientPutInServer, bot_id) cs_set_user_team(bot_id, CS_TEAM_CT, CS_CT_URBAN) set_pev(bot_id, pev_effects, (pev(bot_id, pev_effects) | 128)) set_pev(bot_id, pev_solid, 0) dllfunc(DLLFunc_Spawn, bot_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]
format( szName , 5 , "xyz%2d" , random_num (10,99) ) g_BotID = engfunc(EngFunc_CreateFakeClient, szName ) if(!g_BotID) return PLUGIN_HANDLED engfunc(EngFunc_FreeEntPrivateData, g_BotID )
static szRejectReason[128] dllfunc(DLLFunc_ClientConnect, g_BotID , szName, "127.0.0.1", szRejectReason) if( !is_user_connected(g_BotID) ) return PLUGIN_HANDLED
dllfunc(DLLFunc_ClientPutInServer, g_BotID) set_pev(g_BotID,pev_spawnflags, pev(g_BotID, pev_spawnflags) | FL_FAKECLIENT) set_pev(g_BotID,pev_flags, pev(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.
|
|