2004-02-21 19:36:35 +00:00
|
|
|
/* AMX Mod X
|
|
|
|
* Admin Help Plugin
|
2004-01-31 20:56:22 +00:00
|
|
|
*
|
2004-02-21 19:36:35 +00:00
|
|
|
* by the AMX Mod X Development Team
|
|
|
|
* originally developed by tcquest78
|
2004-01-31 20:56:22 +00:00
|
|
|
*
|
2004-02-21 19:36:35 +00:00
|
|
|
* This file is part of AMX Mod X.
|
|
|
|
*
|
|
|
|
*
|
|
|
|
* This program is free software; you can redistribute it and/or modify it
|
|
|
|
* under the terms of the GNU General Public License as published by the
|
|
|
|
* Free Software Foundation; either version 2 of the License, or (at
|
|
|
|
* your option) any later version.
|
|
|
|
*
|
|
|
|
* This program is distributed in the hope that it will be useful, but
|
|
|
|
* WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
|
|
* General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU General Public License
|
|
|
|
* along with this program; if not, write to the Free Software Foundation,
|
|
|
|
* Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
|
|
|
*
|
|
|
|
* In addition, as a special exception, the author gives permission to
|
|
|
|
* link the code of this program with the Half-Life Game Engine ("HL
|
|
|
|
* Engine") and Modified Game Libraries ("MODs") developed by Valve,
|
|
|
|
* L.L.C ("Valve"). You must obey the GNU General Public License in all
|
|
|
|
* respects for all of the code used other than the HL Engine and MODs
|
|
|
|
* from Valve. If you modify this file, you may extend this exception
|
|
|
|
* to your version of the file, but you are not obligated to do so. If
|
|
|
|
* you do not wish to do so, delete this exception statement from your
|
|
|
|
* version.
|
2004-01-31 20:56:22 +00:00
|
|
|
*/
|
|
|
|
|
2004-03-05 19:35:38 +00:00
|
|
|
#include <amxmodx>
|
2004-01-31 20:56:22 +00:00
|
|
|
|
|
|
|
#define HELPAMOUNT 10 // Number of commands per page
|
|
|
|
|
|
|
|
new g_typeHelp[] = "Type 'amx_help' in the console to see available commands"
|
|
|
|
new g_timeInfo1[] = "Time Left: %d:%02d min. Next Map: %s"
|
|
|
|
new g_timeInfo2[] = "No Time Limit. Next Map: %s"
|
|
|
|
|
|
|
|
public plugin_init() {
|
2004-07-30 23:39:39 +00:00
|
|
|
register_plugin("Admin Help",AMXX_VERSION_STR,"AMXX Dev Team")
|
2004-05-16 11:31:41 +00:00
|
|
|
register_concmd("amx_help","cmdHelp",0,"<page> [nr of cmds (only for server)] - displays this help")
|
2004-01-31 20:56:22 +00:00
|
|
|
}
|
|
|
|
|
2004-05-16 11:31:41 +00:00
|
|
|
public client_putinserver(id)
|
2004-01-31 20:56:22 +00:00
|
|
|
setHelp(id)
|
|
|
|
|
2004-05-16 11:31:41 +00:00
|
|
|
public cmdHelp(id,level,cid) {
|
|
|
|
new arg1[8], flags = get_user_flags(id)
|
|
|
|
new start = read_argv(1,arg1,7) ? str_to_num(arg1) : 1
|
|
|
|
|
|
|
|
new lHelpAmount = HELPAMOUNT
|
|
|
|
if (id == 0 && read_argc() == 3)
|
|
|
|
lHelpAmount = read_argv(2, arg1, 7) ? str_to_num(arg1) : HELPAMOUNT
|
|
|
|
|
|
|
|
if (--start < 0)
|
|
|
|
start = 0
|
|
|
|
|
|
|
|
new clcmdsnum = get_concmdsnum(flags,id)
|
|
|
|
|
|
|
|
if (start >= clcmdsnum)
|
|
|
|
start = clcmdsnum - 1
|
|
|
|
|
|
|
|
console_print(id,"^n----- AMX Mod X Help: Commands -----")
|
|
|
|
new info[128], cmd[32], eflags
|
|
|
|
new end = start + lHelpAmount // HELPAMOUNT
|
|
|
|
|
|
|
|
if (end > clcmdsnum)
|
|
|
|
end = clcmdsnum
|
|
|
|
|
|
|
|
for (new i = start; i < end; i++) {
|
|
|
|
get_concmd(i,cmd,31,eflags,info,127,flags,id)
|
|
|
|
console_print(id,"%3d: %s %s",i+1,cmd,info)
|
|
|
|
}
|
|
|
|
console_print(id,"----- Entries %d - %d of %d -----",start+1,end,clcmdsnum)
|
|
|
|
|
|
|
|
if (end < clcmdsnum)
|
|
|
|
console_print(id,"----- Use 'amx_help %d' for more -----",end+1)
|
|
|
|
else
|
|
|
|
console_print(id,"----- Use 'amx_help 1' for begin -----")
|
|
|
|
|
|
|
|
return PLUGIN_HANDLED
|
2004-01-31 20:56:22 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
public dispInfo(id){
|
2004-07-29 10:40:46 +00:00
|
|
|
client_print(id,print_chat, g_typeHelp )
|
2004-01-31 20:56:22 +00:00
|
|
|
new nextmap[32]
|
|
|
|
get_cvar_string("amx_nextmap",nextmap,31)
|
|
|
|
if (get_cvar_float("mp_timelimit")){
|
|
|
|
new timeleft = get_timeleft()
|
|
|
|
if (timeleft > 0){
|
2004-07-29 10:40:46 +00:00
|
|
|
client_print(id,print_chat, g_timeInfo1 , timeleft / 60, timeleft % 60,nextmap)
|
2004-01-31 20:56:22 +00:00
|
|
|
}
|
|
|
|
}
|
2004-07-29 10:40:46 +00:00
|
|
|
client_print(id,print_chat, g_timeInfo2 ,nextmap)
|
2004-01-31 20:56:22 +00:00
|
|
|
}
|
|
|
|
|
2004-05-16 11:31:41 +00:00
|
|
|
setHelp(id)
|
2004-02-01 18:45:44 +00:00
|
|
|
set_task(15.0,"dispInfo",id)
|