AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   Help with multiple menus plz! (https://forums.alliedmods.net/showthread.php?t=29171)

Rolnaaba 05-31-2006 10:24

Help with multiple menus plz!
 
I have the menu #1 set so that if you press 8 it goes to menu page 2 but for somereason it just keeps skipping to menu page 3 help lol here is what I have:
Code:
//*****{THE INCLUDES}***** #include <amxmodx> #include <amxmisc> #include <engine> #include <cstrike> #define KeysVolkswagonSounds (1<<0)|(1<<1)|(1<<2)|(1<<3)|(1<<4)|(1<<5)|(1<<6)|(1<<7)|(1<<8 )|(1<<9) #define KeysVolkswagonSounds2 (1<<0)|(1<<1)|(1<<2)|(1<<3)|(1<<4)|(1<<5)|(1<<6)|(1<<7)|(1<<8 ) #define KeysVolkswagonSounds3 (1<<0)|(1<<1)|(1<<2)|(1<<3)|(1<<4) //*****{SOUND VARIABLES}***** new g_szDroppeditlikeitshott[] = "misc/vsounds/droppeditlikeitshott.mp3" new g_szFly[] = "misc/vsounds/fly.mp3" new g_szHoldingitdown[] = "misc/vsounds/holdingitdown.mp3" new g_szItsucksair[] = "misc/vsounds/itsucksair.mp3" new g_szListenup[] = "misc/vsounds/listenup.mp3" new g_szRepdutch[] = "misc/vsounds/repdutch.mp3" new g_szTime2unpimp[] = "misc/vsounds/time2unpimp.mp3" new g_szUknowwhat[] = "misc/vsounds/uknowwhat.mp3" new g_szVdub[] = "misc/vsounds/vdub.mp3" new g_szYaa[] = "misc/vsounds/yaa.mp3" new g_szFatcha[] = "misc/vsounds/fatcha.mp3" new g_szGermanENindahaus[] = "misc/vsounds/germanENindahaus.mp3" new g_szItsdefsucking[] = "misc/vsounds/itsdefsucking.mp3" new g_szLemmeHUSV[] = "misc/vsounds/lemmeH-U-S-V.mp3" new g_szOhsnap[] = "misc/vsounds/ohsnap.mp3" new g_szTime[] = "misc/vsounds/time.mp3" new g_szTreyandhisride[] = "misc/vsounds/treyandhisride.mp3" new g_szUnpimpyourauto[] = "misc/vsounds/unpimpyourauto.mp3" new g_szWhatdoesthisdo[] = "misc/vsounds/whatdoesthisdo.mp3" new g_szYougetanF[] = "misc/vsounds/yougetanF.mp3" //*****{SOUND PRECACHE}***** public plugin_precache() {     precache_generic(g_szDroppeditlikeitshott)     precache_generic(g_szFly)     precache_generic(g_szHoldingitdown)     precache_generic(g_szItsucksair)     precache_generic(g_szListenup)     precache_generic(g_szRepdutch)     precache_generic(g_szTime2unpimp)     precache_generic(g_szUknowwhat)     precache_generic(g_szVdub)     precache_generic(g_szYaa)     precache_generic(g_szFatcha)     precache_generic(g_szGermanENindahaus)     precache_generic(g_szItsdefsucking)     precache_generic(g_szLemmeHUSV)     precache_generic(g_szOhsnap)     precache_generic(g_szTime)     precache_generic(g_szTreyandhisride)     precache_generic(g_szUnpimpyourauto)     precache_generic(g_szWhatdoesthisdo)     precache_generic(g_szYougetanF) } //*****{PLUGIN INIT}***** public plugin_init() {     register_plugin("VolkswagonSounds","1.0","Rolnaaba")     register_menucmd(register_menuid("Volkswagon Sounds"), KeysVolkswagonSounds, "PressedVolkswagonSounds")     register_menucmd(register_menuid("Volkswagon Sounds"), KeysVolkswagonSounds2, "PressedVolkswagonSounds2")     register_menucmd(register_menuid("Volkswagon Sounds"), KeysVolkswagonSounds3, "PressedVolkswagonSounds3")     register_concmd("say /vsounds", "ShowVolkswagonSounds") } //*****{PLAYS SONGS}***** public play_Droppeditlikeitshott(id) {     client_cmd(id,"mp3 play ^"%s^"",g_szDroppeditlikeitshott) } public play_Fly(id) {     client_cmd(id,"mp3 play ^"%s^"",g_szFly) } public play_Holdingitdown(id) {     client_cmd(id,"mp3 play ^"%s^"",g_szItsucksair) } public play_Itsucksair(id) {     client_cmd(id,"mp3 play ^"%s^"",g_szItsucksair) } public play_Listenup(id) {     client_cmd(id,"mp3 play ^"%s^"",g_szListenup) } public play_Repdutch(id) {     client_cmd(id,"mp3 play ^"%s^"",g_szRepdutch) } public play_Time2unpimp(id) {     client_cmd(id,"mp3 play ^"%s^"",g_szTime2unpimp) } public play_Uknowwhat(id) {     client_cmd(id,"mp3 play ^"%s^"",g_szUknowwhat) } public play_Vdub(id) {     client_cmd(id,"mp3 play ^"%s^"",g_szVdub) } public play_Yaa(id) {     client_cmd(id,"mp3 play ^"%s^"",g_szYaa) } public play_Fatcha(id) {     client_cmd(id,"mp3 play ^"%s^"",g_szFatcha) } public play_GermanEnindahaus(id) {     client_cmd(id,"mp3 play ^"%s^"",g_szGermanENindahaus) } public play_Itsdefsucking(id) {     client_cmd(id,"mp3 play ^"%s^"",g_szItsdefsucking) } public play_LemmeHUSV(id) {     client_cmd(id,"mp3 play ^"%s^"",g_szLemmeHUSV) } public play_Ohsnap(id) {     client_cmd(id,"mp3 play ^"%s^"",g_szOhsnap) } public play_Time(id) {     client_cmd(id,"mp3 play ^"%s^"",g_szTime) } public play_Treyandhisride(id) {     client_cmd(id,"mp3 play ^"%s^"",g_szTreyandhisride) } public play_Unpimpyourauto(id) {     client_cmd(id,"mp3 play ^"%s^"",g_szUnpimpyourauto) } public play_Whatdoesthisdo(id) {     client_cmd(id,"mp3 play ^"%s^"",g_szWhatdoesthisdo) } public play_YougetanF(id) {     client_cmd(id,"mp3 play ^"%s^"",g_szYougetanF) } public END_MENU(id) {     return PLUGIN_HANDLED } //*****{SHOWS MENU PAGE 1}***** public ShowVolkswagonSounds(id) {     show_menu(id, KeysVolkswagonSounds, "1. Dropped it like its hott^n2. Fly^n3. Holding it down^n4. It sucks air^n5. Listen up^n6. Rep dutch^n7. Time to unpimp^n8. You know what^n^n9. Next Page^n0. Exit", -1, "Volkswagon Sounds")     return PLUGIN_HANDLED } //*****{SHOWS MENU PAGE 2}***** public ShowVolkswagonSounds2(id) {     show_menu(id, KeysVolkswagonSounds2, "1. Vdub^n2. Yaa^n3. Fatcha^n4. German engineering in da haus^n5. Its definately sucking^n6. Lemme H-U-S-V^n7. Exit", -1, "Volkswagon Sounds") } //*****{SHOWS MENU PAGE 3}***** public ShowVolkswagonSounds3(id) {     show_menu(id, KeysVolkswagonSounds3, "1. You know what^n2. Trey and his ride^n3. Unpimp your auto^n4. What does this do^n5. You get an F^n^n6. Exit^n", -1, "Volkswagon Sounds") } //*****{GETS WHAT KEY YOU PRESS ON MENU PAGE 1}***** public PressedVolkswagonSounds(id, key) {     switch (key)     {         case 0:         {             play_Droppeditlikeitshott(id)         }         case 1:         {             play_Fly(id)         }         case 2:         {             play_Holdingitdown(id)         }         case 3:         {             play_Itsucksair(id)         }         case 4:         {             play_Listenup(id)         }         case 5:         {             play_Repdutch(id)         }         case 6:         {             play_Time2unpimp(id)         }         case 7:         {             ShowVolkswagonSounds2(id)         }         case 8:         {             END_MENU(id)         }     } } //*****{GETS BUTTON YOU PRESS ON MENU PAGE 2}***** public PressedVolkswagonSounds2(id, key) {     switch (key)     {         case 0:         {             play_Vdub(id)         }         case 1:         {             play_Yaa(id)         }         case 2:         {             play_Fatcha(id)         }         case 3:         {             play_GermanEnindahaus(id)         }         case 4:         {             play_Itsdefsucking(id)         }         case 5:         {             play_LemmeHUSV(id)         }         case 6:         {             play_Ohsnap(id)         }         case 7:         {             play_Time(id)         }         case 8:         {             ShowVolkswagonSounds3(id)         }         case 9:         {             END_MENU(id)         }     } } //*****{GETS BUTTON YOU PRESS ON MENU PAGE 3}****** public PressedVolkswagonSounds3(id, key) {     switch (key)     {         case 0:         {             play_Uknowwhat(id)         }         case 1:         {             play_Treyandhisride(id)         }         case 2:         {             play_Unpimpyourauto(id)         }         case 3:         {             play_Whatdoesthisdo(id)         }         case 4:         {             play_YougetanF(id)         }         case 5:         {             END_MENU(id)         }     } }
on the define keys at the top I know the 8's have spaces after them thats is only so they don't become this --> 8) in the code for the forum post

