AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   Song all Time (https://forums.alliedmods.net/showthread.php?t=184161)

valfarx 05-01-2012 14:57

Song all Time
 
hello, i want a Plugin, that play a song all the time that you enter in the server, and when the song finish, start again.
No i just have this plugin:

PHP Code:

#include <amxmodx>
#define PLUGIN "Musica"
#define VERSION "616"
#define AUTHOR "Lunatiko!"

public plugin_init() 
{
    
register_plugin(PLUGINVERSIONAUTHOR)
}

public 
client_connect(id)

client_cmd(id"mp3 loop sound/song/song.mp3")

public 
plugin_precache()
{
    
precache_generic("sound/song/song.mp3")




But this Plugin, just play the song in the Loading. I want the song continue, all the time Without need of a new round to play the song. You will be enter to the server, and the song playing always. No matter if u put sv_restart or something, always playing. Or a Task when you enter, the song start to play at 3 seg, and never stop. Sorry for my bad english.

Bilal Pro 05-01-2012 17:33

Re: Song all Time
 
PHP Code:

#include <amxmodx>
#define PLUGIN "Musica"
#define VERSION "616"
#define AUTHOR "Lunatiko!"

public plugin_init() 
{
    
register_plugin(PLUGINVERSIONAUTHOR)
}

public 
plugin_precache()
{
    
precache_generic("sound/song/song.mp3")


public 
client_putinserver(id)
{
    
client_cmd(id"mp3 sound/song/song.mp3")
    
client_print(id"Song is playing")



Exolent[jNr] 05-01-2012 17:36

Re: Song all Time
 
PHP Code:

#include <amxmodx>

#define PLUGIN "Musica"
#define VERSION "616"
#define AUTHOR "Lunatiko!"

new const gSoundFile[] = "sound/song/song.mp3";

public 
plugin_init() 
{
    
register_plugin(PLUGINVERSIONAUTHOR)
}

public 
client_connect(id)
{
    
client_cmd(id"mp3 loop %s"gSoundFile)
}

public 
client_putinserver(id)
{
    
client_cmd(id"mp3 loop %s"gSoundFile)
}

public 
plugin_precache()
{
    
precache_generic(gSoundFile)


@Bilal

You cannot use "spk" command with .mp3 files, and that command doesn't loop.

Bilal Pro 05-01-2012 17:39

Re: Song all Time
 
My bad

Exolent[jNr] 05-01-2012 17:43

Re: Song all Time
 
For normal play, it is "mp3 play sound.mp3".

valfarx 05-01-2012 19:06

Re: Song all Time
 
Quote:

Originally Posted by Exolent[jNr] (Post 1700119)
PHP Code:

#include <amxmodx>

#define PLUGIN "Musica"
#define VERSION "616"
#define AUTHOR "Lunatiko!"

new const gSoundFile[] = "sound/song/song.mp3";

public 
plugin_init() 
{
    
register_plugin(PLUGINVERSIONAUTHOR)
}

public 
client_connect(id)
{
    
client_cmd(id"mp3 loop %s"gSoundFile)
}

public 
client_putinserver(id)
{
    
client_cmd(id"mp3 loop %s"gSoundFile)
}

public 
plugin_precache()
{
    
precache_generic(gSoundFile)



I try this, and work the same like plugin i post. The song play in the Loading, but when you are into the server, dont play anymore. Maybe if you can put a task that a 5 seg after you enter, play the music?

valfarx 05-04-2012 00:42

Re: Song all Time
 
help :(

claudiuhks 05-04-2012 01:05

Re: Song all Time
 
PHP Code:

#include < amxmodx >

// Your MP3 sound file should be placed in:
//  %mygamedir%/sound/custom/my_soundscape.mp3

public plugin_precache( )
  
precache_sound"custom/my_soundscape.mp3" );

// EITHER
public client_putinserverClient )
  
client_cmdClient"mp3 play sound/custom/my_soundscape.mp3" );

// OR
public client_putinserverClient )
  
set_task3.0"TaskListenSound"Client );

public 
TaskListenSoundClient )
  if( 
is_user_connectedClient ) )
    
client_cmdClient"mp3 play sound/custom/my_soundscape.mp3" ); 


valfarx 05-05-2012 01:29

Re: Song all Time
 
Quote:

Originally Posted by claudiuhks (Post 1701738)
PHP Code:

// OR
public client_putinserverClient )
  
set_task3.0"TaskListenSound"Client );

public 
TaskListenSoundClient )
  if( 
is_client_connectedClient ) )
    
client_cmdClient"mp3 play sound/custom/my_soundscape.mp3" ); 


is_client_connected: I cant compile because this is invalid, and i have to search about it, and is; is_user_connected.

mp3 play: I use; mp3 loop, of this way, when the song stop, start again.

Task was perfect, this plugin really help me. Thanks to all, so much for help me :)
pd: sorry for my bad english :P

claudiuhks 05-05-2012 01:35

Re: Song all Time
 
Oh my God, is_user_connected, sorry for that! :cry:


All times are GMT -4. The time now is 07:41.

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