View Single Post
WaLkMaN
Senior Member
Join Date: Oct 2010
Location: Varna, Bulgaria
Old 07-02-2023 , 10:05   Re: Force observing a team as spectator
Reply With Quote #8

Quote:
Originally Posted by Natsheh View Post
there.....
A small edit:

Code:
#include <amxmodx> #include <reapi> public plugin_init() {     register_plugin("Force Spectate", "1.0", "Alliedmods");         RegisterHookChain(RG_CBasePlayer_Observer_IsValidTarget, "Observer_IsValidTarget_Pre", .post = false); } public Observer_IsValidTarget_Pre(const this, const iTarget, const bool:bOnlyTeam) {     static players[32], pnum;     get_players(players, pnum, "ahe", "CT");         static currentPlayerId = 0;     if ( !iTarget || ( is_user_alive(iTarget) && get_member(iTarget, m_iTeam) != TEAM_CT ) )     {         if (pnum > 0)         {             if (currentPlayerId >= pnum)             {                 currentPlayerId = 0             }             SetHookChainArg(2, ATYPE_INTEGER, players[currentPlayerId]);             SetHookChainArg(3, ATYPE_BOOL, false);                         currentPlayerId++;         }     } }
__________________

Last edited by WaLkMaN; 07-04-2023 at 08:19. Reason: Removed fakemeta and cstrike natives
WaLkMaN is offline