View Single Post
SpirT
Senior Member
Join Date: Sep 2018
Location: Portugal
Old 09-09-2019 , 15:51   Re: [HELP] Get All Cmd Args
Reply With Quote #5

Quote:
Originally Posted by ShD3luxe View Post
You can try like this :
Code:
int iargs = GetCmdArgs();
char phrase[128],argPhrase[24];
for(int i = 1;i <= iargs;i++)
{
	GetCmdArg(i,argPhrase,sizeof(argPhrase));
	StrCat(phrase,sizeof(phrase),argPhrase);
}
But the GetCmdArgString should worked , try putting some debugging messages , you may store the keyvalue wrong.
KeyValues is like that
Code:
"SpirTPhrase"
{
	"STEAM_0:1:419435558"
	{
		"tag"	"This is SpirT Message"
	}
}
but with the command it is not storing the value on the kv. I'll put down the Tags version that I'm trying to fix to

EDIT: With the command !phrase This is a test phrase when spirt join And it doesn't changes the value of the Kv, it stays the same! (Value is on the file because I created it!)

PHP Code:
#pragma semicolon 1

#define DEBUG

#define PLUGIN_AUTHOR "SpirT"
#define PLUGIN_VERSION "1.0"

char file[512];

#include <sourcemod>
#include <sdktools>
#include <cstrike>

ConVar g_enabled;
ConVar g_chat;

#pragma newdecls required

public Plugin myinfo 
{
    
name "[SpirT] ClanTag Setter",
    
author PLUGIN_AUTHOR,
    
description "Sets a player's tag with a command",
    
version PLUGIN_VERSION,
    
url ""
};

public 
void OnPluginStart()
{
    
RegConsoleCmd("sm_settag"Command_SetTag);
    
RegAdminCmd("sm_sid"Command_sIDADMFLAG_ROOT);
    
    
g_enabled CreateConVar("sm_spirt_tags_enable""1""Enable / Disable all plugin features");
    
g_chat CreateConVar("sm_spirt_tags_chat""[SpirT - Tag Set]""Chat's tag for all the plugin messages");
    
    
AutoExecConfig(true"spirt_tags""SpirT");
    
    
BuildPath(Path_SMfilesizeof(file), "configs/SpirT/tags.cfg");
    
char dir[512] = "addons/sourcemod/configs/SpirT";
    
char dir_config[512] = "cfg/SpirT";
    if(!
DirExists(dir) && !DirExists(dir_config))
    {
        
CreateDirectory(dir511);
        
CreateDirectory(dir_config511);
    }
}

public 
Action Command_sID(int clientint args)
{
    
char sID[64];
    
GetClientAuthId(clientAuthId_Steam2sIDsizeof(sID));
    
PrintToChat(client"Ur SteamID: %s"sID);
    return 
Plugin_Handled;
}

public 
void OnClientPutInServer(int client)
{
    
KeyValues kv = new KeyValues("SpirTTags");
    
kv.ImportFromFile(file);
    
    
char sID[32];
    
GetClientAuthId(clientAuthId_Steam2sIDsizeof(sID));
    
    if(!
KvJumpToKey(kvsIDfalse))
    {
        
PrintToServer("[SpirT - Tag Set] Player %N don't has his / her tag set yet!"client);
    }
    
    
char tag[64];
    
KvGetString(kv"tag"tagsizeof(tag));
    
CS_SetClientClanTag(clienttag);
}

public 
Action Command_SetTag(int clientint args)
{
    
char chat[64];
    
GetConVarString(g_chatchatsizeof(chat));
    
int enabled GetConVarInt(g_enabled);
    if(
enabled 1)
    {
        
PrintToServer("[SpirT] ConVar sm_spirt_tags_enable is set to 0 or the value is not higher than 1. Please change value to activate!");
        return 
Plugin_Handled;
    }
    
    if(
args 1)
    {
        
ReplyToCommand(client"%s Use: sm_settag <tag_you_want>"chat);
        return 
Plugin_Handled;
    }
    
    
char tag[64];
    
GetCmdArg(1tagsizeof(tag));
    
    
KeyValues kv = new KeyValues("SpirTTags");
    
kv.ImportFromFile(file);
    
    
char sID[32];
    
GetClientAuthId(clientAuthId_Steam2sIDsizeof(sID));
    
    if(
KvJumpToKey(kvsIDtrue))
    {
        
char check[64];
        
KvGetString(kv"tag"checksizeof(check), "");
        
        if(!
StrEqual(checktag))
        {
            
KvSetString(kv"tag"tag);
            
CS_SetClientClanTag(clienttag);
        }
        
PrintToChat(client"%s Your actual tag is the same that you're trying to set. Please try another one."chat);
    }
    
    else if(
args 1)
    {
        
char tags[128];
        
GetCmdArgString(tagssizeof(tags));
        
        
KeyValues kvm = new KeyValues("SpirTTags");
        
kvm.ImportFromFile(file);
        
        
char steamID[32];
        
GetClientAuthId(clientAuthId_Steam2steamIDsizeof(steamID));
        
        if(
KvJumpToKey(kvmsteamIDtrue))
        {
            
char check[64];
            
KvGetString(kvm"tag"checksizeof(check), "");
        
            if(!
StrEqual(checktags))
            {
                
KvSetString(kvm"tag"tags);
                
CS_SetClientClanTag(clienttag);
            }
            
PrintToChat(client"%s Your actual tag is the same that you're trying to set. Please try another one."chat);
        }
    }
    
    return 
Plugin_Handled;

__________________

Last edited by SpirT; 09-10-2019 at 08:45. Reason: More details about the issue
SpirT is offline