Thread: Optimize Code
View Single Post
Bugsy
AMX Mod X Moderator
Join Date: Feb 2005
Location: NJ, USA
Old 01-25-2020 , 11:52   Re: Optimize Code
Reply With Quote #12

There are 2 types of players involved with this, the dead human who is spectating (retrieved with get_players() using "bch" flags) and the alive player being spectated (not retrieved with get_players()). So the "bch" flags have no bearing on the alive player being spectated.

Maybe this will make it make more sense:
PHP Code:
public ShowSpecInfo()
{
    new 
iPlayers[32], iNumiSpectatoriSpectatedPlayerszName[33], iRankiMaxRankiStats[8], iBodyhits[8];
    
get_players(iPlayersiNum"bch");
    
    
iMaxRank get_statsnum();
    
    for( new 
iNum i++ )
    {
        
iSpectator iPlayers];
        
iSpectatedPlayer peviSpectator pev_iuser2 );
        
        
get_user_nameiSpectatedPlayer szName charsmaxszName ) );
        
iRank get_user_statsiSpectatedPlayer iStats iBodyhits );
        
        
set_hudmessage(180180180, -1.00.006.01.10.0,0.0, -1);
        
show_hudmessageiSpectator "Spectating [%s] | [Rank: %i / %i]" szName iRank iMaxRank );
    }

__________________

Last edited by Bugsy; 01-25-2020 at 14:25.
Bugsy is offline