Raised This Month: $ Target: $400
 0% 

My plugin =(


  
 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
umarsa
Senior Member
Join Date: Feb 2006
Location: U.K
Old 04-02-2006 , 06:11  
Reply With Quote #3

thx this works but when i press a key on the menu how do i make it that it returns to the menu not exit the menu ?

Code:
#include <amxmodx> 
#include <amxmisc> 


new mAdminMenu // Menu 
new mcbAdminMenu // Menu Callback 



public plugin_init() { 
   /* Menu Admin Menu */ 
   /* Use menu_display(id, mAdminMenu, 0) to show the menu to an user. */ 
   mAdminMenu = menu_create("Admin Menu", "mh_AdminMenu") 
   mcbAdminMenu = menu_makecallback("mcb_AdminMenu") 
   menu_additem(mAdminMenu, "Restart Server (20)", "ma_AdminMenu", ADMIN_IMMUNITY, mcbAdminMenu) 
   menu_additem(mAdminMenu, "Shutdown Server (20)", "ma_AdminMenu", ADMIN_IMMUNITY, mcbAdminMenu) 
   /* Menu End */ 

	register_plugin("Admin Menu", "1.0", "Umar Salim") 
	register_clcmd("amx_adminmenu" , "cmd_adminmenu"); 
    
} 

public cmd_adminmenu(id , lvl , cid) 
{ 
  if(!cmd_access(id , lvl , cid , 1)) 
    return PLUGIN_HANDLED; 

  menu_display(id , mAdminMenu , 0); 

  return PLUGIN_HANDLED; 
} 

/* Menu Admin Menu */ 

public mh_AdminMenu(id, menu, item) { 
   /* This event is called when someone presses a key on this menu */ 
} 

public ma_AdminMenu(id) { 
   /* This event is called when an item was selected */ 
} 

public mcb_AdminMenu(id, menu, item) { 
   /* This is the callback-event, here you can set items enabled or disabled. */ 
   /* If you want to enable an item, use: return ITEM_ENABLED */ 
   /* If you want to disable an item, use: return ITEM_DISABLED */ 
}
also i got this plugin istalled :

Code:
#include <amxmodx>
#include <amxmisc>

#define SHUTDOWN 0
#define RESTART 1

new g_bShuttingDown
new g_iMode

public plugin_init()
{
	register_plugin("Server Shutdown","2.1","Hawk552")
	
	register_concmd("amx_shutdown","fShutDown",ADMIN_RCON,"<seconds (1-20)> - shuts down the server in seconds")
	register_concmd("say /shutdown","fShutDown",ADMIN_RCON,"<seconds (1-20)> - shuts down the server in seconds")
	register_concmd("amx_restart","fShutDown",ADMIN_RCON,"<seconds (1-20)> - restarts the server in seconds")
	register_concmd("say /restart","fShutDown",ADMIN_RCON,"<seconds (1-20)> - restarts the server in seconds")
}

public fShutDown(id,level,cid)
{
	if(!cmd_access(id,level,cid,2) || g_bShuttingDown)
		return PLUGIN_HANDLED
		
	new szArg[6]
	read_argv(0,szArg,5)
	
	if(equali(szArg,"amx_r"))
		g_iMode = RESTART
		
	read_argv(1,szArg,5)
	new iTime = str_to_num(szArg)
	
	if(!iTime || iTime > 20)
	{
		console_print(id,"[AMXX] You did not supply a valid time (between 1-20 seconds)")
		
		return PLUGIN_HANDLED
	}
	
	new szName[32]
	get_user_name(id,szName,31)
	
	new szAuthid[32]
	get_user_authid(id,szAuthid,31)
	
	log_amx("Cmd: ^"%s<%i><%s>^" initiate %s",szName,id,szAuthid,g_iMode ? "restart" : "shutdown")
	
	switch(get_cvar_num("amx_show_activity"))
	{
		case 1 : client_print(0,print_chat,"ADMIN: %s server in %i seconds",g_iMode ? "Restart" : "Shutdown",iTime)
		case 2 : client_print(0,print_chat,"ADMIN %s: %s server in %i seconds",szName,g_iMode ? "Restart" : "Shutdown",iTime)
	}
	
	fInitiate(iTime)
	
	return PLUGIN_HANDLED
}

public fInitiate(iTime)
{
	g_bShuttingDown = true
	
	new iCount
	for(iCount = iTime;iCount != 0;iCount--)
		set_task(float(abs(iCount-iTime)),"fCallTime",iCount)
	
	set_task(float(iTime),"fCallTime",0)
}

public fCallTime(iCount)
{
	if(!iCount)
	{
		switch(g_iMode)
		{
			case SHUTDOWN :
				server_cmd("quit")
			
			case RESTART :
				server_cmd("restart")
		}
	}
	
	new szWord[32]
	num_to_word(iCount,szWord,31)
	
	client_cmd(0,"spk ^"fvox/%s^"",szWord)
}
how do i make it that the "Restart Option" in my menu so it uses the commad amx_restart 20 or do i have to combine both plugins together and use the command "fShutDown" but i dont get it that both commands are the same . same with the Shutdown can u make it so it uses the comand "amx_shutdown 20"
umarsa is offline
 



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 16:30.


Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.
Theme made by Freecode