[Half-Life AMXX] / adminhelp.sma Repository:
ViewVC logotype

Annotation of /adminhelp.sma

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1 - (view) (download)

1 : ian 1 /* AMX Mod X
2 :     * Admin Help Plugin
3 :     *
4 :     * by the AMX Mod X Development Team
5 :     * originally developed by tcquest78
6 :     *
7 :     * This file is part of AMX Mod X.
8 :     *
9 :     *
10 :     * This program is free software; you can redistribute it and/or modify it
11 :     * under the terms of the GNU General Public License as published by the
12 :     * Free Software Foundation; either version 2 of the License, or (at
13 :     * your option) any later version.
14 :     *
15 :     * This program is distributed in the hope that it will be useful, but
16 :     * WITHOUT ANY WARRANTY; without even the implied warranty of
17 :     * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
18 :     * General Public License for more details.
19 :     *
20 :     * You should have received a copy of the GNU General Public License
21 :     * along with this program; if not, write to the Free Software Foundation,
22 :     * Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
23 :     *
24 :     * In addition, as a special exception, the author gives permission to
25 :     * link the code of this program with the Half-Life Game Engine ("HL
26 :     * Engine") and Modified Game Libraries ("MODs") developed by Valve,
27 :     * L.L.C ("Valve"). You must obey the GNU General Public License in all
28 :     * respects for all of the code used other than the HL Engine and MODs
29 :     * from Valve. If you modify this file, you may extend this exception
30 :     * to your version of the file, but you are not obligated to do so. If
31 :     * you do not wish to do so, delete this exception statement from your
32 :     * version.
33 :     */
34 :    
35 :     #include <amxmodx>
36 :    
37 :     #define DISPLAY_MSG // Comment to disable message on join
38 :     #define HELPAMOUNT 10 // Number of commands per page
39 :    
40 :     public plugin_init()
41 :     {
42 :     register_plugin("Admin Help", AMXX_VERSION_STR, "AMXX Dev Team")
43 :     register_dictionary("adminhelp.txt")
44 :     register_concmd("amx_help", "cmdHelp", 0, "<page> [nr of cmds (only for server)] - displays this help")
45 :     }
46 :    
47 :     #if defined DISPLAY_MSG
48 :     public client_putinserver(id)
49 :     {
50 :     if (is_user_bot(id))
51 :     return
52 :    
53 :     set_task(15.0, "dispInfo", id)
54 :     }
55 :    
56 :     public client_disconnect(id)
57 :     {
58 :     remove_task(id)
59 :     }
60 :     #endif
61 :    
62 :     public cmdHelp(id, level, cid)
63 :     {
64 :     new arg1[8], flags = get_user_flags(id)
65 :     new start = read_argv(1, arg1, 7) ? str_to_num(arg1) : 1
66 :     new lHelpAmount = HELPAMOUNT
67 :    
68 :     if (id == 0 && read_argc() == 3)
69 :     lHelpAmount = read_argv(2, arg1, 7) ? str_to_num(arg1) : HELPAMOUNT
70 :    
71 :     if (--start < 0)
72 :     start = 0
73 :    
74 :     new clcmdsnum = get_concmdsnum(flags, id)
75 :    
76 :     if (start >= clcmdsnum)
77 :     start = clcmdsnum - 1
78 :    
79 :     console_print(id, "^n----- %L -----", id, "HELP_COMS")
80 :    
81 :     new info[128], cmd[32], eflags
82 :     new end = start + lHelpAmount // HELPAMOUNT
83 :    
84 :     if (end > clcmdsnum)
85 :     end = clcmdsnum
86 :    
87 :     for (new i = start; i < end; i++)
88 :     {
89 :     get_concmd(i, cmd, 31, eflags, info, 127, flags, id)
90 :     console_print(id, "%3d: %s %s", i + 1, cmd, info)
91 :     }
92 :    
93 :     console_print(id, "----- %L -----", id, "HELP_ENTRIES", start + 1, end, clcmdsnum)
94 :    
95 :     if (end < clcmdsnum)
96 :     console_print(id, "----- %L -----", id, "HELP_USE_MORE", end + 1)
97 :     else
98 :     console_print(id, "----- %L -----", id, "HELP_USE_BEGIN")
99 :    
100 :     return PLUGIN_HANDLED
101 :     }
102 :    
103 :     #if defined DISPLAY_MSG
104 :     public dispInfo(id)
105 :     {
106 :     client_print(id, print_chat, "%L", id, "TYPE_HELP")
107 :    
108 :     new nextmap[32]
109 :     get_cvar_string("amx_nextmap", nextmap, 31)
110 :    
111 :     if (get_cvar_float("mp_timelimit"))
112 :     {
113 :     new timeleft = get_timeleft()
114 :    
115 :     if (timeleft > 0)
116 :     {
117 :     client_print(id, print_chat, "%L", id, "TIME_INFO_1", timeleft / 60, timeleft % 60, nextmap)
118 :     } else {
119 :     client_print(id, print_chat, "%L", id, "TIME_INFO_2", nextmap)
120 :     }
121 :     }
122 :     }
123 :     #endif

Contact
ViewVC Help
Powered by ViewVC 1.0.4