This is actually a working plug-in, but so small that I decided to post it here (plus half of it isn't even done by me)
What it does: take the client name and the cmd, then execute it.
(it also requires the Slay flag, else stuff would get out of hand
)
I took the player-recognizing-thingy from the standard No-Clip plugin, so credits to whoever made that.
It can be helpful when working with bots or when you want to abuse your precious admin-powers
PHP Code:
#include <sourcemod>
#include <sdktools>
public OnPluginStart()
{
RegAdminCmd("sm_fakeclientcmd", Command_remotecmd, ADMFLAG_SLAY, "[SM] Usage: sm_remotecmd <#userid|name> <command>");
}
public Action:Command_remotecmd(client, args)
{
if (args < 1) {
ReplyToCommand(client, "[SM] Usage: sm_fakeclientcmd <#userid|name> <command>");
return Plugin_Handled;
}
else if (args < 2) {
ReplyToCommand(client, "[SM] Usage: sm_fakeclientcmd <#userid|name> <command>");
return Plugin_Handled;
}
decl String:arg[256];
decl String:cmd[256];
GetCmdArg(1, arg, sizeof(arg));
GetCmdArg(2, cmd, sizeof(cmd));
decl String:target_name[MAX_TARGET_LENGTH];
decl target_list[MAXPLAYERS], target_count, bool:tn_is_ml;
if ((target_count = ProcessTargetString(
arg,
client,
target_list,
MAXPLAYERS,
COMMAND_FILTER_ALIVE,
target_name,
sizeof(target_name),
tn_is_ml)) <= 0)
{
ReplyToCommand(client, "[SM] no matching client was found");
return Plugin_Handled;
}
for (new i = 0; i < target_count; i++)
{
FakeClientCommand(target_list[i], cmd);
}
return Plugin_Handled;
}