Raised This Month: $ Target: $400
 0% 

mp3 play problems


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
pob18
Member
Join Date: Jun 2014
Old 07-01-2014 , 10:37   mp3 play problems
Reply With Quote #1

why the music does not play at te rr time?

PHP Code:
#include <amxmodx>
#include <amxmisc>
#include <dhudmessage>
#include <hamsandwich>
#include <fun>

#define PRECACHE_SOUND "server/music.mp3"

new TimerSecondsCvar
new bool:g_knife true

public plugin_init()
{
    
register_event("DeathMsg""on_death""a")
    
register_event"CurWeapon""EventCurWeapon""be""2!29" )
    
    
SecondsCvar register_cvar("auto_rr_time","50.0")

    
Timer get_pcvar_num(SecondsCvar)
    
set_task(1.0"start_rr_timer"___"a"Timer)
}


public 
plugin_precache()
    
precache_sound(PRECACHE_SOUND)


public 
on_death()
{
    new 
victim
    victim 
read_data(2)
    
    if(
g_knife)
        
set_task(1.0"fnRevivePlayer"victim)
}

public 
fnRevivePlayer(id
{
    if(!
is_user_alive(id)) 
        
ExecuteHamB(Ham_CS_RoundRespawnid)    
}

public 
EventCurWeapon(id)
{
    if(
g_knife)
    {
        
engclient_cmd(id"weapon_knife")
        
set_user_gravity(id0.5)
    }
}

public 
start_rr_timer()
{
    
Timer--
    
    
//client_cmd(0, "stopsound")
    
client_cmd(0"spk ^"%s^""PRECACHE_SOUND)
    
    
set_dhudmessage(24000, -1.00.0800.00.01)
    
show_dhudmessage(0"auto restart in·: %d"Timer)

    if(
Timer 1)
    {
        
server_cmd("sv_restartround 1")
        
set_task(3.0"rr_end")
        
set_task(3.0"off_gravity")
        
g_knife false
    
}
}

public 
rr_end()
{
    
set_dhudmessage(random_num(0255), random_num(0255), random_num(0255), -1.00.7826.03.00.11.5false )
    
show_dhudmessage(0"good luck!")
}

public 
off_gravity(id
{
    
client_cmd(0"stopsound")
    new 
players[32], num
    get_players
(playersnum"c")
    for (new 
0;num;i++)
                   
set_user_gravity(players[i], 1.0

pob18 is offline
Flick3rR
Veteran Member
Join Date: Feb 2014
Location: Bulgaria, Stara Zagora
Old 07-01-2014 , 12:33   Re: mp3 play problems
Reply With Quote #2

As far as I know, client_cmd is blocked by the engine with the new updates. Also, it should be "mp3 play" instead of "spk"
__________________
Flick3rR is offline
Send a message via Skype™ to Flick3rR
Flick3rR
Veteran Member
Join Date: Feb 2014
Location: Bulgaria, Stara Zagora
Old 07-01-2014 , 14:26   Re: mp3 play problems
Reply With Quote #3

1)I will have to repeat myself.
Quote:
Originally Posted by Flick3rR View Post
As far as I know, client_cmd is blocked by the engine with the new updates.
If I'm wrong, let someone correct me.
2) Where is your sound?
3) I think that it should be in "sound/misc" folder (if it's .wav, I'm not sure)
__________________

Last edited by Flick3rR; 07-01-2014 at 14:28.
Flick3rR is offline
Send a message via Skype™ to Flick3rR
pob18
Member
Join Date: Jun 2014
Old 07-01-2014 , 14:33   Re: mp3 play problems
Reply With Quote #4

Quote:
Originally Posted by Flick3rR View Post
1)I will have to repeat myself.

If I'm wrong, let someone correct me.
2) Where is your sound?
3) I think that it should be in "sound/misc" folder (if it's .wav, I'm not sure)
I changed the code to Freezo ones, the sound are located at "sound/myfolder/sound.mp3"
pob18 is offline
Flick3rR
Veteran Member
Join Date: Feb 2014
Location: Bulgaria, Stara Zagora
Old 07-01-2014 , 14:49   Re: mp3 play problems
Reply With Quote #5

Try to change it with "misc/myserver/music.mp3".
And also:
Quote:
Originally Posted by Flick3rR View Post
As far as I know, client_cmd is blocked by the engine with the new updates.
__________________
Flick3rR is offline
Send a message via Skype™ to Flick3rR
Freezo Begin
BANNED
Join Date: Mar 2014
Location: Morocco
Old 07-01-2014 , 14:54   Re: mp3 play problems
Reply With Quote #6

try this again .
Code:
stock PlaySound(id, const sound[]) {     if (equal(sound[strlen(sound)-4], ".mp3"))         client_cmd(id, "mp3 play ^"sound/%s^"", sound)     else         client_cmd(id, "spk ^"%s^"", sound) }
Freezo Begin is offline
YamiKaitou
Has a lovely bunch of coconuts
Join Date: Apr 2006
Location: Texas
Old 07-01-2014 , 21:37   Re: mp3 play problems
Reply With Quote #7

Quote:
Originally Posted by Flick3rR View Post
As far as I know, client_cmd is blocked by the engine with the new updates.
Wrong, client_cmd works just fine as long as the command you are sending the client is not one of the blocked commands.
__________________
ProjectYami Laboratories

I do not browse the forums regularly anymore. If you need me for anything (asking questions or anything else), then PM me (be descriptive in your PM, message containing only a link to a thread will be ignored).
YamiKaitou is offline
Freezo Begin
BANNED
Join Date: Mar 2014
Location: Morocco
Old 07-01-2014 , 12:40   Re: mp3 play problems
Reply With Quote #8

Or, Simply use this

Code:
stock PlaySound(id, const sound[]) {     if (equal(sound[strlen(sound)-4], ".mp3"))         client_cmd(id, "mp3 play ^"%s^"", sound)     else         client_cmd(id, "spk ^"%s^"", sound) }

then you will have to do this

Code:
PlaySound(0,PRECACHE_SOUND)

Last edited by Freezo Begin; 07-01-2014 at 12:42.
Freezo Begin is offline
pob18
Member
Join Date: Jun 2014
Old 07-01-2014 , 14:16   Re: mp3 play problems
Reply With Quote #9

still does not play
pob18 is offline
Flick3rR
Veteran Member
Join Date: Feb 2014
Location: Bulgaria, Stara Zagora
Old 07-01-2014 , 14:34   Re: mp3 play problems
Reply With Quote #10

Post the code you have, because I've got confused... These directories are messing something.
__________________
Flick3rR is offline
Send a message via Skype™ to Flick3rR
Reply



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


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