Hello everyone.
I tried to get all the cmd args that the client will use, has that is unknown the ammount he is going to use I tried this one.
PHP Code:
#pragma semicolon 1
#define DEBUG
#define PLUGIN_AUTHOR "SpirT"
#define PLUGIN_VERSION "1.0"
char file[512];
#include <sourcemod>
#include <sdktools>
#pragma newdecls required
public Plugin myinfo =
{
name = "[SpirT] Phrase Setter",
author = PLUGIN_AUTHOR,
description = "Sets a player's phrase with a command",
version = PLUGIN_VERSION,
url = ""
};
public void OnPluginStart()
{
RegConsoleCmd("sm_phrase", Command_Phrase);
BuildPath(Path_SM, file, sizeof(file), "configs/SpirT/phrase.cfg");
char dir[512] = "addons/sourcemod/configs/SpirT";
if(!DirExists(dir))
{
CreateDirectory(dir, 511);
}
}
public void OnClientPutInServer(int client)
{
KeyValues kv = new KeyValues("SpirTPhrase");
kv.ImportFromFile(file);
char sID[32];
GetClientAuthId(client, AuthId_Steam2, sID, sizeof(sID));
if(!KvJumpToKey(kv, sID, false))
{
PrintToServer("[SpirT - Phrase Set] Player %N don't has his / her phrase set yet!", client);
}
char phrase[64];
KvGetString(kv, "phrase", phrase, sizeof(phrase));
PrintToChatAll("%N Connected: %s", client, phrase);
}
public Action Command_Phrase(int client, int args)
{
if(args > 1)
{
char phrase[128];
int phrase_args = GetCmdArgs();
GetCmdArg(phrase_args, phrase, sizeof(phrase));
KeyValues kvm = new KeyValues("SpirTPhrase");
kvm.ImportFromFile(file);
char steamID[32];
GetClientAuthId(client, AuthId_Steam2, steamID, sizeof(steamID));
if(KvJumpToKey(kvm, steamID, true))
{
char check[64];
KvGetString(kvm, "phrase", check, sizeof(check), "");
if(!StrEqual(check, phrase))
{
KvSetString(kvm, "phrase", phrase);
}
PrintToChat(client, "[SpirT - Phrase Set] Your actual phrase is the same that you're trying to set. Please try another one.");
}
}
return Plugin_Handled;
}
And when he connects instead of saying all the phrase, just prints the start!
Let's supose that phrase is "The pro is Me"
It Just's print to chat:
Code:
SpirT Connected: The
So it's just prints the first argument of the cmd. How can I get all and make in only one string to store the value?
Best Regards,
SpirT.
__________________