
/* AMX Mod script.
*
* (c) Copyright 2002, tcquest78
* This file is provided as is (no warranties).
*
* Admin Help - provides help for admin commands
*
*/

#define HELP_LIST_AMOUNT 10 //How many commands should be shown for each amx_help? 

#include <amxmod>

public admin_help(id){
	new flags = get_user_flags(id)
	if (!flags){
		client_print(id,print_console,"^n[AMX] You are not logged as admin or user with privileges")
		return PLUGIN_HANDLED
	}
	new arg1[8]
	new start = read_argv(1,arg1,7) ? strtonum(arg1) : 1
	if (--start < 0) start = 0
	new clcmdsnum = get_clcmdsnum(flags)
	if (start >= clcmdsnum) start = clcmdsnum - 1
	client_print(id,print_console,"^n[AMX] Your access level is: %d. You have %simmunity.^n^n[AMX] Commands:",flags, (flags&ADMIN_IMMUNITY)?"":"no " ) 
	client_print(id,print_console,"---- AMX Help: Commands ----") 
	new info[128], cmd[32]
	new end = start + HELP_LIST_AMOUNT
	if (end > clcmdsnum) end = clcmdsnum
	for (new i = start; i < end; i++){
		get_clcmd(i,flags,cmd,31,info,127)
		client_print(id,print_console,"%d: %s",i + 1,info)
	}
	if (end < clcmdsnum) {
		 client_print(id,print_console,"---- Entries %d - %d Of %d ----",start+1,end,clcmdsnum)
		 client_print(id,print_console,"---- Use 'amx_help %d' for More ----",end+1)
	} else { 
		 client_print(id,print_console,"---- Entries %d - %d Of %d ----",start+1,clcmdsnum,clcmdsnum)
		 client_print(id,print_console,"---- Use 'amx_help 1' for Begin ----")
	}
	return PLUGIN_HANDLED 
} 

public plugin_init() {
	register_plugin("Admin Help","0.7","tcquest78") 
	register_clcmd("amx_help","admin_help",0,"amx_help") 
	return PLUGIN_CONTINUE
}

