View Single Post
backwards
AlliedModders Donor
Join Date: Feb 2014
Location: USA
Old 01-29-2019 , 10:01   Re: access to CSS scoreboard
Reply With Quote #2

I threw this together really fast, not sure if it will work or not as I haven't tried compiling even. There may be a function for this already but if not this is how i would do it from scratch.

PHP Code:
new g_iScoreOffset;

public 
OnPluginStart()
{
    
g_iScoreOffset FindSendPropInfo("CCSPlayerResource""m_iScore");
}

int GetPlayerTopOfScoreBoard(int team)
{
    new 
maxvaluefoundleader 0;
    for(new 
i=1;i<=MaxClients;i++)
    {
        if(
IsClientInGame(i) && GetClientTeam(i) == team)
        {
            
int value GetEntData(g_iPlayerManagerg_iScoreOffset + (4), 4);
            if(
value maxvaluefound)
            {
                
leader i;
                
maxvaluefound value;
            }
        }
    }
    return 
leader;
}

GetPlayerTopOfScoreBoard(CS_TEAM_CT); 
__________________
I highly recommend joining the SourceMod Discord Server for real time support.
backwards is offline