Hello again i need you help
I'm write simple code to play sound by EmitAmbientSound command
Everything work fine but i need two important function.
First it's stop sound, don't find answer how to stop ambient sound.
Last it's custom path to sound file instead of using define, here example
I write in chat !asound blabla/cool.wav it's preloaded and play.
It's Possible ?
here the code
PHP Code:
#include <sourcemod>
#include <sdktools>
#pragma semicolon 1
#define PLUGIN_VERSION "1.0"
#define MUSIC "music/flu/concert/midnightride.wav"
public Plugin:myinfo =
{
name = "spawn sound",
author = "FluD",
description = "temp",
version = PLUGIN_VERSION,
url = "www.google.com"
}
public OnPluginStart()
{
//cmd
RegAdminCmd("sm_asound", Activate_sound, ADMFLAG_SLAY,"Spawns a sound");
RegAdminCmd("sm_ssound", Stop_sound, ADMFLAG_SLAY,"Stop a sound");
//plugin version
CreateConVar("asound_version", PLUGIN_VERSION, "Asound_Version", FCVAR_PLUGIN|FCVAR_SPONLY|FCVAR_REPLICATED|FCVAR_NOTIFY);
}
public Action:Activate_sound(client, args)
{
PrecacheSound(MUSIC);
new Float:pos[3];
GetClientAbsOrigin(client, pos);
EmitAmbientSound(MUSIC, pos, client, SNDLEVEL_RAIDSIREN);
return Plugin_Continue;
}
public Action:Stop_sound(client, args)
{
StopSound(client, 0, MUSIC);
return Plugin_Continue;
}
p.s
don't look at thread name mistakes
forged edit
__________________