-
Notifications
You must be signed in to change notification settings - Fork 0
/
kiwi-cexec.sp
73 lines (63 loc) · 2.1 KB
/
kiwi-cexec.sp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
#include <sourcemod>
#pragma semicolon 1
#define PLUGIN_VERSION "1.0.3"
public Plugin:myinfo =
{
name = "[KIWI] Client Command Runner",
author = "drop",
description = "Execute commands on clients remotely",
version = PLUGIN_VERSION,
url = "https://kiir.us"
};
public OnPluginStart ()
{
//CreateConVar ("sm_cexec_version", PLUGIN_VERSION, "Client Exec version", FCVAR_PLUGIN | FCVAR_SPONLY | FCVAR_REPLICATED | FCVAR_NOTIFY);
/* register the sm_cexec console command */
RegAdminCmd ("sm_cexec", ClientExec, ADMFLAG_RCON);
}
public Action:ClientExec (client, args)
{
decl String:szClient[MAX_NAME_LENGTH] = "";
decl String:szCommand[80] = "";
static iClient = -1, iMaxClients = 0;
iMaxClients = GetMaxClients();
if (args == 2)
{
GetCmdArg (1, szClient, sizeof (szClient));
GetCmdArg (2, szCommand, sizeof (szCommand));
if (!strcmp (szClient, "#all", false))
{
for (iClient = 1; iClient <= iMaxClients; iClient++)
{
if (IsClientConnected (iClient) && IsClientInGame (iClient))
{
if (IsFakeClient (iClient))
FakeClientCommand (iClient, szCommand);
else
ClientCommand (iClient, szCommand);
}
}
}
else if (!strcmp (szClient, "#bots", false))
{
for (iClient = 1; iClient <= iMaxClients; iClient++)
{
if (IsClientConnected (iClient) && IsClientInGame (iClient) && IsFakeClient (iClient))
FakeClientCommand (iClient, szCommand);
}
}
else if ((iClient = FindTarget (client, szClient, false, true)) != -1)
{
if (IsFakeClient (iClient))
FakeClientCommand (iClient, szCommand);
else
ClientCommand (iClient, szCommand);
}
}
else
{
ReplyToCommand (client, "sm_cexec invalid format");
ReplyToCommand (client, "Usage: sm_cexec \"<user>\" \"<command>\"");
}
return Plugin_Handled;
}