Raised This Month: $ Target: $400
 0% 

Sound not played


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
pewex
Senior Member
Join Date: Dec 2010
Location: AlliedMods
Old 12-30-2012 , 14:34   Sound not played
Reply With Quote #1

Hello, sound download, not played ambience random one round:

sma:

Code:
#include <amxmodx>

new const AmbienSound[] = "misc/sds.mp3";

#define POSSIBLE_ROUND_NUM_PER_MAP 50

new i
new g_iPlayed

public plugin_precache () 
{
    precache_sound( AmbienSound );
}

public plugin_init () 
{
    register_plugin( "Ambience Sound", "0.1",  "DeeKeiD" );
    register_logevent( "OnRoundStart", 2, "1=Round_Start" );
    
    i = random_num(1, POSSIBLE_ROUND_NUM_PER_MAP)
}

public OnRoundStart()
{    
    static i2
    if(!g_iPlayed)
    {
        ++i2
        if(i2 == i)
        {
            g_iPlayed = 1
            client_cmd( 0, "mp3 play %s", AmbienSound );
        }
    }
}
Please hellp
pewex is offline
YamiKaitou
Has a lovely bunch of coconuts
Join Date: Apr 2006
Location: Texas
Old 12-30-2012 , 14:35   Re: Sound not played
Reply With Quote #2

client_cmd( 0, "mp3 play ^"sound/%s^"", AmbienSound );
__________________
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
rastafari
Senior Member
Join Date: May 2011
Old 12-30-2012 , 15:03   Re: Sound not played
Reply With Quote #3

For precaching mp3 it is not needed or better to use "precache_generic"?
__________________
rastafari is offline
YamiKaitou
Has a lovely bunch of coconuts
Join Date: Apr 2006
Location: Texas
Old 12-30-2012 , 15:09   Re: Sound not played
Reply With Quote #4

Quote:
Originally Posted by rastafari View Post
For precaching mp3 it is not needed or better to use "precache_generic"?
You need to precache it otherwise you won't know if the client has the file. You can precache it as a sound with no problems
__________________
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
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 13:27.


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