Raised This Month: $51 Target: $400
 12% 

Help Getting Clan Tag [CS:GO]


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Therepower
Member
Join Date: Sep 2011
Old 01-23-2018 , 07:00   Help Getting Clan Tag [CS:GO]
Reply With Quote #1

hello,
i try to get the clan tag of a user but it does not work
the code i try:

Code:
bool	b_IsMember[MAXPLAYERS+1],

public void OnClientPutInServer(int client)
{
	b_IsMember[client] = false;
char sClan[64];
	CS_GetClientClanTag(client, sClan, sizeof(sClan));
	if (StrEqual(sClan, "blood-G") || StrEqual(sClan, "BLOOD ."))
	{
		b_IsMember[client]=true;
	}
}
CS_GetClientClanTag(client, sClan, sizeof(sClan)); returns false for some reason.
Does this even work on csgo?
Therepower is offline
8guawong
AlliedModders Donor
Join Date: Dec 2013
Location: BlackMarke7
Old 01-23-2018 , 07:26   Re: Help Getting Clan Tag [CS:GO]
Reply With Quote #2

should work in csgo
maybe try getting the on later event?
__________________
8guawong is offline
DarkDeviL
SourceMod Moderator
Join Date: Apr 2012
Old 01-23-2018 , 07:30   Re: Help Getting Clan Tag [CS:GO]
Reply With Quote #3

OnClientPutInServer is probably too early for CS_GetClientClanTag.

Try OnClientPostAdminCheck.

OnClientSettingsChanged is called every time stuff like clantag (as well as certain other things) are changed. You could also use that one, and change isMember back to FALSE if the new clantag isn't the same, etc.

E.g.:

Code:
bool	b_IsMember[MAXPLAYERS+1] = false;

public void OnClientSettingsChanged(int client)
{
	char sClan[64];
	CS_GetClientClanTag(client, sClan, sizeof(sClan));
	if (StrEqual(sClan, "blood-G") || StrEqual(sClan, "BLOOD ."))
	{
		b_IsMember[client]=true;
	}
	else
	{
		b_IsMember[client]=false;
	}
}
__________________
Mostly known as "DarkDeviL".

Dropbox FastDL: Public folder will no longer work after March 15, 2017!
For more info, see the [SRCDS Thread], or the [HLDS Thread].

Last edited by DarkDeviL; 01-23-2018 at 07:33.
DarkDeviL is offline
Therepower
Member
Join Date: Sep 2011
Old 01-23-2018 , 07:52   Re: Help Getting Clan Tag [CS:GO]
Reply With Quote #4

Quote:
Originally Posted by arne1288 View Post
OnClientPutInServer is probably too early for CS_GetClientClanTag.

Try OnClientPostAdminCheck.

OnClientSettingsChanged is called every time stuff like clantag (as well as certain other things) are changed. You could also use that one, and change isMember back to FALSE if the new clantag isn't the same, etc.

E.g.:

Code:
bool	b_IsMember[MAXPLAYERS+1] = false;

public void OnClientSettingsChanged(int client)
{
	char sClan[64];
	CS_GetClientClanTag(client, sClan, sizeof(sClan));
	if (StrEqual(sClan, "blood-G") || StrEqual(sClan, "BLOOD ."))
	{
		b_IsMember[client]=true;
	}
	else
	{
		b_IsMember[client]=false;
	}
}
i tried with player_connect_full hook but still seems not to work
Code:
    HookEventEx("player_connect_full", player_connect_full);
also thanks for the method you provided

OnClientSettingsChanged seems to be triggered when user connects if i'm right?

Last edited by Therepower; 01-23-2018 at 07:58.
Therepower is offline
PinHeaDi
Senior Member
Join Date: Jul 2013
Location: Bulgaria
Old 01-23-2018 , 11:25   Re: Help Getting Clan Tag [CS:GO]
Reply With Quote #5

PHP Code:
#include <sourcemod>
#include <cstrike>

bool b_IsMember[MAXPLAYERS+1];

public 
void OnPluginStart()
{
    
AddCommandListener(JoinTeam"jointeam");
}

public 
Action JoinTeam(int clientchar[] commandint args)
{
    
CreateTimer(0.5CheckGroupMemberclient);
}

public 
Action CheckGroupMember(Handle timerany client)
{
    
char sClan[64];
    
CS_GetClientClanTag(clientsClansizeof(sClan));
    if (
StrEqual(sClan"blood-G"true) || StrEqual(sClan"BLOOD ."true))
    {
        
b_IsMember[client]=true;
    }
    else
    {
        
b_IsMember[client]=false;
    }

Try this.
__________________
PinHeaDi is offline
Domino_
AlliedModders Donor
Join Date: Jul 2016
Old 01-24-2018 , 14:32   Re: Help Getting Clan Tag [CS:GO]
Reply With Quote #6

I would suggest using OnClientCommandKeyValues as this will be called when someone sends the clantag they're using to the server. This method also has the advantage of being able disable their membership if they remove the tag. Here I'm only using the "tag" KeyValue, but you can also use the "name" KeyValue.

PHP Code:
#include <sourcemod>

bool b_IsMember[MAXPLAYERS+1];

public 
Action OnClientCommandKeyValues(int iClientKeyValues kv)
{
    
char sCmd[PLATFORM_MAX_PATH];
    
    if(
kv.GetSectionName(sCmdsizeof(sCmd)) && StrEqual(sCmd"ClanTagChanged"false))
    {
        
char sClan[PLATFORM_MAX_PATH];
        
        if(
kv.GetString("tag"sClansizeof(sClan), ""))
        {
            if(
StrEqual(sClan"blood-G") || StrEqual(sClan"BLOOD ."))
                
b_IsMember[iClient] = true;
            else
                
b_IsMember[iClient] = false;
        }
        else
            
b_IsMember[iClient] = false;
    }
    
    return 
Plugin_Continue;

Example dumped ClanTagChanged:
Spoiler
__________________

Last edited by Domino_; 01-25-2018 at 10:25.
Domino_ is offline
Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 17:05.


Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.
Theme made by Freecode