Quote:
Originally Posted by whosyourdaddy
how can i spawn like a fake player behind me, like it will look like a normal player where if u run into it u will stop, it can take damage, and has a gun in its hand
|
Below is from my Aimbot Detection plugin (link in sig).
PHP Code:
//not sure if you will need all of these
#include <amxmodx>
#include <amxmisc>
#include <fakemeta>
#include <fakemeta_util>
#include <hamsandwich>
new g_BotID
public AddBot()
{
new szTeam[2]
new szName[33]
format(szName , 32 , "FakePlayer" )
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)
//Set the bot to a team
format( szTeam , 1 , "%d" , CS_TEAM_CT)
engclient_cmd(g_BotID, "jointeam", szTeam)
engclient_cmd(g_BotID, "joinclass", "1")
//Spawn bot
fm_user_spawn(g_BotID)
//Make our bot appear as a spectator on scoreboard
message_begin(MSG_ALL, get_user_msgid("TeamInfo") , _, 0)
write_byte(g_BotID)
write_string("SPECTATOR")
message_end()
return PLUGIN_HANDLED
}
There are also forwards in the source to detect when the player gets shot\killed.
PHP Code:
RegisterHam(Ham_Killed, "player", "func_Ham_Killed_Player")
RegisterHam(Ham_TakeDamage, "player" , "func_Ham_TakeDamage")
To get it placed behind you, you will need to use get\set origin along with some coordinate manipulation.
__________________