Raised This Month: $ Target: $400
 0% 

Filling menu with options


  
 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
Hawk552
AMX Mod X Moderator
Join Date: Aug 2005
Old 01-03-2006 , 20:02  
Reply With Quote #3

Not sure if this will work, most likely not, but you get the idea

Code:
#include <amxmodx> #include <amxmisc> #define MAX_MAPS 100 new MenuPage[33]; new configsdir[200] new configfile[200] new map[MAX_MAPS][64] new totalmaps; //new mapdir[MAX_MAPS][64] public plugin_init() {     register_plugin("Map List","1.0","Kensai")     register_concmd("maplist","Maplist",ADMIN_KICK,"Displays a menu, listing all maps on the server.")         register_menucmd(register_menuid("menu_Maplist"),1023,"DoMaplist");         Load_File();     Read_File(); } public Maplist(id) {           new menu[300], pos, menupos;     pos += format(menu[pos],299-pos,"Map List^n^n");     menupos += MenuPage[id];     for(new i = (menupos * 7); i <= (menupos * 7) + 7;i++)     {         pos += format(menu[pos], 299-pos, "%i. %s^n",i,map[i]);     }         pos += format(menu[pos],299-pos,"^n^n8. Last Page^n9.Next Page^n^n0. Exit");         new keys = MENU_KEY_0|MENU_KEY_1|MENU_KEY_2|MENU_KEY_3|MENU_KEY_4|MENU_KEY_5|MENU_KEY_6|MENU_KEY_7|MENU_KEY_8|MENU_KEY_9;     show_menu(id, keys, menu, 15, "menu_Maplist")             return PLUGIN_HANDLED }   public DoMaplist(id,key) {     switch(key)     {         // change level I guess...?                 case 8 :         {             if(MenuPage[id] > 0)             {                 MenuPage[id]--;                 Maplist(id);             }             else             {                 Maplist(id);             }         }                 case 9 :         {             if(MenuPage[id] < totalmaps)             {                 MenuPage[id]++;                 Maplist(id);             }             else             {                 Maplist(id);             }         }     } } public client_disconnect(id) {     MenuPage[id] = 0; } public Load_File() {     get_configsdir(configsdir,63);         format(configfile,63,"%s/maplist.ini",configsdir);         if(!file_exists(configfile))     {         write_file(configfile,"de_dust",0);     } } public Read_File() {     new data[3][36],line,lnstr[256],len;     while(read_file(configfile,line++,data[0],255,len))     {         if(lnstr[0] == ';' || !len)         {             continue;         }         copyc(map[line],19,data[0],'.')         totalmaps++;     } }
__________________
Hawk552 is offline
Send a message via AIM to Hawk552
 



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 16:02.


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