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

[CSGO] Get client original clan tag


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
eyal282
Veteran Member
Join Date: Aug 2011
Old 04-19-2018 , 04:13   [CSGO] Get client original clan tag
Reply With Quote #1

As the title mentions, how can I know a client's original clan tag unaffected by sourcemod?
__________________
I am available to make plugins for pay.

Discord: Eyal282#1334
eyal282 is offline
DarkDeviL
SourceMod Moderator
Join Date: Apr 2012
Old 04-19-2018 , 05:12   Re: [CSGO] Get client original clan tag
Reply With Quote #2

Quote:
Originally Posted by eyal282 View Post
As the title mentions, how can I know a client's original clan tag unaffected by sourcemod?
It won't be completely impossible to do, but I haven't yet seen a "very simple way" (e.g. a simple command) to get this information though:

Query "cl_clanid", if it returns number "4" for the Valve group, you can execute (for example via SteamWorks), a HTTP call to:

Code:
https://steamcommunity.com/gid/4
You will be re-routed to the right group URL based on the ID automatically (e.g. "/groups/VALVE").

Then you parse the HTML contents, where you see:

Code:
<div class="grouppage_header_name" style="">
				Valve				<span class="grouppage_header_abbrev" style="">[VALVᴱ]</span>
</div>
The contents of the <span> is the current "original" clan tag.

Explanation of "current": Based on my experience, it seems like either the game or the Steam client is caching some group values on start, so if you have changed your group's clan tag at 11:09 CEST, but your client started the game on 11:08 CEST or before, that client may ship the wrong clan tag to the server (but correct cl_clanid), until the next time they start the game and/or the next time they log on to Steam, so there may be situations where it wouldn't be 100% exact, but that would assume a change has been made though.
__________________
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; 04-19-2018 at 05:12.
DarkDeviL is offline
eyal282
Veteran Member
Join Date: Aug 2011
Old 04-19-2018 , 06:02   Re: [CSGO] Get client original clan tag
Reply With Quote #3

Quote:
Originally Posted by arne1288 View Post
It won't be completely impossible to do, but I haven't yet seen a "very simple way" (e.g. a simple command) to get this information though:

Query "cl_clanid", if it returns number "4" for the Valve group, you can execute (for example via SteamWorks), a HTTP call to:

Code:
https://steamcommunity.com/gid/4
You will be re-routed to the right group URL based on the ID automatically (e.g. "/groups/VALVE").

Then you parse the HTML contents, where you see:

Code:
<div class="grouppage_header_name" style="">
				Valve				<span class="grouppage_header_abbrev" style="">[VALVᴱ]</span>
</div>
The contents of the <span> is the current "original" clan tag.

Explanation of "current": Based on my experience, it seems like either the game or the Steam client is caching some group values on start, so if you have changed your group's clan tag at 11:09 CEST, but your client started the game on 11:08 CEST or before, that client may ship the wrong clan tag to the server (but correct cl_clanid), until the next time they start the game and/or the next time they log on to Steam, so there may be situations where it wouldn't be 100% exact, but that would assume a change has been made though.
I never understood how to make https calls, can you explain to me how it's done?
__________________
I am available to make plugins for pay.

Discord: Eyal282#1334
eyal282 is offline
Papero
Veteran Member
Join Date: Aug 2016
Location: Italy
Old 04-20-2018 , 09:20   Re: [CSGO] Get client original clan tag
Reply With Quote #4

You could cache the tag as soon as it get sent to the server like here: https://forums.alliedmods.net/showpo...07&postcount=6
__________________
My Plugins
SPCode


Steam: hexer504
Telegram: Hexah
Discord: Hexah#6903

If you like my work you can donate here!

Last edited by Papero; 04-23-2018 at 08:18.
Papero is offline
extremeg
Senior Member
Join Date: Dec 2012
Old 04-21-2018 , 18:15   Re: [CSGO] Get client original clan tag
Reply With Quote #5

Another way would be if you want to get the current clantag and save in a variable of the user with:

char clanTag[64];
CS_GetClientClanTag(client, clanTag, 64);
extremeg is offline
shavit
AlliedModders Donor
Join Date: Dec 2011
Location: Israel
Old 04-22-2018 , 00:52   Re: [CSGO] Get client original clan tag
Reply With Quote #6

very very very pseudo code

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

char gS_OriginalClan[MAXPLAYERS+1][32];
bool gB_SMChange = false;

public void OnPluginStart()
{
	< hook clan tag changes here > (OnClanChanged);
	< alternatively, query cl_clanid in OnClientSettingsChanged and compare to the previous value >
}

public void OnClientPutInServer(int client)
{
	CS_GetClientClanTag(client, gS_OriginalClan[client], 32);
	SetClanTag(client, ":D");
}

public void OnClanChanged(< prototype >)
{
	if(!gB_SMChange)
	{
		int client = < get client index from userid >;
		< copy clan tag to gS_OriginalClan[client] >
		
		< optional: run any action you want to run in-case you want to do something when people manually change their clan tag >
	}

	gB_SMChange = false;
}

void SetClanTag(int client, const char[] tag)
{
	gB_SMChange = true;
	CS_GetClientClanTag(client, tag);
}
fill in the missing parts, then it should change the players' clan tags to ":D" while storing the original one in gS_OriginalClan[client]
__________________
retired

Last edited by shavit; 04-22-2018 at 00:53.
shavit 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 09:38.


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