Raised This Month: $ Target: $400
 0% 

Music player with menu


  
 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
Author Message
Timoses
Member
Join Date: Mar 2006
Location: Germany, NRW
Old 03-21-2006 , 12:28   Music player with menu
Reply With Quote #1

Hi guys!

I'm trying to make a menu which opens up if you say /buy in front of a tv
in bar in the map shaunsville_b5v7.
The menu is working and stuff.
But if I now choose one of the songs it doesn't play.
is emit_sound the only way to play sounds?
I guess I can't use it the way I used it there.

And can I play the songs from like one point? like in the center of a room?
(with coordinates some how?) or maybe with 2 points ( so you actually have
2 sound boxes) or even 3 or 4 boxes?

Here's what I got:

Code:
public bar_play_music(id,key) {     if(!is_user_alive(id)) return PLUGIN_HANDLED     new origin[3]     get_user_origin(id,origin)     if(get_distance(origin,bar_tv) > 25.0) return PLUGIN_HANDLED     if(key == 6) return PLUGIN_HANDLED     if(key == 0) emit_sound(id, CHAN_ITEM, "Pimplordz/Music/austin2.mp3", 1.0, ATTN_NORM, 0, PITCH_NORM)     if(key == 1) emit_sound(id, CHAN_ITEM, "Pimplordz/Music/coldasice.mp3", 1.0, ATTN_NORM, 0, PITCH_NORM)     if(key == 2) emit_sound(id, CHAN_ITEM, "Pimplordz/Music/gman.wav", 1.0, ATTN_NORM, 0, PITCH_NORM)     if(key == 3) emit_sound(id, CHAN_ITEM, "Pimplordz/Music/jskil.wav", 1.0, ATTN_NORM, 0, PITCH_NORM)     if(key == 4) emit_sound(id, CHAN_ITEM, "Pimplordz/Music/pulp.mp3", 1.0, ATTN_NORM, 0, PITCH_NORM)     if(key == 5) emit_sound(id, CHAN_ITEM, "Pimplordz/Music/whatislove.wav", 1.0, ATTN_NORM, 0, PITCH_NORM)     bar_play_music_show(id)     return PLUGIN_HANDLED }

If you need more of the code then tell me. Hope this time somebody will
reply o.o ;)

The whole code ..

Code:
public tv_bar_guess(id) {     new body[256]     new key = (1<<0|1<<1|1<<2|1<<3|1<<4|1<<5|1<<6|1<<7|1<<8|1<<9)     new len = format(body,sizeof(body),"Bar TV + Music Player^n")     len += format(body[len],sizeof(body)-len,"---------------------------------------^n")     len += format(body[len],sizeof(body)-len,"              .%i.%i.%i.%i.%i.        ^n",bar_guesscode[id][0],bar_guesscode[id][1],bar_guesscode[id][2],bar_guesscode[id][3],bar_guesscode[id][4])     len += format(body[len],sizeof(body)-len,"---------------------------------------^n")     add(body,sizeof(body),"^n0. Exit^n")     show_menu(id,key,body)     return PLUGIN_HANDLED } public action_bar_guess(id,key) {     if(!is_user_alive(id)) return PLUGIN_HANDLED     new origin[3]     get_user_origin(id,origin)     if(get_distance(origin,bar_tv) > 25.0) return PLUGIN_HANDLED     if(key == 9) return PLUGIN_HANDLED         for(new i = 0;i < 5;i++) {  // Search for the specific slot and set value         if(bar_guesscode[id][i] == 0) {         bar_guesscode[id][i] = key+1         break         }     }         if(bar_guesscode[id][4] != 0)   // If last number then show menu     {         if(bar_guesscode[id][0] == bar_rightpass[0] && bar_guesscode[id][1] == bar_rightpass[1] && bar_guesscode[id][2] == bar_rightpass[2] && bar_guesscode[id][3] == bar_rightpass[3] && bar_guesscode[id][4] == bar_rightpass[4]) bar_menu(id)         else {             for(new i = 0;i < 5;i++) {             bar_guesscode[id][i] = 0             }         }         return PLUGIN_HANDLED     }     else                // If NOT last then reshow menu     {         tv_bar_guess(id)         return PLUGIN_HANDLED     }     return PLUGIN_HANDLED } public bar_menu(id) {     if(!is_user_alive(id)) return PLUGIN_HANDLED     client_print(id,print_chat,"[LaptopMod] Correct Code!")     for(new i = 0;i < 5;i++) {         leet_guesscode[id][i] = 0     }         new body[256]     new key = (1<<0|1<<9)     new len = format(body,sizeof(body),"Music Player Menu^n")         add(body,sizeof(body),"^n1. Music Player^n")     add(body,sizeof(body),"^n0. Close Menu^n")     show_menu(id,key,body)     return PLUGIN_HANDLED } public action_bar_menu(id,key) {     if(!is_user_alive(id)) return PLUGIN_HANDLED     new origin[3]     get_user_origin(id,origin)     if(get_distance(origin,bar_tv) > 25.0) return PLUGIN_HANDLED     if(key == 9) return PLUGIN_HANDLED     if(key == 0) bar_play_music_show(id)     return PLUGIN_HANDLED } public bar_play_music_show(id) {     new body[256]     new key = (1<<0|1<<1|1<<2|1<<3|1<<4|1<<5|1<<6|1<<7|1<<8|1<<9)     new len = format(body,sizeof(body),"Music Player^n^n")     add(body,sizeof(body),"1. Austin Powers^n")     add(body,sizeof(body),"2. Will Smith - Switch^n")     add(body,sizeof(body),"3. Happy Music o.o^n")     add(body,sizeof(body),"4. Sad Music :(^n")     add(body,sizeof(body),"5. Pulp Fiction^n")     add(body,sizeof(body),"6. What is love?")     add(body,sizeof(body),"^n0. Close Menu^n")     show_menu(id,key,body)     return PLUGIN_HANDLED } public bar_play_music(id,key) {     if(!is_user_alive(id)) return PLUGIN_HANDLED     new origin[3]     get_user_origin(id,origin)     if(get_distance(origin,bar_tv) > 25.0) return PLUGIN_HANDLED     if(key == 6) return PLUGIN_HANDLED     if(key == 0) console_cmd(id,"play Pimplordz/Music/gman.wav")     if(key == 1) console_cmd(0,"play Pimplordz/Music/gman.wav")     if(key == 2) console_cmd(id,"play Pimplordz/Music/gman.wav")     if(key == 3) console_cmd(0,"play Pimplordz/Music/gman.wav")     if(key == 4)     if(key == 5)     bar_play_music_show(id)     return PLUGIN_HANDLED }
Attached Files
File Type: sma Get Plugin or Get Source (harburpalpha.sma - 559 views - 206.6 KB)
Timoses is offline
Send a message via ICQ to Timoses Send a message via MSN to Timoses
 



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:47.


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