Raised This Month: $ Target: $400
 0% 

Help with multiple menus plz!


  
 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
Hawk552
AMX Mod X Moderator
Join Date: Aug 2005
Old 05-31-2006 , 15:13  
Reply With Quote #3

I already did this for whoever it was that requested it. Unless you want it too.

This could use a bit of tweaking but otherwise it mostly works:

Code:
#include <amxmodx> #include <amxmisc> #include <engine> #define MAX_ITEMS 50 enum eSounds {     szTitle[33],     szFile[33] } new g_szMenuTitle[] = "mSoundMenu" new g_iKeys = 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 // there will be more than 1 page new g_iMenuPosition[33] new g_szSounds[MAX_ITEMS][eSounds] new g_iSounds new g_szFileName[] = "sounds.ini" new g_szFilePath[128] public plugin_init() {     register_plugin("Play Sounds","1.0","Hawk552")         register_clcmd("amx_soundmenu","fnCmdSoundMenu")         register_menucmd(register_menuid(g_szMenuTitle),g_iKeys,"fnHandleSoundMenu") } public client_disconnect(id)     g_iMenuPosition[id] = 0 fnLoadFile() {     get_configsdir(g_szFilePath,127)     format(g_szFilePath,127,"%s/%s",g_szFilePath,g_szFileName)         new iFile = fopen(g_szFilePath,"rt"),szBuffer[66]     while(!feof(iFile))     {         fgets(iFile,szBuffer,65)         strbreak(szBuffer,g_szSounds[g_iSounds][szTitle],32,g_szSounds[g_iSounds][szFile],32)         replace(g_szSounds[g_iSounds][szTitle],32,"^n","")         replace(g_szSounds[g_iSounds][szFile],32,"^n","")         remove_quotes(g_szSounds[g_iSounds][szTitle])         remove_quotes(g_szSounds[g_iSounds++][szFile])     }         g_iSounds-- } public plugin_precache() {     fnLoadFile         for(new iCount = 0;iCount < g_iSounds;iCount++)         precache_sound(g_szSounds[iCount][szFile]) }         public fnCmdSoundMenu(id) {     new szMenu[512],iPos         iPos += format(szMenu[iPos],511-iPos,"Sound Menu^n^n")     for(new iCount = g_iMenuPosition[id] * 7;iCount <= (g_iMenuPosition[id] * 7) + 7;iCount++)         iPos += format(szMenu[iPos],511-iPos,"%i. %s^n",iCount - (g_iMenuPosition[id] * 7) + 1,g_szSounds[iCount][szTitle])     format(szMenu[iPos],511-iPos,"^n8. Previous Page^n9. Next Page^n^n0. Exit")             show_menu(id,g_iKeys,szMenu,-1,g_szMenuTitle) }     public fnHandleSoundMenu(id,iKey) {     switch(iKey)     {         // previous page         case 9:             if(g_iMenuPosition[id])             {                 g_iMenuPosition[id]--                 fnCmdSoundMenu(id)             }         // next page         case 0:             if(g_iMenuPosition[id] * 7 < g_iSounds)             {                 g_iMenuPosition[id]++                 fnCmdSoundMenu(id)             }         // exit         case 1:             return PLUGIN_CONTINUE         default:             client_cmd(0,"spk ^"%s^"",g_szSounds[(g_iMenuPosition[id] * 7) + iKey][szFile])     }         return PLUGIN_CONTINUE }
__________________
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:25.


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