Raised This Month: $ Target: $400
 0% 

[CS:GO] Store client clantag on connect, How to?


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
DSASDFGH
Senior Member
Join Date: Jul 2011
Location: Facebook
Old 04-10-2016 , 06:50   [CS:GO] Store client clantag on connect, How to?
Reply With Quote #1

Hi, I'm trying store clients clantag on global variable, but it does not appear, What were wrong with below code?

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

new String:clan[MAXPLAYERS+1][16];

public 
OnPluginStart()
{
    
RegConsoleCmd("sm_test"Clcmd_Test);
}

public 
OnClientPutInServer(id)
{
    
CreateTimer(0.5Delayid);
}

public 
Action:Delay(Handle:Timerid)
{
    
CS_GetClientClanTag(idclan[id], sizeof(clan[]));
}

public 
Action:Clcmd_Test(idargs)
{
        
// Not appear anything
    
PrintToChatAll("Cached Player Clan Tag: %s"clan[id]);
    
        
// Appear client tag
    
decl String:nowclan[32];
    
CS_GetClientClanTag(idnowclansizeof(nowclan));
    
PrintToChatAll("Direct Player Clan Tag: %s"nowclan);

__________________
Learning SourceMod is happy
DSASDFGH is offline
Bacardi
Veteran Member
Join Date: Jan 2010
Location: mom's basement
Old 04-10-2016 , 07:21   Re: [CS:GO] Store client clantag on connect, How to?
Reply With Quote #2

simply, you are trying get clan tag value too soon after player have joined server.

Try this
PHP Code:
public OnPluginStart()
{
    
HookEventEx("player_connect_full"player_connect_full);
}

public 
player_connect_full(Event:event, const String:name[], bool:dontBroadcast)
{
    new 
client GetEventInt(event"userid");

    new 
String:clan[32];
    
CS_GetClientClanTag(GetClientOfUserId(client), clansizeof(clan));
    
PrintToServer("Player %N Clan Tag: %s"clientclan);

__________________
Do not Private Message @me
Bacardi is offline
DSASDFGH
Senior Member
Join Date: Jul 2011
Location: Facebook
Old 04-10-2016 , 07:26   Re: [CS:GO] Store client clantag on connect, How to?
Reply With Quote #3

Quote:
Originally Posted by Bacardi View Post
simply, you are trying get clan tag value too soon after player have joined server.

Try this
PHP Code:
public OnPluginStart()
{
    
HookEventEx("player_connect_full"player_connect_full);
}

public 
player_connect_full(Event:event, const String:name[], bool:dontBroadcast)
{
    new 
client GetEventInt(event"userid");

    new 
String:clan[32];
    
CS_GetClientClanTag(GetClientOfUserId(client), clansizeof(clan));
    
PrintToServer("Player %N Clan Tag: %s"clientclan);

Thanks you it works!!
__________________
Learning SourceMod is happy
DSASDFGH 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 08:09.


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