rendered paste body#include <sourcemod>
#include <sdktools>
#pragma semicolon 1
#define MAX_FILE_LEN 64
public Plugin:myinfo =
{
name = "Play music and slowmo",
author = "HTF",
description = "Slowmotion round end with music",
version = "VERSION 1.0",
url = "http://www.sourcemod.net"
}
static const String:emSound1[] = {"HTF/rndend.mp3"};
static const String:emSound2[] = {"HTF/strtbt.mp3"};
static const String:emSound3[] = {"HTF/stpbt.mp3"};
public OnPluginStart()
{
PrepareSounds();
HookEvent("round_end",Startmode, EventHookMode_Pre);
//HookEvent("round_start",Stopmode);
}
public OnMapStart()
{
PrepareSounds();
}
public PrepareSounds()
{
decl String:downloadFile[MAX_FILE_LEN];
decl String:downloadFile2[MAX_FILE_LEN];
decl String:downloadFile3[MAX_FILE_LEN];
PrecacheSound(emSound1, true);
PrecacheSound(emSound2, true);
PrecacheSound(emSound3, true);
Format(downloadFile, MAX_FILE_LEN, "sound/%s", emSound1);
Format(downloadFile2, MAX_FILE_LEN, "sound/%s", emSound2);
Format(downloadFile3, MAX_FILE_LEN, "sound/%s", emSound3);
AddFileToDownloadsTable(downloadFile);
AddFileToDownloadsTable(downloadFile2);
AddFileToDownloadsTable(downloadFile3);
}
public Action:Startmode(Handle: event , const String: name[] , bool: dontBroadcast)
{
new playersConnected = GetMaxClients();
for (new i = 1; i < playersConnected; i++)
{
if(IsClientInGame(i) && !IsFakeClient(i))
{
EmitSoundToClient(i, emSound2);
}
}
for (new i = 1; i < playersConnected; i++)
{
if(IsClientInGame(i) && !IsFakeClient(i))
{
EmitSoundToClient(i, emSound1);
}
}
ServerCommand("host_timescale %f", "0.2");
// ServerCommand("phys_timescale %f", "0.2");
// return;
CreateTimer(10.0, Stopmode);
return Plugin_Continue;
}
public Action:Stopmode(Handle:timer)
{
new playersConnected = GetMaxClients();
for (new i = 1; i < playersConnected; i++)
{
if(IsClientInGame(i) && !IsFakeClient(i))
{
EmitSoundToClient(i, emSound3);
}
}
ServerCommand("host_timescale %s", "1");
// ServerCommand("phys_timescale %s", "1");
}