new const String:FULL_SOUND_PATH[] = "*/hooksound/hook.mp3";
new const String:RELATIVE_SOUND_PATH[] = "*/hooksound/hook.mp3";
public OnMapStart()
{
AddFileToDownloadsTable( FULL_SOUND_PATH );
}
....
// Finish hooking
SetEntityGravity(client, 0.0); // Set gravity to 0 so client floats in a straight line
PlaySound(client, 0);
EmitSoundFromOrigin(g_cvarSound[Hook], g_Location[client][0]); // Emit sound from where the hook landed
Hook_Push(client);
CreateTimer(0.1, Hooking, client, TIMER_REPEAT); // Create hooking loop
...
public Action:PlaySound(client, args)
{
if (client)
{
decl Float:center[3];
GetClientAbsOrigin(client, center);
PlaySoundRadius(center);
}
return Plugin_Handled;
}
stock PlaySoundRadius(const Float:center[3], const String:sound[] = FULL_SOUND_PATH, const Float:Radius = 100.0)
{
decl Float:position[3];
for (new i = 1; i <= MaxClients; ++i)
{
if (IsClientInGame(i))
{
GetClientAbsOrigin(i, position);
if (GetVectorDistance(center, position) <= Radius) ClientCommand(i, "playgamesound \"%s\"", sound);
}
}
}
[/spoiler]