AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   (script.help) play music only once (https://forums.alliedmods.net/showthread.php?t=90097)

algoasi 04-14-2009 02:31

(script.help) play music only once
 
1 Attachment(s)
I have this script. but I have a problem.

playing infinitely

I just want to be heard only once

not permanently



Hunter-Digital 04-14-2009 04:02

Re: (script.help) play music only once
 
Code:

client_cmd(player,"mp3 loop sound/misc/0007.mp3")
instead of "loop" place "play".

Arkshine 04-14-2009 06:29

Re: (script.help) play music only once
 
@algoasi: you shoud use precache_generic for mp3. What do you want to do exactly ?

Something this is better, but can be coded in a more appropriate way depending your need :

PHP Code:

#include <amxmodx>
#include <cstrike>

const MAX_CLIENTS 32;
new 
bool:playingMAX_CLIENTS ];

new const 
gSound[] = "sound/misc/0007.mp3";

public 
plugin_precache() 
{
    
precache_genericgSound );
}

public 
plugin_init()
 { 
    
register_plugin"Loading Song""1.0""Torch" );
    
register_event"ResetHUD""song""b" );
    
register_event"TextMsg""song""b""2&#Spec_Mode" );


public 
song( const id 
{
    switch ( 
cs_get_user_teamid ) )
    {
        case 
CS_TEAM_SPECTATORCS_TEAM_UNASSIGNED :
        {
            if ( !
playingid ] )
            {
                
set_task0.5"play_song_task"id );
                
playingid ] = true;
            }
        }
        default :
        {
            
client_cmdid"mp3 stop" );
            
playingid ]= false;
        }
    }
}

public 
play_song_task( const id )
{
    
client_cmdid"mp3 play %s"gSound );




All times are GMT -4. The time now is 02:18.

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