p3tsin 05-31-2006 12:23

could it be coz all the menus have same menuid?

Code:
    register_menucmd(register_menuid("Volkswagon Sounds"), KeysVolkswagonSounds, "PressedVolkswagonSounds")     register_menucmd(register_menuid("Volkswagon Sounds"), KeysVolkswagonSounds2, "PressedVolkswagonSounds2")     register_menucmd(register_menuid("Volkswagon Sounds"), KeysVolkswagonSounds3, "PressedVolkswagonSounds3")

btw, u could make the plugin alot smaller by doing this:

Code:
new const g_szSounds1[7][] = {     "droppeditlikeitshott.mp3",     "fly.mp3",     "holdingitdown.mp3",     "itsucksair.mp3",     "listenup.mp3",     "repdutch.mp3",     "time2unpimp.mp3" } ... public PressedVolkswagonSounds(id, key) {     switch (key)       {         case 7:         {             ShowVolkswagonSounds2(id)         }         case 8:         {             END_MENU(id)         }         default:         {             client_cmd(id, "mp3 play ^"misc/vsounds/%s^"", g_szSounds1[key])         }     } }

Hawk552 05-31-2006 15:13

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 }

Rolnaaba 05-31-2006 15:39

wow yours is way more complex than mine lol ;)


All times are GMT -4. The time now is 16:25.

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