Raised This Month: $ Target: $400
 0% 

Music player with menu


Post New Thread Reply   
 
Thread Tools Display Modes
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
Rixorster
Senior Member
Join Date: Jul 2005
Old 03-21-2006 , 13:51  
Reply With Quote #2

Code:
client_cmd(0,"spk ^"Pimplordz/Music/austin2.mp3^"")
__________________
You never know, what will happen the day after tomorrow...

+karma if i helped you!
Rixorster is offline
Timoses
Member
Join Date: Mar 2006
Location: Germany, NRW
Old 03-21-2006 , 14:09  
Reply With Quote #3

That doesn't work :s
And would it play the sound for all players around it in a certain distance?
btw. I am using amx version 1.01 for TSRP Harbu RP plugin.
Timoses is offline
Send a message via ICQ to Timoses Send a message via MSN to Timoses
v3x
Veteran Member
Join Date: Oct 2004
Location: US
Old 03-21-2006 , 14:47  
Reply With Quote #4

The *new* menu system is sexy
__________________
What am I doing these days? Well, I run my own Rust server. It's heavily modded. If you'd like to join, the ip is 167.114.101.67:28116

I also created a website called Rust Tools. It will calculate and tell you the raw amounts of resources needed to craft items.
v3x is offline
Rixorster
Senior Member
Join Date: Jul 2005
Old 03-21-2006 , 14:48  
Reply With Quote #5

Hmm, it should work >_<
Ill edit this post if i find working one >_>
(WHY YOU PEOPLE GIVE ME - KARMA, WHAT HAVE I DONE WRONG? )
__________________
You never know, what will happen the day after tomorrow...

+karma if i helped you!
Rixorster is offline
Timoses
Member
Join Date: Mar 2006
Location: Germany, NRW
Old 03-21-2006 , 15:14  
Reply With Quote #6

or do I maybe have to do it like

Code:
if(key == 0) {           emit_sound(id, CHAN_AUTO, "Pimplordz/Music/austin2.mp3", 1.0, ATTN_NORM, 0, PITCH_NORM) } //or with the client_cmd if(key == 1) {            client_cmd(0,"spk ^"Pimplordz/Music/austin2.mp3^"") } // are mp3 files possible at all? // and does the sound play for people around this guy also? // and about that that the sound should appear from like an origin or 2 origings o.o //got so many questions arrgh.
Timoses is offline
Send a message via ICQ to Timoses Send a message via MSN to Timoses
organizedKaoS
Senior Member
Join Date: Feb 2006
Old 03-21-2006 , 17:12  
Reply With Quote #7

Quote:
Originally Posted by Rixorster
Code:
client_cmd(0,"spk ^"Pimplordz/Music/austin2.mp3^"")
Not the correct way to play mp3's in half-life.

I dont believe you can use mp3's in emit sound. You might have to find another route
organizedKaoS is offline
[ --<-@ ] Black Rose
ANNIHILATED
Join Date: Sep 2005
Location: Stockholm, Sweden.
Old 03-22-2006 , 01:19  
Reply With Quote #8

think its like
Code:
client_cmd(id, "mp3 play Pimplordz/Music/austin2.mp3")
[ --<-@ ] Black Rose is offline
organizedKaoS
Senior Member
Join Date: Feb 2006
Old 03-22-2006 , 02:21  
Reply With Quote #9

Quote:
Originally Posted by [ --<-@
Black Rose]think its like
Code:
client_cmd(id, "mp3 play Pimplordz/Music/austin2.mp3")
Absolutely correct. mp3 play then the entire file directory. BUT, the mp3 file must be at least inside the sound folder.
organizedKaoS is offline
Timoses
Member
Join Date: Mar 2006
Location: Germany, NRW
Old 03-22-2006 , 09:35  
Reply With Quote #10

It doesn't work!!!
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) client(id, "mp3 play Pimplordz/Music/austin2.mp3")     if(key == 1) client_cmd(id,"play Pimplordz/Music/gman.wav")     if(key == 2) client_cmd(id, "play Pimplordz/Music/gman.wav")     if(key == 3) client_cmd(id," play Pimplordz/Music/gman.wav")     if(key == 4) client_cmd(id, " play Pimplordz/Music/gman.wav")     if(key == 5)     bar_play_music_show(id)     return PLUGIN_HANDLED }

I think something is wrong with the if clauses.
Because if I put this

Code:
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")     client_cmd(id, "play Pimplordz/Music/gman.wav")      //here I put the command                                                                                     //if I open the menu "Music Player" then the sound plays!     show_menu(id,key,body)     return PLUGIN_HANDLED }
Timoses is offline
Send a message via ICQ to Timoses Send a message via MSN to Timoses
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 16:47.


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