From 7bb4c78a335df4b40960acf6da226b99230ab311 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Johnny=20Bergstr=C3=B6m?= Date: Sun, 16 May 2004 11:31:41 +0000 Subject: [PATCH] Small update. Added 2nd parameter to amx_help for server. Server can type "amx_help 1 150" to view 150 help cmds at once. --- plugins/adminhelp.sma | 65 ++++++++++++++++++++++++++----------------- 1 file changed, 40 insertions(+), 25 deletions(-) diff --git a/plugins/adminhelp.sma b/plugins/adminhelp.sma index afccf27f..2d18c7b9 100755 --- a/plugins/adminhelp.sma +++ b/plugins/adminhelp.sma @@ -41,34 +41,49 @@ new g_timeInfo1[] = "Time Left: %d:%02d min. Next Map: %s" new g_timeInfo2[] = "No Time Limit. Next Map: %s" public plugin_init() { - register_plugin("Admin Help","0.16","AMXX Dev Team") - register_concmd("amx_help","cmdHelp",0,"- displays this help") + register_plugin("Admin Help","0.16","AMXX Dev Team") + register_concmd("amx_help","cmdHelp",0," [nr of cmds (only for server)] - displays this help") setHelp(0) } -public client_putinserver(id) +public client_putinserver(id) setHelp(id) -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 - 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 + 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 +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 } public dispInfo(id){ @@ -80,12 +95,12 @@ public dispInfo(id){ new timeleft = get_timeleft() if (timeleft > 0){ if (id) client_print(id,print_chat, g_timeInfo1 , timeleft / 60, timeleft % 60,nextmap) - else server_print( g_timeInfo1 , timeleft / 60, timeleft % 60,nextmap) + else server_print( g_timeInfo1 , timeleft / 60, timeleft % 60,nextmap) } } else if (id) client_print(id,print_chat, g_timeInfo2 ,nextmap) else server_print( g_timeInfo2 ,nextmap) } -setHelp(id) +setHelp(id) set_task(15.0,"dispInfo",id) \ No newline at end of file