Raised This Month: $ Target: $400
 0% 

[HELP] Menu


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Redfalcon
BANNED
Join Date: Sep 2009
Location: Prison Break
Old 10-13-2009 , 13:21   [HELP] Menu
Reply With Quote #1

I got my Admin Menu how can i add so Godmode,NoClip and 200 Health works?
Redfalcon is offline
Send a message via MSN to Redfalcon
Exolent[jNr]
Veteran Member
Join Date: Feb 2007
Location: Tennessee
Old 10-13-2009 , 13:43   Re: [HELP] Menu
Reply With Quote #2

Explain better, please.
__________________
No private work or selling mods.
Quote:
Originally Posted by xPaw View Post
I love you exolent!
Exolent[jNr] is offline
Redfalcon
BANNED
Join Date: Sep 2009
Location: Prison Break
Old 10-13-2009 , 14:43   Re: [HELP] Menu
Reply With Quote #3

when i write /menu my menu cames up but how can i do so Godmode,Noclip and add 200 Health work? So it will be added?

Code:
#include <amxmodx>
public plugin_init()
{
register_clcmd( "/menu","Adminmenu");
}
public Adminmenu(id)
{
new menu = menu_create("\rAdmin Menu:", "menu_handler");
menu_additem(menu, "\wGodmode", "1", ADMIN_IMMUNITY);
menu_additem(menu, "\wNoClip", "2", ADMIN_IMMUNITY);
menu_additem(menu, "\w200 Health", "3", ADMIN_IMMUNITY);
menu_setprop(menu, MPROP_EXIT, MEXIT_ALL);
menu_display(id, menu, 0);
 
}
public menu_handler(id, menu, item)
{
if( item == MENU_EXIT )
{
menu_destroy(menu);
return PLUGIN_HANDLED;
}
new data[6], iName[64];
new access, callback;
menu_item_getinfo(menu, item, access, data,5, iName, 63, callback);
 
new key = str_to_num(data);
switch(key)
{
case 1:
{
client_print(id, print_chat, "Godmode ON");
menu_destroy(menu);
return PLUGIN_HANDLED;
}
case 2:
{
client_print(id, print_chat, "NoClip ON");
}
case 3
{
client_print(id, print_chat, "200 Health Added");
}
}
menu_destroy(menu);
return PLUGIN_HANDLED;
}
Redfalcon is offline
Send a message via MSN to Redfalcon
Exolent[jNr]
Veteran Member
Join Date: Feb 2007
Location: Tennessee
Old 10-13-2009 , 14:47   Re: [HELP] Menu
Reply With Quote #4

Code:
#include < fun >
Check out:
  • set_user_noclip( )
  • set_user_godmode( )
  • set_user_health( )
http://www.amxmodx.org/funcwiki.php?go=inc&id=7
__________________
No private work or selling mods.
Quote:
Originally Posted by xPaw View Post
I love you exolent!
Exolent[jNr] is offline
vitorrd
Senior Member
Join Date: Jul 2009
Old 10-13-2009 , 14:49   Re: [HELP] Menu
Reply With Quote #5

Plus, it's a little bit more efficient if you just destroy the menu at the end of your switch.
vitorrd is offline
Redfalcon
BANNED
Join Date: Sep 2009
Location: Prison Break
Old 10-13-2009 , 15:31   Re: [HELP] Menu
Reply With Quote #6

Ty but where should i insert


set_user_noclip( )
set_user_godmode( )
set_user_health( )

I am using Emps guide
Redfalcon is offline
Send a message via MSN to Redfalcon
fysiks
Veteran Member
Join Date: Sep 2007
Location: Flatland, USA
Old 10-14-2009 , 00:13   Re: [HELP] Menu
Reply With Quote #7

Quote:
Originally Posted by Redfalcon View Post
Ty but where should i insert


set_user_noclip( )
set_user_godmode( )
set_user_health( )

I am using Emps guide
Put them where they need to go, it should be obvious. Also, http://www.amxmodx.org/funcwiki.php

P.S. Emp's guide is for the menu. You shouldn't need it anymore once the menu itself works.
__________________

Last edited by fysiks; 10-14-2009 at 00:16.
fysiks is offline
FaktuM
Junior Member
Join Date: Oct 2009
Location: Sweden
Old 10-16-2009 , 19:21   Re: [HELP] Menu
Reply With Quote #8

Something like this? Don't know how to hook admin flag.


PHP Code:
#include < amxmodx >
#include < fun >

new const VERSION[ ] = "1.0"

public plugin_init( )
{
    
register_plugin"Admin Menu"VERSION"FaktuM" );
    
    
register_clcmd"say /menu""AdminMenu" );
}

public 
AdminMenuid )
{
    new 
menu menu_create"\rAdmin Menu:""menu_handler" );
    
    new 
text256 ];
    
formatex(textsizeof text 1"Godmode: %s", ( get_user_godmodeid ) ? "\yOn" "\gOff" ) );
    
menu_additemmenutext"1"); 
    
formatex(textsizeof text 1"Noclip: %s", ( get_user_noclipid ) ? "\yOn" "\gOff" ) );
    
menu_additem (menutext"2");
    
    
menu_additemmenu"\w200 Health""3"ADMIN_IMMUNITY );
    
    
menu_setpropmenuMPROP_EXITMEXIT_ALL );
    
menu_displayidmenu);
    
}

public 
menu_handleridmenuitem )
{
    if( 
item == MENU_EXIT )
    {
        
menu_destroymenu );
        return 
PLUGIN_HANDLED;
    }
    
    new 
data], iName64 ];
    new 
accesscallback;
    
    
menu_item_getinfomenuitemaccessdata,5iName63callback );
    
    new 
key str_to_numdata );
    
    switch( 
key )
    {
        case 
1:
        {
            
Toggle_Godmodeid );
            
AdminMenuid );
        }
        case 
2:
        {
            
Toggle_Noclipid );
            
AdminMenuid );
        }
        case 
3:
        {
            
set_user_healthid200 );
            
AdminMenuid );
        }

    }
    return 
PLUGIN_HANDLED;
}

public 
Toggle_Godmodeid )
{
    if( 
get_user_godmodeid ) ) 
    {
        
set_user_godmodeid);
    }
    else 
    {
        
set_user_godmodeid);
    }
}

public 
Toggle_Noclipid 
{
    if( 
get_user_noclipid ) ) 
    {
        
set_user_noclipid);
    }
    else
    {
        
set_user_noclipid);
    }


Last edited by FaktuM; 10-17-2009 at 05:14.
FaktuM is offline
Reply


Thread Tools
Display Modes

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 22:42.


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