Raised This Month: $ Target: $400
 0% 

I need help with this code


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
awwhailnaw
Member
Join Date: Jul 2007
Old 07-07-2007 , 19:25   I need help with this code
Reply With Quote #1

ok the second menu opens and everything but when i push "1" it plays "carmod/wrong.wav" instead of "carmod/among.wav" like i want it to
tell me whats wrong with it please?

Code:
public plugin_init()
{
   register_menucmd(register_menuid("Radio Menu"),1023,"radio")
   register_menucmd(register_menuid("Radio Menu 2"),1023,"radio2")
}
public plugin_precache()
{
   precache_sound("carmod/gasoline.wav")
   precache_sound("carmod/superman.wav")
   precache_sound("carmod/among.wav")
   precache_sound("carmod/clint.wav")
   precache_sound("carmod/wrong.wav")
   precache_sound("carmod/diamondsandguns.wav")
   precache_sound("carmod/bob.wav")
   precache_sound("carmod/diary.wav")
   precache_sound("carmod/indk.wav")
}
public radiomenu(id) 
{
    new menu[1024]
    new key = (1<<0|1<<1|1<<2|1<<3|1<<4|1<<5|1<<6|1<<7|1<<8|1<<9)
    format(menu,sizeof(menu),"Radio Menu")
    add(menu,sizeof(menu)," ^n^n 1. Sublime - Wrong Way")
    add(menu,sizeof(menu),"^n 2. Transplants - Diamonds and Guns")
    add(menu,sizeof(menu),"^n 3. Goldfinger - Superman")
    add(menu,sizeof(menu),"^n 4. Outkast - B.O.B")
    add(menu,sizeof(menu),"^n 5. Gorillaz - Clint Eastwood")
    add(menu,sizeof(menu),"^n 6. InDK - Moonwalk Mafia")
    add(menu,sizeof(menu),"^n 7. No-Ca$h - Gasoline")
    add(menu,sizeof(menu),"^n 8. Breaknig Benjamin - Diary of Jane")
    add(menu,sizeof(menu),"^n 9. Next Page")
    add(menu,sizeof(menu),"^n^n 0. Close Menu")
    show_menu(id,key,menu)
    return PLUGIN_HANDLED;
}
public radiomenu2(id)
{
    new menu[1024]
    new key = (1<<0|1<<9)
    format(menu,1023,"Radio Menu - Page 2")
    add(menu,sizeof(menu)," ^n^n 1. Tim Armstrong - Among The Dead");
    add(menu,sizeof(menu),"^n^n 0. Close Menu");
    show_menu(id,key,menu)
    return PLUGIN_HANDLED;
}
public radio(id,key)
{
    switch(key)
    {
        case 0: 
        {
            if(incar[id] != 1) return PLUGIN_HANDLED
            emit_sound(id, CHAN_STREAM, "carmod/wrong.wav", 1.0, ATTN_NORM, 0, PITCH_NORM)
            return PLUGIN_HANDLED;
        }
        case 1:
        {
            if(incar[id] != 1) return PLUGIN_HANDLED
            emit_sound(id, CHAN_STREAM, "carmod/diamondsandguns.wav", 1.0, ATTN_NORM, 0, PITCH_NORM)
            return PLUGIN_HANDLED;
        }
        case 2:
        {
            if(incar[id] != 1) return PLUGIN_HANDLED
            emit_sound(id, CHAN_STREAM, "carmod/superman.wav", 1.0, ATTN_NORM, 0, PITCH_NORM)
            return PLUGIN_HANDLED;
        }
        case 3:
        {
            if(incar[id] != 1) return PLUGIN_HANDLED
            emit_sound(id, CHAN_STREAM, "carmod/bob.wav", 1.0, ATTN_NORM, 0, PITCH_NORM)
            return PLUGIN_HANDLED;
        }
        case 4:
        {
            if(incar[id] != 1) return PLUGIN_HANDLED
            emit_sound(id, CHAN_STREAM, "carmod/clint.wav", 1.0, ATTN_NORM, 0, PITCH_NORM)
            return PLUGIN_HANDLED;
        }
        case 5:
        {
            if(incar[id] != 1) return PLUGIN_HANDLED
            emit_sound(id, CHAN_STREAM, "carmod/indk.wav", 1.0, ATTN_NORM, 0, PITCH_NORM)
            return PLUGIN_HANDLED;
        }
        case 6:
        {
            if(incar[id] != 1) return PLUGIN_HANDLED
            emit_sound(id, CHAN_STREAM, "carmod/gasoline.wav", 1.0, ATTN_NORM, 0, PITCH_NORM)

            return PLUGIN_HANDLED;
        }
        case 7:
        {
            if(incar[id] != 1) return PLUGIN_HANDLED
            emit_sound(id, CHAN_STREAM, "carmod/diary.wav", 1.0, ATTN_NORM, 0, PITCH_NORM)

            return PLUGIN_HANDLED;
        }
        case 8:
        {
            radiomenu2(id)
            radio2(id,key)
            return PLUGIN_HANDLED;
        }

        case 9: client_print(id,print_chat,"[RadioMod]Radio Menu Closed")
    }
    return PLUGIN_HANDLED;
}
public radio2(id,key)
{
    switch(key)
    {
        case 0:
        {
            if(incar[id] != 1) return PLUGIN_HANDLED
            emit_sound(id, CHAN_STREAM, "carmod/among.wav", 1.0, ATTN_NORM, 0, PITCH_NORM)
            return PLUGIN_HANDLED
        }

        case 9: client_print(id,print_chat,"[RadioMod]Radio Menu Closed")
    }
    return PLUGIN_HANDLED;
}
awwhailnaw is offline
Zenith77
Veteran Member
Join Date: Aug 2005
Old 07-07-2007 , 22:06   Re: I need help with this code
Reply With Quote #2

case 0: is actually menu option #1. Case 1 is actually #2, and so on and so forth.
__________________
Quote:
Originally Posted by phorelyph View Post
your retatred
Zenith77 is offline
awwhailnaw
Member
Join Date: Jul 2007
Old 07-07-2007 , 22:45   Re: I need help with this code
Reply With Quote #3

yea i know..look at the code please...i think its set up right but...its not working
awwhailnaw is offline
djmd378
Senior Member
Join Date: Sep 2004
Old 07-07-2007 , 23:37   Re: I need help with this code
Reply With Quote #4

Well... maybe because you set 1 to be as "carmod/wrong.wav" instead of "carmod/among.wav"


Code:
        case 0:         {             if(incar[id] != 1) return PLUGIN_HANDLED             emit_sound(id, CHAN_STREAM, "carmod/wrong.wav", 1.0, ATTN_NORM, 0, PITCH_NORM)             return PLUGIN_HANDLED;         }
__________________
djmd378 is offline
awwhailnaw
Member
Join Date: Jul 2007
Old 07-07-2007 , 23:40   Re: I need help with this code
Reply With Quote #5

no....thats in the first menu....look at public radio2(id,key)
awwhailnaw is offline
Reply


Thread Tools
Display Modes

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 21:25.


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