Playing the sounds is easy. You'll need to
PrecacheSound in OnMapStart or OnConfigsExecuted if reading from a config file and then
EmitSoundToClient or
EmitSoundToAll when the voice should be played (however, you haven't said when that is).
The files themselves are located in sound/vo/announcer_* including some currently unused ones.
For instance, if I wanted to play "Success!" to a player when they kill someone (and note that this is an extremely simplified version that doesn't detect multiple kills at the same time or anything else that could cause problems):
PHP Code:
// Emit TF2 Success! sound when someone gets a kill
#include <sourcemod>
#include <sdktools_sound>
#define SUCCESS "vo/announcer_success.wav"
public Plugin:myinfo =
{
name = "Success",
author = "Powerlord",
description = "Play Announcer Success message to a player when they get a kill",
version = "1.0",
url = "<- URL ->"
}
public OnPluginStart()
{
HookEvent("player_death", KillEventHandler);
}
public OnMapStart()
{
PrecacheSound(SUCCESS);
}
public KillEventHandler(Handle:event, const String:name[], bool:dontBroadcast)
{
new client = GetClientOfUserId(GetEventInt(event, "attacker"));
if (IsClientInGame(client))
{
EmitSoundToClient(client, SUCCESS);
}
}
Note: This code is untested... I just know that it compiles.
__________________