Quote:
Originally Posted by fysiks
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(PLUGIN, VERSION, AUTHOR)
register_clcmd("say /maps","MapsMenu")
}
public MapsMenu(id) {
new menu = menu_create("Maps","Maps_Handler")
for(new a = 0;a < 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
}