forked from VANCOLD/fm_drive
-
Notifications
You must be signed in to change notification settings - Fork 0
/
FM_ADMIN_HELP.sma
60 lines (48 loc) · 1.22 KB
/
FM_ADMIN_HELP.sma
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
#include "feckinmad/fm_global"
#include "feckinmad/fm_admin_access"
public plugin_init()
{
fm_RegisterPlugin()
register_concmd("admin_help", "Admin_Help")
}
public Admin_Help(id, iLevel, iCommand)
{
if (!id)
{
return PLUGIN_HANDLED // Ignore rcon. (Making this a clcmd means I cannot run the command on a local server)
}
new iPlayerAccess = fm_GetUserAccess(id)
new iCommandNum = get_concmdsnum(iPlayerAccess, id)
if (!iCommandNum)
{
console_print(id, "You don't have access to any commands")
return PLUGIN_HANDLED
}
new sArgs[8]; read_args(sArgs, charsmax(sArgs))
new iStart = str_to_num(sArgs) - 1
if (iStart < 0)
{
iStart = 0
}
if (iStart >= iCommandNum)
{
iStart = iCommandNum - 1
}
new iEnd = iStart + 10
if (iEnd > iCommandNum)
{
iEnd = iCommandNum
}
console_print(id, "\nAvailiable Commands:")
new sCommand[32], sInfo[128], iFlag
for (new i = iStart; i < iEnd; i++)
{
get_concmd(i, sCommand, charsmax(sCommand), iFlag, sInfo, charsmax(sInfo), iPlayerAccess, id)
console_print(id, "\t#%d %s %s", i + 1, sCommand, sInfo)
}
if (iEnd < iCommandNum)
{
console_print(id, "Displaying commands %d to %d. Type \"admin_help %d\" for more\n", iStart + 1, iEnd, iEnd + 1)
}
return PLUGIN_HANDLED
}