View Single Post
lingzhidiyu
Senior Member
Join Date: Mar 2014
Old 02-29-2016 , 13:09   Re: [CS:GO] Getting team name
Reply With Quote #9

PHP Code:
public void OnPluginStart() {
    
RegConsoleCmd("sm_ptm"Command_PrintTeamName"This is a command"ADMFLAG_ROOT);
}

    
public 
Action Command_PrintTeamName(int clientint args) {
    
int teamIndex_T = -1teamIndex_CT = -1;

    
int index = -1;
    while ((
index FindEntityByClassname(index"cs_team_manager")) != -1) {
        
int teamNum GetEntProp(indexProp_Send"m_iTeamNum");
        if (
teamNum == CS_TEAM_T) {
            
teamIndex_T index;
        } else if (
teamNum == CS_TEAM_CT) {
            
teamIndex_CT index;
        }
    }

    if (
teamIndex_T == -|| teamIndex_CT == -1) {
        
PrintToChatAll("404 not found");
        return;
    }

    
char teamName_T[32];
    
GetEntPropString(teamIndex_TProp_Send"m_szClanTeamname"teamName_T32);
    
char teamName_CT[32];
    
GetEntPropString(teamIndex_CTProp_Send"m_szClanTeamname"teamName_CT32);

    
PrintToChatAll("T: %s"teamName_T);
    
PrintToChatAll("CT: %s"teamName_CT);
    
PrintToChatAll(" \x04Done");

lingzhidiyu is offline