Raised This Month: $ Target: $400
 0% 

How I Can Make a Mapsmenu in a ini file?


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
fysiks
Veteran Member
Join Date: Sep 2007
Location: Flatland, USA
Old 05-30-2010 , 03:21   Re: How I Can Make a Mapsmenu in a ini file?
Reply With Quote #1

Quote:
Originally Posted by #8 SickneSS View Post
I know how to make all (with const,loops,etc)
Your code proves this is untrue.
__________________
fysiks is offline
#8 SickneSS
BANNED
Join Date: Sep 2008
Location: Here
Old 05-30-2010 , 03:28   Re: How I Can Make a Mapsmenu in a ini file?
Reply With Quote #2

Quote:
Originally Posted by fysiks View Post
Your code proves this is untrue.
Ok,I just think that because when I use a const with the maps in that const i need to use a loop.
#8 SickneSS is offline
Send a message via MSN to #8 SickneSS Send a message via Skype™ to #8 SickneSS
fysiks
Veteran Member
Join Date: Sep 2007
Location: Flatland, USA
Old 05-30-2010 , 13:27   Re: How I Can Make a Mapsmenu in a ini file?
Reply With Quote #3

Quote:
Originally Posted by #8 SickneSS View Post
Ok,I just think that because when I use a const with the maps in that const i need to use a loop.
I already told you. DO NOT do anything with the file AT ALL first. Get the menu working first.

PHP Code:
new const szMaps[][] = 
{
    
"mapname1",
    
"mapname2",
    
"mapname3"

Now, make the menu from that first. Then after it is working then you can add reading the file.
__________________

Last edited by fysiks; 05-30-2010 at 13:37.
fysiks is offline
#8 SickneSS
BANNED
Join Date: Sep 2008
Location: Here
Old 05-30-2010 , 14:38   Re: How I Can Make a Mapsmenu in a ini file?
Reply With Quote #4

Quote:
Originally Posted by fysiks View Post
I already told you. DO NOT do anything with the file AT ALL first. Get the menu working first.

PHP Code:
new const szMaps[][] = 
{
    
"mapname1",
    
"mapname2",
    
"mapname3"

Now, make the menu from that first. Then after it is working then you can add reading the file.
PHP Code:
/* Plugin generated by AMXX-Studio */

#include <amxmodx>
#include <amxmisc>

#define PLUGIN "New Plug-In"
#define VERSION "1.0"
#define AUTHOR "#8 SickneSS"

new const Maps[][] = 

    
"de_dust2",
    
"de_inferno",
    
"de_nuke",
    
"de_train",
    
"de_cbble",
    
"de_cpl_mill",
    
"de_cpl_strike",
    
"de_cpl_fire"
}
public 
plugin_init() {
    
register_plugin(PLUGINVERSIONAUTHOR)
    
    
register_clcmd("say /maps","MapsMenu")
}

public 
MapsMenu(id) {
    
    new 
menu menu_create("Maps","Maps_Handler")
    
    for(new 
0;sizeof (Maps);a++)
    {
        new 
mapname[64]
        
formatex(mapname,63,"%s",Maps[a])
        
        new 
temp[32]
        
num_to_str(a,temp,31)
        
        
menu_additem(menu,mapname,temp)
    }
    
menu_display(id,menu)
    return 
PLUGIN_HANDLED
}

public 
Maps_Handler(id,menu,item) {
    
    if(
item == MENU_EXIT)
    {
        
menu_destroy(menu)
        return 
PLUGIN_HANDLED
    
}
    
    new 
iData[6],iName[64],access,callback
    
    menu_item_getinfo
(menu,item,access,iData,5,iName,63,callback)
    
    new 
Key str_to_num(iData)
    
    if(
Key)    
        
client_cmd(id,"amx_map %s",Maps[Key])
    
    return 
PLUGIN_HANDLED

#8 SickneSS is offline
Send a message via MSN to #8 SickneSS Send a message via Skype™ to #8 SickneSS
fysiks
Veteran Member
Join Date: Sep 2007
Location: Flatland, USA
Old 05-30-2010 , 17:42   Re: How I Can Make a Mapsmenu in a ini file?
Reply With Quote #5

Ok, now change this:

PHP Code:
new const Maps[][] = { 
    
"de_dust2",
    
"de_inferno",
    
"de_nuke",
    
"de_train",
    
"de_cbble",
    
"de_cpl_mill",
    
"de_cpl_strike",
    
"de_cpl_fire"

to this:

PHP Code:
#define MAX_MAPS 10
new Maps[MAX_MAPS][32]
new 
NumMaps 0

public plugin_cfg()
{
    
// Load mapfile into "Maps" array

and

this:

PHP Code:
for(new 0;sizeof (Maps);a++) 
to this:
PHP Code:
for(new 0;NumMaps;a++) 
and fill in the blanks. Like I said before you can use my Bot Apology plugin (in my signature) as your template for reading from your file. It is almost exactly what you need.
__________________
fysiks is offline
#8 SickneSS
BANNED
Join Date: Sep 2008
Location: Here
Old 05-30-2010 , 19:38   Re: How I Can Make a Mapsmenu in a ini file?
Reply With Quote #6

Quote:
Originally Posted by fysiks View Post
Ok, now change this:

PHP Code:
new const Maps[][] = { 
    
"de_dust2",
    
"de_inferno",
    
"de_nuke",
    
"de_train",
    
"de_cbble",
    
"de_cpl_mill",
    
"de_cpl_strike",
    
"de_cpl_fire"

to this:

PHP Code:
#define MAX_MAPS 10
new Maps[MAX_MAPS][32]
new 
NumMaps 0

public plugin_cfg()
{
    
// Load mapfile into "Maps" array

and

this:

PHP Code:
for(new 0;sizeof (Maps);a++) 
to this:
PHP Code:
for(new 0;NumMaps;a++) 
and fill in the blanks. Like I said before you can use my Bot Apology plugin (in my signature) as your template for reading from your file. It is almost exactly what you need.
Ok,I will try it later,Thanks again
#8 SickneSS is offline
Send a message via MSN to #8 SickneSS Send a message via Skype™ to #8 SickneSS
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 05:25.


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