AlliedModders

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

soumyadip77 06-13-2018 10:16

map Menu
 
me tried to make a small map menu to change map (only for learn) but i am getting issue with menu her eis the code..........me already saw the defult mapmenu plugin but cnt understand

PHP Code:

/* Sublime AMXX Editor v2.2 */

#include <amxmodx>
#include <amxmisc>
// #include <cstrike>
// #include <engine>
// #include <fakemeta>
// #include <hamsandwich>
// #include <fun>
// #include <xs>
// #include <sqlx>

#define PLUGIN  "New Plug-In"
#define VERSION "1.0"
#define AUTHOR  "Author"

new filename164 ];

new Array: 
Maps;

public 
plugin_init()
{
    
register_plugin(PLUGINVERSIONAUTHOR);
    
    
get_configsdir(filename164);
    
format(filename164"%s/special_map.ini"filename);
}

public 
plugin_cfg()
{
    
Maps ArrayCreate(641);
    
    if( 
file_existsfilename ) )
    {
        new 
open fopenfilename"rt");
        
        new 
buffer164 ];
        
        while( !
feofopen ) )
        {
            
fgetsopenbuffercharsmax(buffer));
            
            if( !
buffer] || buffer] == ';' || buffer] == '/' && buffer] == '/' )
            {
                continue;
            }
            
            
trim(buffer);

            
ArrayPushArray(Mapsbuffer);
            
        }
    }
}

public 
ShowMenu(id)
{
    new 
dataMAX_PLAYERS ];
    new 
menu menu_create("MapMenu""chnage_map");
    
    new 
g_maps ArraySize(Maps);
    
    
ArrayGetString(Mapsg_mapsdatacharsmax(data))
    
    
trim(data);
    
    
menu_additem(menudata); //Add the options to the menu
    
    
menu_setprop(menuMPROP_EXITMEXIT_ALL);
    
    
menu_display(idmenu0);
    
    return 
PLUGIN_HANDLED;
}

public 
chnage_map(idmenuitem)
{
    if(
item == MENU_EXIT)
    {
        
menu_cancel(id);
        return 
PLUGIN_HANDLED;
    }

    new 
buffer[6], access

    menu_item_getinfo
(menuitemaccessbuffercharsmaxbuffer ));


    
menu_destroy(menu);

    return 
PLUGIN_HANDLED;


error
PHP Code:

Compiling Map_Knife... Current time is10:13:50.54 Wed

AMX Mod X Compiler 1.8.3
-dev+5154
Copyright 
(c1997-2006 ITB CompuPhase
Copyright 
(c2004-2013 AMX Mod X Team

D
:\MY AMXX PLUGINS\Map_Knife.sma(86) : error 088number of arguments does not match definition

1 Error
.
Could not locate output file D:\New folder\HLDS\Half-Life\cstrike\addons\amxmodx\plugins\Map_Knife.amx (compile failed).
There was an compilation errorExiting... 

Took 0:00:00,13 seconds to run this script.

[
Finished in 0.2s


maqi 06-13-2018 12:22

Re: map Menu
 
You are missing some arguments.

https://www.amxmodx.org/api/newmenus/menu_item_getinfo

soumyadip77 06-13-2018 12:24

Re: map Menu
 
ya but i dont know how to display in menu :/

maqi 06-13-2018 12:33

Re: map Menu
 
menu_display displays the menu but first fix the compiler error

soumyadip77 06-13-2018 22:02

Re: map Menu
 
i cant under stand how to add bro :( if u can plz fix menu :(

Question x Mark 06-14-2018 03:40

Re: map Menu
 
1-
PHP Code:

new g_maps ArraySize(Maps); 

->
PHP Code:

new g_maps 

2-Use loop to get that strings.

3-Remove
Code:
menu_setprop(menu, MPROP_EXIT, MEXIT_ALL);

4-
Code:
menu_display(id, menu, 0);
->
Code:
menu_display(id, menu)

5-menu_item_getinfo will surely give error if you didn't give CALLBACK.

(FOR MORE INFO, CHECK NEW MENUS)

soumyadip77 06-14-2018 11:19

Re: map Menu
 
Here me changes something removed array and try to add this type....

PHP Code:

/* Sublime AMXX Editor v2.2 */

#include <amxmodx>
#include <amxmisc>
// #include <cstrike>
// #include <engine>
// #include <fakemeta>
// #include <hamsandwich>
// #include <fun>
// #include <xs>
// #include <sqlx>

#define PLUGIN  "New Plug-In"
#define VERSION "1.0"
#define AUTHOR  "Author"

#define MAX_MAP 32

new filename164 ];
new 
map_count;
new 
map_menu;
new 
map_namesMAX_MAP ][ MAX_PLAYERS ]


public 
plugin_init()
{
    
register_plugin(PLUGINVERSIONAUTHOR);
    
    
get_configsdir(filename164);
    
format(filename164"%s/special_map.ini"filename);
}

public 
plugin_cfg()
{
    
    if( 
file_existsfilename ) )
    {
        new 
open fopenfilename"rt");
        
        new 
buffer164 ], num10 ];
        
        while( !
feofopen ) && ( map_count MAX_MAP ) )
        {
            
fgetsopenbuffercharsmax(buffer));
            
trim(buffer);
            
            if( !
buffer] || buffer] == ';' || buffer] == '/' && buffer] == '/' && is_map_valid(buffer) )
            {
                continue;
            }

            
copymap_namesmap_count ], charsmaxmap_names[] ), buffer);

            
num_to_strmap_countnumcharsmax(num));
            
menu_additemmap_menumap_namesmap_count ], num);

            
map_count++;
            
        }

        
fcloseopen );

    }

    return 
0;



soumyadip77 06-15-2018 09:39

Re: map Menu
 
bump

fysiks 06-15-2018 23:21

Re: map Menu
 
Look at the replies here and then post back in this thread so that we can continue the discussion in this thread.

soumyadip77 06-15-2018 23:51

Re: map Menu
 
--- solved ---
ty crazy <3


All times are GMT -4. The time now is 12:10.

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