|
Author
|
Message
|
|
Senior Member
Join Date: Apr 2021
Location: Palestine
|

12-08-2021
, 16:45
Re: [BUG] - Welcome Sound
|
#1
|
Quote:
Originally Posted by Yusochan
Hello !
When i join the server the sound doesn't play..
Code:
#include <amxmodx>
new const szPLUGIN[] = "Welcome kho", szVERSION[] = "2.0", szAUTHOR[] = "YusoChan-";
new const szWelcome[] = "sound/misc/welcome.wav";
public plugin_init() {
register_plugin(szPLUGIN, szVERSION, szAUTHOR);
}
public client_connect(id) {
set_task(3.0, "Welcome", id);
}
public plugin_precache()
{
precache_sound(szWelcome);
}
public Welcome(id)
{
if(is_user_connected(id)) {
client_cmd(id, "spk welcome.wav", szWelcome);
}
}
|
PHP Code:
#include <amxmodx>
// change this number to the amount of sounds u have
#define Maxsounds 2
// add here your sounds, sounds must be somewhere in <ModDir>/sound
// format must be like: {"misc/sound1","ambience/sound2"}
new soundlist[Maxsounds][] = {"misc/welcome", "misc/prepare"}
new plugin_author[] = "White Panther"
new plugin_version[] = "1.2.3"
public plugin_init( )
{
register_plugin("Connect Sound", plugin_version, plugin_author)
register_cvar("connectsound_version", plugin_version, FCVAR_SERVER)
}
public plugin_precache( )
{
new temp[128], soundfile[128]
for ( new a = 0; a < Maxsounds; a++ )
{
format(temp, 127, "sound/%s.wav", soundlist[a])
if ( file_exists(temp) )
{
format(soundfile, 127, "%s.wav", soundlist[a])
precache_sound(soundfile)
}
}
}
public client_putinserver( id )
{
set_task(1.0, "consound", 100 + id)
}
public consound( timerid_id )
{
new id = timerid_id - 100
new Usertime
Usertime = get_user_time(id, 0)
if ( Usertime <= 0 )
{
set_task(1.0, "consound", timerid_id)
}else
{
new i = random(Maxsounds)
client_cmd(id, "spk ^"%s^"", soundlist[i])
}
return PLUGIN_CONTINUE
}
|
|
|
|