Small update. Added 2nd parameter to amx_help for server. Server can type "amx_help 1 150" to view 150 help cmds at once.

This commit is contained in:
Johnny Bergström 2004-05-16 11:31:41 +00:00
parent 2cf4801f6b
commit 7bb4c78a33

View File

@ -42,7 +42,7 @@ new g_timeInfo2[] = "No Time Limit. Next Map: %s"
public plugin_init() { public plugin_init() {
register_plugin("Admin Help","0.16","AMXX Dev Team") register_plugin("Admin Help","0.16","AMXX Dev Team")
register_concmd("amx_help","cmdHelp",0,"- displays this help") register_concmd("amx_help","cmdHelp",0,"<page> [nr of cmds (only for server)] - displays this help")
setHelp(0) setHelp(0)
} }
@ -52,22 +52,37 @@ public client_putinserver(id)
public cmdHelp(id,level,cid) { public cmdHelp(id,level,cid) {
new arg1[8], flags = get_user_flags(id) new arg1[8], flags = get_user_flags(id)
new start = read_argv(1,arg1,7) ? str_to_num(arg1) : 1 new start = read_argv(1,arg1,7) ? str_to_num(arg1) : 1
if (--start < 0) start = 0
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) new clcmdsnum = get_concmdsnum(flags,id)
if (start >= clcmdsnum) start = clcmdsnum - 1
if (start >= clcmdsnum)
start = clcmdsnum - 1
console_print(id,"^n----- AMX Mod X Help: Commands -----") console_print(id,"^n----- AMX Mod X Help: Commands -----")
new info[128], cmd[32], eflags new info[128], cmd[32], eflags
new end = start + HELPAMOUNT new end = start + lHelpAmount // HELPAMOUNT
if (end > clcmdsnum) end = clcmdsnum
if (end > clcmdsnum)
end = clcmdsnum
for (new i = start; i < end; i++) { for (new i = start; i < end; i++) {
get_concmd(i,cmd,31,eflags,info,127,flags,id) get_concmd(i,cmd,31,eflags,info,127,flags,id)
console_print(id,"%3d: %s %s",i+1,cmd,info) console_print(id,"%3d: %s %s",i+1,cmd,info)
} }
console_print(id,"----- Entries %d - %d of %d -----",start+1,end,clcmdsnum) console_print(id,"----- Entries %d - %d of %d -----",start+1,end,clcmdsnum)
if (end < clcmdsnum) if (end < clcmdsnum)
console_print(id,"----- Use 'amx_help %d' for more -----",end+1) console_print(id,"----- Use 'amx_help %d' for more -----",end+1)
else else
console_print(id,"----- Use 'amx_help 1' for begin -----") console_print(id,"----- Use 'amx_help 1' for begin -----")
return PLUGIN_HANDLED return PLUGIN_HANDLED
} }