forked from ugurbayraktarr/Plugins-for-CSGO-Servers
-
Notifications
You must be signed in to change notification settings - Fork 3
/
fake.sp
133 lines (110 loc) · 2.3 KB
/
fake.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
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
#pragma semicolon 1
#include <sourcemod>
#include <sdktools>
#include <sdkhooks>
#include <cstrike>
#include <string>
#define PLUGIN_VERSION "1.0"
public Plugin:myinfo =
{
name = "Fake",
author = "ImPossibLe`",
description = "DrK # GaminG",
version = PLUGIN_VERSION,
};
bool noScopeMod = false;
new String:silahlar[MAXPLAYERS+1][32];
public OnPluginStart()
{
RegAdminCmd("sm_fake", Fake, ADMFLAG_ROOT, "Fake");
}
public OnMapStart()
{
noScopeMod = false;
}
public Action:Fake(client, args)
{
if (args < 2)
{
ReplyToCommand(client, "[SM] Usage: sm_exec <name or #userid> <command>");
return Plugin_Handled;
}
new String:Target[64],String:buffer[256];
GetCmdArgString(buffer, sizeof(buffer));
new start = BreakString(buffer, Target, sizeof(Target));
new num=trim_quotes(Target);
new letter = Target[num+1];
if (Target[num]=='@')
{
//assume it is either @ALL, @CT or @T
for (new i=1; i<=MaxClients; i++)
{
if (!IsClientInGame(i))
continue;
if (letter=='C') //assume @CT
{
if (GetClientTeam(i)==3)
{
ExecClient(i,buffer[start]);
}
}
else if (letter=='T') //assume @T
{
if (GetClientTeam(i)==2)
{
ExecClient(i,buffer[start]);
}
}
else //assume @ALL
{
ExecClient(i,buffer[start]);
}
}
return Plugin_Handled;
}
new targetclient = FindClient(client,Target);
if (targetclient == -1)
return Plugin_Handled;
ExecClient(targetclient,buffer[start]);
return Plugin_Handled;
}
public ExecClient(client,String:Command[])
{
ClientCommand(client, Command);
}
public trim_quotes(String:text[])
{
new startidx = 0;
if (text[0] == '"')
{
startidx = 1;
/* Strip the ending quote, if there is one */
new len = strlen(text);
if (text[len-1] == '"')
{
text[len-1] = '\0';
}
}
return startidx;
}
public FindClient(client,String:Target[])
{
new iClients[2];
new iNumClients = SearchForClients(Target, iClients, 2);
if (iNumClients == 0)
{
ReplyToCommand(client, "[SM] %t", "No matching client");
return -1;
}
else if (iNumClients > 1)
{
ReplyToCommand(client, "[SM] %t", "More than one client matches", Target);
return -1;
}
else if (!CanUserTarget(client, iClients[0]))
{
ReplyToCommand(client, "[SM] %t", "Unable to target");
return -1;
}
return iClients[0];
}