View Single Post
decowboy
AlliedModders Donor
Join Date: Oct 2015
Location: Guadalajara, Mexico
Old 02-26-2016 , 06:57   Re: [CS:GO] Getting team name
Reply With Quote #7

Thanks for chipping in guys.

For anyone stumbling on this thread at a later time, I though I'd post the code I have so far.
This snippet checks whether all non-bots in a team have the same clan tag and if so, it stores that clan tag in a string.

Code:
    int team = CS_TEAM_T; //for example

    char name[65];
    bool found = false;
    bool match = true;
    
    for (int i=1; i<=MaxClients; i++) {
        if (IsClientConnected(i) && IsClientInGame(i) && !IsFakeClient(i)) {
            if (GetClientTeam(i) == team) {
                char newname[65];
                CS_GetClientClanTag(i, newname, sizeof(newname));
                if (newname[0] != EOS) {
                    if (found) {
                        if (!StrEqual(name, newname)) {
                            match = false;
                        }
                    } else {
                        found = true;
                        strcopy(name, sizeof(name), newname);
                    }
                }
            }
        }
    }
    
    if (found && match) {
        // bla bla do something
    }
decowboy is offline