AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   Sound not played (https://forums.alliedmods.net/showthread.php?t=204467)

pewex 12-30-2012 14:34

Sound not played
 
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

YamiKaitou 12-30-2012 14:35

Re: Sound not played
 
client_cmd( 0, "mp3 play ^"sound/%s^"", AmbienSound );

rastafari 12-30-2012 15:03

Re: Sound not played
 
For precaching mp3 it is not needed or better to use "precache_generic"?

YamiKaitou 12-30-2012 15:09

Re: Sound not played
 
Quote:

Originally Posted by rastafari (Post 1863676)
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


All times are GMT -4. The time now is 13:27.

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