Code: Select all
#include < amxmodx >#include < engine >#include < cstrike >#include < fun >#include < fakemeta >#include < hamsandwich > #define FAKE_PLAYER // Bot name#if defined FAKE_PLAYER new const g_szBotName[ ] = "Patrulis";#endif #if defined FAKE_PLAYER new g_iFakeplayer;#endif // ======================================================================================= public plugin_init( ) { new const VERSION[ ] = "0.0.1"; register_plugin( "Deathrun Manager", VERSION, "xPaw" ); #if defined FAKE_PLAYER new iEntity, iCount; while( ( iEntity = find_ent_by_class( iEntity, "info_player_deathmatch" ) ) > 0 ) if( iCount++ > 1 ) break; if( iCount <= 1 ) g_iFakeplayer = -1; set_task( 5.0, "UpdateBot" ); register_message( get_user_msgid( "DeathMsg" ), "MsgDeathMsg" ); #endif} // FAKEPLAYER///////////////////////////////////////////#if defined FAKE_PLAYER public UpdateBot( ) { if( g_iFakeplayer == -1 ) return; new id = find_player( "i" ); if( !id ) { id = engfunc( EngFunc_CreateFakeClient, g_szBotName ); if( pev_valid( id ) ) { engfunc( EngFunc_FreeEntPrivateData, id ); dllfunc( MetaFunc_CallGameEntity, "player", id ); set_user_info( id, "rate", "3500" ); set_user_info( id, "cl_updaterate", "25" ); set_user_info( id, "cl_lw", "1" ); set_user_info( id, "cl_lc", "1" ); set_user_info( id, "cl_dlmax", "128" ); set_user_info( id, "cl_righthand", "1" ); set_user_info( id, "_vgui_menus", "0" ); set_user_info( id, "_ah", "0" ); set_user_info( id, "dm", "0" ); set_user_info( id, "tracker", "0" ); set_user_info( id, "friends", "0" ); set_user_info( id, "*bot", "1" ); set_pev( id, pev_flags, pev( id, pev_flags ) | FL_FAKECLIENT ); set_pev( id, pev_colormap, id ); new szMsg[ 128 ]; dllfunc( DLLFunc_ClientConnect, id, g_szBotName, "127.0.0.1", szMsg ); dllfunc( DLLFunc_ClientPutInServer, id ); cs_set_user_team( id, CS_TEAM_SPECTATOR ); ExecuteHamB( Ham_CS_RoundRespawn, id ); set_pev( id, pev_effects, pev( id, pev_effects ) | EF_NODRAW ); set_pev( id, pev_solid, SOLID_NOT ); dllfunc( DLLFunc_Think, id ); g_iFakeplayer = id; } } } public MsgDeathMsg( const iMsgId, const iMsgDest, const id ) { if( get_msg_arg_int( 2 ) == g_iFakeplayer ) return PLUGIN_HANDLED; return PLUGIN_CONTINUE; }#endif
