Raised This Month: $ Target: $400
 0% 

My plugin =(


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
umarsa
Senior Member
Join Date: Feb 2006
Location: U.K
Old 04-01-2006 , 15:47   My plugin =(
Reply With Quote #1

Hi all i want some help with my plugin that i wanted to make i dont know if you lot can make it but here it goes

my code is
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", "mAdminMenu")
	
}


/* 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 */
}
now u see this "register_clcmd("amx_adminmenu", "mAdminMenu")" the mAdminMenu i dont know it that is it and thats the code and i dont know what to register_clcmd i know that i want "amx_adminmenu" to go to this menu i made but i dont know what to bind that to can sum1 help me out :S ?

~ umarsa
umarsa is offline
v3x
Veteran Member
Join Date: Oct 2004
Location: US
Old 04-01-2006 , 18:36  
Reply With Quote #2

Code:
register_clcmd("amx_adminmenu" , "cmd_adminmenu");
Code:
public cmd_adminmenu(id , lvl , cid) {   if(!cmd_access(id , lvl , cid , 1))     return PLUGIN_HANDLED;   menu_display(id , mAdminMenu , 0);   return PLUGIN_HANDLED; }
__________________
What am I doing these days? Well, I run my own Rust server. It's heavily modded. If you'd like to join, the ip is 167.114.101.67:28116

I also created a website called Rust Tools. It will calculate and tell you the raw amounts of resources needed to craft items.
v3x is offline
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
AAleaderNik
Member
Join Date: Dec 2005
Old 04-02-2006 , 16:28  
Reply With Quote #4

why dont you use amxmodmenu?
AAleaderNik is offline
Freecode
Never Fall Asleep
Join Date: Jan 2004
Old 04-02-2006 , 16:52  
Reply With Quote #5

Heres a tutorial on the new menu system that im writing. Its not done, but most of it is finished.

http://wiki.amxmodx.org/index.php/Using_New_Menu_System
Freecode is offline
v3x
Veteran Member
Join Date: Oct 2004
Location: US
Old 04-02-2006 , 23:55  
Reply With Quote #6

Looks finished to me.
__________________
What am I doing these days? Well, I run my own Rust server. It's heavily modded. If you'd like to join, the ip is 167.114.101.67:28116

I also created a website called Rust Tools. It will calculate and tell you the raw amounts of resources needed to craft items.
v3x is offline
Reply



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