AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   ML Help (https://forums.alliedmods.net/showthread.php?t=168761)

enjoi. 10-03-2011 16:09

ML Help
 
I don't know if this is the right section or not but I feel like an idiot right now. I just started coding and me and my friend are making a plugin. We both just started coding so we don't know how to make A ML. Can anybody help? So far its in Polish. This is our code thanks for people who help. will be included in the plugin! Edit: If somebody can translate it into like English or something it would be great so we can work off that!

PHP Code:

#include <amxmodx> 

#define PLUGIN "Menu" 
#define VERSION "1.5" 
#define AUTHOR "Redux + -dINk^1d" 

public plugin_init() 

    
register_plugin(PLUGINVERSIONAUTHOR
    
register_clcmd("say /menu","mymenu"); 




public 
mymenu(id

    new 
MyMenu=menu_create("\wServer Menu [\rDeathrun\w]""cbMyMenu"); 

    
menu_additem(MyMenu"Change Server"); //item=0 
    
menu_additem(MyMenu"Deathrun Shop"); //item=1 
    
menu_additem(MyMenu"Turn off CT Visibility"); //item=2 
    
menu_additem(MyMenu"Deathrun Points"); //item=3 
    
menu_additem(MyMenu"Admin Menu", .paccess=ADMIN_BAN); //item=4 
    
menu_additem(MyMenu"Turn Off/On Round Sound"); //item=5 
    
menu_additem(MyMenu"Close"); //item=6
    

    
menu_setprop(MyMenuMPROP_EXITNAME"Close") ; 
    
menu_setprop(MyMenuMPROP_EXITMEXIT_ALL); 
    
menu_setprop(MyMenuMPROP_NUMBER_COLOR"\y"); 


    
menu_display(idMyMenu,0); 
    return 
PLUGIN_HANDLED


public 
cbMyMenu(idmenuitem

    switch(
item
    { 
        case 
0
        { 
            
client_cmd(id"say /server"); 

        } 
        case 
1
        { 
            
client_cmd(id"say /drshop"); 

        } 
        case 
2
        { 
            
client_cmd(id"say /invis"); 

        } 
        case 
3
        { 
            
client_cmd(id"say /points"); 

        } 
        case 
4
        { 
            
client_cmd(id"amxmodmenu"); 

        } 
        case 
5
        { 
            
client_cmd(id"say /roundsound"); 

        } 

    } 
    
menu_destroy(menu); 
    return 
PLUGIN_HANDLED



sinblaster 10-03-2011 16:36

Re: Dumb Question
 
So why are you asking in here. There are forums for this

enjoi. 10-03-2011 16:37

Re: Dumb Question
 
I DONT KNOW LOL

sinblaster 10-03-2011 16:57

Re: Dumb Question
 
post in the scripting help forum mate.

enjoi. 10-03-2011 17:02

Re: Dumb Question
 
but its not a scripting help problem its for ML help idk how to do that.

MyPc 10-04-2011 00:55

Re: Dumb Question
 
There are no dumb question, every question is for learning ...

ConnorMcLeod 10-04-2011 01:05

Re: Dumb Question
 
Dumb answer.
Change your title to something descriptive before you post again, thanks.

sake 10-04-2011 07:16

Re: Dumb Question
 
If the menu stays the same all the time, there is no need to destroy it. Just let it be as it is. Here is an example on how to do menus that stay the same all the time:

PHP Code:

new g_menu_main;

public 
plugin_init()
{
    
register_plugin(test0.1sake);
    
initMenus();
    
register_clcmd("say /showMenu""showMenu"0);
}

initMenus()
{
    
g_menu_main menu_create("Main Menu","mainMenuHandle");
    
menu_additem(g_menu_main,"MenuItem1","0",0);
    
menu_additem(g_menu_main,"MenuItem2","1",0);
    
menu_setprop(g_menu_mainMPROP_EXITMEXIT_ALL);
}

public 
showMenu(id)
{
    
menu_display(id,g_menu_main,0);
}

public 
mainMenuHandle(idmenu ,item)
{
    if(
item == MENU_EXIT)
    {
        return 
PLUGIN_HANDLED;
    }
    
    new 
data[6], szName[64];
    new 
accesscallback;
    
    
menu_item_getinfo(menuitemaccessdata,charsmax(data), szName,charsmax(szName), callback);
    
    switch(
str_to_num(data))
    {
        case 
0:
        {
            
//MenuItem1
        
}
        case 
1:
        {
            
//MenuItem2
        
}
    }
    return 
PLUGIN_HANDLED;


And next time, please add more information :P

enjoi. 10-04-2011 08:13

Re: Dumb Question
 
Well that's all my code. I need to add an ML for different languages. Going to update my code.

sake 10-04-2011 08:13

Re: Dumb Question
 
Ah ML stuff. Now I did understand :P. Okay sorry for that.

EDIT:

Just realized how dumb some of my code was....


All times are GMT -4. The time now is 19:41.

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