Raised This Month: $ Target: $400
 0% 

Menu


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Artifact
Veteran Member
Join Date: Jul 2010
Old 04-29-2012 , 04:47   Menu
Reply With Quote #1

I have file mape.txt wher I write maps that I want... And how to include all this maps in amxx menu?
__________________
Artifact is offline
fysiks
Veteran Member
Join Date: Sep 2007
Location: Flatland, USA
Old 04-29-2012 , 06:12   Re: Menu
Reply With Quote #2

What do you mean? If you want them in the maps menu then put the in the mapcyclefile. If you don't want them in the mapcyclefile then use a mapchooser that has the capability to separate maps in the cycle and maps in the menu. That's the way to do it without a new custom plugin at least.
__________________
fysiks is offline
Artifact
Veteran Member
Join Date: Jul 2010
Old 04-29-2012 , 06:42   Re: Menu
Reply With Quote #3

No, no, no, I want something else...
I have eg. maps.txt file, and i in that file I have:
Code:
de_dust2
de_nuke
de_aztec
...
and I want when head admin type eg amx_getmapefile to show menu with this map, and when head choose 1 eg to server change level to de_dust2
__________________
Artifact is offline
Backstabnoob
BANNED
Join Date: Feb 2009
Location: Iwotadai Dorm
Old 04-29-2012 , 07:51   Re: Menu
Reply With Quote #4

Read the file and add each line to the menu?
Backstabnoob is offline
Artifact
Veteran Member
Join Date: Jul 2010
Old 04-29-2012 , 07:59   Re: Menu
Reply With Quote #5

Example?
__________________
Artifact is offline
Enomine
Junior Member
Join Date: Apr 2012
Old 04-29-2012 , 08:08   Re: Menu
Reply With Quote #6

Use 'maps *' in server console, that will show a list of all maps in maps folder, you just must to remove the .bsp at the end of each map.

If you're ussing galileo, you just need to put * in the following cvars...

Code:
gal_nom_mapfile
gal_vote_mapfile
gal_emptyserver_mapfile
Example 'gal_nom_mapfile *'

Last edited by Enomine; 04-29-2012 at 08:11.
Enomine is offline
Backstabnoob
BANNED
Join Date: Feb 2009
Location: Iwotadai Dorm
Old 04-29-2012 , 08:31   Re: Menu
Reply With Quote #7

PHP Code:

#include <amxmodx>

new Array: Maps
new const file[] = "file.txt"

new g_NumElements

public plugin_init() 
{
    
    
Maps ArrayCreate64 )
    
register_plugin"LOLOLOL""ROFLROFLROFL""LOLOLOL" )
    
    new 
File fopenfile"rt" ), Temp64 ]
    
    if( !
File 
        goto 
End
        
    
while( !feofFile ) )
    {
        
fgetsFileTempcharsmaxTemp ) )
        
        if( !
Temp] || Temp] == ';' )
            continue
        
        
ArrayPushStringMapsTemp )
    }
    
    
fcloseFile )
    
    
End:    

    
g_NumElements ArraySizeMaps )
    
register_clcmd"say /maps""_c_SayMaps" )
    
}

public 
_c_SayMapsid )
{
    
    if( !
g_NumElements )
    {
        
client_printidprint_chat"No maps were added or the file was not present" )
        return 
PLUGIN_HANDLED
    
}

    new 
Menu menu_create"Maps""_m_MapsHandler" ), Temp64 ]
    
    
// please correct me if this does not work as I'm not sure
    
    
for( new CountCount g_NumElementsCount++ )
    {
        
ArrayGetStringMapsCountTempcharsmaxTemp ) )
        
menu_additemMenuTempTemp )
    }
    
    
menu_displayidMenu )
    
    return 
PLUGIN_HANDLED
}

public 
_m_MapsHandleridmenuitem )
{
    new 
TrashData64 ]
    
menu_item_getinfomenuitemTrashDataTrash__Trash )
    
    
server_cmd"changelevel %s"Data )
    
    
menu_destroymenu )

    return 
PLUGIN_HANDLED

Could be probably done with caching the whole menu in plugin_init() instead of the array though.

Last edited by Backstabnoob; 04-30-2012 at 02:29.
Backstabnoob is offline
fysiks
Veteran Member
Join Date: Sep 2007
Location: Flatland, USA
Old 04-29-2012 , 15:36   Re: Menu
Reply With Quote #8

Quote:
Originally Posted by Artifact View Post
No, no, no, I want something else...
I know exactly what you want.

Quote:
Originally Posted by Artifact View Post
Example?
All you really need to do is learn how to make menus and read files. Then you can make what you want. Read the file, make the menu with the text in the file, then change to that map when you select an option.

Quote:
Originally Posted by Enomine View Post
Use 'maps *' in server console, that will show a list of all maps in maps folder, you just must to remove the .bsp at the end of each map.
"maps *" is a client-side command and will only show the maps in YOUR maps folder on your computer.
__________________
fysiks is offline
Artifact
Veteran Member
Join Date: Jul 2010
Old 04-29-2012 , 17:16   Re: Menu
Reply With Quote #9

fysiks I know to make simple menu, but I dont know how to include read_file in menu... :/ This is scripting help right? I need help.. :p
__________________
Artifact is offline
Backstabnoob
BANNED
Join Date: Feb 2009
Location: Iwotadai Dorm
Old 04-29-2012 , 17:29   Re: Menu
Reply With Quote #10

I wrote a clear example a while ago in case you didn't notice it.
Backstabnoob 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 07:45.


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