AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   [HELP] Background music on HLDS (https://forums.alliedmods.net/showthread.php?t=229373)

m.touqeerafzal 11-06-2013 12:19

[HELP] Background music on HLDS
 
can any 1 tell me how to play any music on background in my HLDS when players were playing CS..

m4m3ts 11-06-2013 18:36

Re: [HELP] Background music on HLDS
 
Quote:

Originally Posted by m.touqeerafzal (Post 2057579)
can any 1 tell me how to play any music on background in my HLDS when players were playing CS..

put your music file on CS folder
Counter-Strike 1.6\cstrike\sound\ambience\ (put in here)
you only can play .wav format.

then play cs, open console, type this
spk ambience/yourMusictitle
hit enter.

type stopsound to stop music.
that's for 1 player only.

this for all player.
only admin can execute this.

PHP Code:

#include <amxmodx>

public plugin_precache()
{
    
precache_sound("ambience/yourMusictitle.wav")
}

public 
plugin_init()
{
    
register_plugin"playMusic""1.0""m4m3ts" )

    
register_clcmd("say /play""playmusic"ADMIN_BAN)
    
register_clcmd("say /stop""stopmusic"ADMIN_BAN)
}

public 
playmusic(id)
{
    
client_cmd0"yourMusictitle")
}

public 
stopmusic(id)
{
    
client_cmd0"stopsound")



m.touqeerafzal 11-06-2013 21:01

Re: [HELP] Background music on HLDS
 
Thanx buddy..

It was really helpful... but i want to correct you,

//This code does'nt work
public playmusic(id)
{
client_cmd( 0, "yourMusictitle")
}

//Then I tried this, and it works really awesome
public playmusic(id)
{
client_cmd( 0, "spk ambience/yourMusictitle")
}


Really thanx buddy :) (Y) (Y)

m.touqeerafzal 11-06-2013 21:32

Re: [HELP] Background music on HLDS
 
Using this code... music is only played once... but i want to play that music on repeat what should i do??? plzz help.... :)

m4m3ts 11-06-2013 22:47

Re: [HELP] Background music on HLDS
 
Quote:

Originally Posted by m.touqeerafzal (Post 2057759)
client_cmd( 0, "spk ambience/yourMusictitle")

that's what i mean...
i don't know to loop music..

ironskillz1 11-07-2013 12:26

Re: [HELP] Background music on HLDS
 
PHP Code:

#include <amxmodx>

#define MUSICTIME 180.0 // Write the Song time in seconds here

public plugin_precache()
{
    
precache_sound("ambience/yourMusictitle.wav")
}

public 
plugin_init()
{
    
register_plugin"playMusic""1.0""m4m3ts" )
    
    
register_clcmd("say /play""playmusic"ADMIN_BAN)
    
register_clcmd("say /stop""stopmusic"ADMIN_BAN)
}

public 
playmusic(id)
{
    
remove_task()
    
client_cmd0"spk ambience/yourMusictitle.wav")
    
set_task(MUSICTIME"playmusic")
}

public 
stopmusic(id)
{
    
client_cmd0"stopsound")
    
remove_task()



m.touqeerafzal 11-07-2013 13:27

Re: [HELP] Background music on HLDS
 
thanx buddy it is helpful... :) :)


All times are GMT -4. The time now is 23:16.

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