AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   [HELP] Menu (https://forums.alliedmods.net/showthread.php?t=106289)

Redfalcon 10-13-2009 13:21

[HELP] Menu
 
I got my Admin Menu how can i add so Godmode,NoClip and 200 Health works?

Exolent[jNr] 10-13-2009 13:43

Re: [HELP] Menu
 
Explain better, please.

Redfalcon 10-13-2009 14:43

Re: [HELP] Menu
 
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;
}


Exolent[jNr] 10-13-2009 14:47

Re: [HELP] Menu
 
Code:
#include < fun >
Check out:
  • set_user_noclip( )
  • set_user_godmode( )
  • set_user_health( )
http://www.amxmodx.org/funcwiki.php?go=inc&id=7

vitorrd 10-13-2009 14:49

Re: [HELP] Menu
 
Plus, it's a little bit more efficient if you just destroy the menu at the end of your switch.

Redfalcon 10-13-2009 15:31

Re: [HELP] Menu
 
Ty but where should i insert


set_user_noclip( )
set_user_godmode( )
set_user_health( )

I am using Emps guide

fysiks 10-14-2009 00:13

Re: [HELP] Menu
 
Quote:

Originally Posted by Redfalcon (Post 961057)
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.

FaktuM 10-16-2009 19:21

Re: [HELP] Menu
 
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);
    }




All times are GMT -4. The time now is 22:42.

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