Senior Member
Join Date: Sep 2018
Location: Portugal
|
09-09-2019
, 15:51
Re: [HELP] Get All Cmd Args
|
#5
|
Quote:
Originally Posted by ShD3luxe
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_sID, ADMFLAG_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_SM, file, sizeof(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(dir, 511); CreateDirectory(dir_config, 511); } }
public Action Command_sID(int client, int args) { char sID[64]; GetClientAuthId(client, AuthId_Steam2, sID, sizeof(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(client, AuthId_Steam2, sID, sizeof(sID)); if(!KvJumpToKey(kv, sID, false)) { PrintToServer("[SpirT - Tag Set] Player %N don't has his / her tag set yet!", client); } char tag[64]; KvGetString(kv, "tag", tag, sizeof(tag)); CS_SetClientClanTag(client, tag); }
public Action Command_SetTag(int client, int args) { char chat[64]; GetConVarString(g_chat, chat, sizeof(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(1, tag, sizeof(tag)); KeyValues kv = new KeyValues("SpirTTags"); kv.ImportFromFile(file); char sID[32]; GetClientAuthId(client, AuthId_Steam2, sID, sizeof(sID)); if(KvJumpToKey(kv, sID, true)) { char check[64]; KvGetString(kv, "tag", check, sizeof(check), ""); if(!StrEqual(check, tag)) { KvSetString(kv, "tag", tag); CS_SetClientClanTag(client, tag); } 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(tags, sizeof(tags)); KeyValues kvm = new KeyValues("SpirTTags"); kvm.ImportFromFile(file); char steamID[32]; GetClientAuthId(client, AuthId_Steam2, steamID, sizeof(steamID)); if(KvJumpToKey(kvm, steamID, true)) { char check[64]; KvGetString(kvm, "tag", check, sizeof(check), ""); if(!StrEqual(check, tags)) { KvSetString(kvm, "tag", tags); CS_SetClientClanTag(client, tag); } 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
|
|