Junior Member
|
08-06-2019
, 11:05
Play as BOT
|
#1
|
Hello, I am looking for a plugin that allows you to equip any bot while you are spectating him. It will kill him and spawn you right at where he died. But I have to get his aim (where is he looking), his ammo (bpammo and clipammo), his gun, and his position (I tried it with origin but it sucks), and thatīs the problem. I got these, but it isnīt even spawning a player that presses R while spectating a bot. And when it spawned me, I got stuck to the wall because kill function threw his dead body away.
Code:
new g_MaxClients
new hudsync
new botaim, botammo, bothp, botap, botweap, botorigin[ 33 ]
new num
new Float:vViewAngles[3];
new g_iOrigin[ 33 ][ 3 ], g_iAimOrigin[ 33 ][ 3 ]
public plugin_init()
{
register_plugin(PLUGIN, VERSION, AUTHOR)
register_forward( FM_CmdStart , "fw_CmdStart" )
g_MaxClients = get_maxplayers();
hudsync = CreateHudSyncObj()
set_task(1.0, "show_hud", 0, "", 0, "b")
}
public show_hud()
{
static i
new iSpecPlayer = entity_get_int(i, EV_INT_iuser2)
for ( i = 1; i <= g_MaxClients; i++ )
{
if( cs_get_user_team( i ) == cs_get_user_team( iSpecPlayer ) )
{
if( !is_user_alive( i ) && is_user_alive( iSpecPlayer ) )
{
set_hudmessage(255,255,255, -1.2, -1.0, 0, 1.0, 1.0, 0.1, 0.2, -1)
ShowSyncHudMsg(i, hudsync, "Press R to play as a bot")
}
}
}
}
public GetUserInfo()
{
static id
new iSpecPlayer = entity_get_int(id, EV_INT_iuser2)
if( cs_get_user_team( id ) == cs_get_user_team( iSpecPlayer ) )
{
for ( id = 1; id <= g_MaxClients; id++ )
{
if( is_user_bot( iSpecPlayer ) )
{
bothp = get_user_health( iSpecPlayer )
botap = get_user_armor( iSpecPlayer )
new clip,ammo
botweap = get_user_weapon( iSpecPlayer )
switch( botweap )
{
case CSW_MP5NAVY:
{
get_user_ammo(iSpecPlayer,CSW_MP5NAVY,clip,ammo)
}
case CSW_UMP45:
{
get_user_ammo(iSpecPlayer,CSW_UMP45,clip,ammo)
}
case CSW_AK47:
{
get_user_ammo(iSpecPlayer,CSW_AK47,clip,ammo)
}
case CSW_M4A1:
{
get_user_ammo(iSpecPlayer,CSW_M4A1,clip,ammo)
}
case CSW_FAMAS:
{
get_user_ammo(iSpecPlayer,CSW_FAMAS,clip,ammo)
}
case CSW_AWP:
{
get_user_ammo(iSpecPlayer,CSW_AWP,clip,ammo)
}
case CSW_P90:
{
get_user_ammo(iSpecPlayer,CSW_P90,clip,ammo)
}
case CSW_AUG:
{
get_user_ammo(iSpecPlayer,CSW_AUG,clip,ammo)
}
case CSW_GALIL:
{
get_user_ammo(iSpecPlayer,CSW_GALIL,clip,ammo)
}
case CSW_M249:
{
get_user_ammo(iSpecPlayer,CSW_M249,clip,ammo)
}
case CSW_MAC10:
{
get_user_ammo(iSpecPlayer,CSW_MAC10,clip,ammo)
}
case CSW_GLOCK18:
{
get_user_ammo(iSpecPlayer,CSW_GLOCK18,clip,ammo)
}
case CSW_DEAGLE:
{
get_user_ammo(iSpecPlayer,CSW_DEAGLE,clip,ammo)
}
case CSW_ELITE:
{
get_user_ammo(iSpecPlayer,CSW_ELITE,clip,ammo)
}
case CSW_FIVESEVEN:
{
get_user_ammo(iSpecPlayer,CSW_FIVESEVEN,clip,ammo)
}
case CSW_G3SG1:
{
get_user_ammo(iSpecPlayer,CSW_G3SG1,clip,ammo)
}
case CSW_USP:
{
get_user_ammo(iSpecPlayer,CSW_USP,clip,ammo)
}
}
g_iOrigin[ id ][ 0 ] = 0
user_kill( iSpecPlayer, 1 )
botammo = ammo
get_user_origin( iSpecPlayer, g_iAimOrigin[ iSpecPlayer ], 3 )
get_user_origin( iSpecPlayer, g_iOrigin[ iSpecPlayer ], 0 )
}
}
}
}
public use_bot( id )
{
// SPAWN
ExecuteHamB(Ham_CS_RoundRespawn, id)
//SET BOT STATUS
set_user_origin( id, g_iOrigin[ id ] )
set_user_origin( id, g_iAimOrigin[ id ] )
//set_pev(id, pev_v_angle, vViewAngles)
//set_pev(id, pev_fixangle, 1)
set_user_health( id, bothp )
set_user_armor( id, botap )
}
public fw_CmdStart( id, Handle )
{
static iButtons
iButtons = get_uc( Handle , UC_Buttons )
if( ( iButtons & IN_RELOAD ) ) {
if( !is_user_alive( id ) && !is_user_bot( id ) ) {
GetUserInfo()
set_task( 0.2, "use_bot", id )
}
else {
return 0
}
}
}
Last edited by hsky; 08-06-2019 at 11:07.
|
|