Hello, My most recent plugin "MapTime" has been working great, but I would like to add some sounds that play at the 5 minute and 1 minute mark. Unfortunately I am unable to figure out how to do so.
(The client commands are commented because they were not working.)
My Code Is Here:
Code:
#include <sourcemod>
#include <sdktools>
#include <morecolors>
Handle g_hTimer;
public Plugin myinfo =
{
name = "|CelMod| Map Time",
author = "SociallyAwkward",
description = "This plugin will display the time left for the map periodically, as well as via a command.",
version = "1.0",
url = "http://www.bitbucket.org/sociallyawkwardd"
};
//When plugin is loaded
public void OnPluginStart()
{
PrintToServer("Created By SociallyAwkward - 10/11/2017");
PrintToServer("Created For Use On The |CelMod| Server");
RegConsoleCmd("sm_maptime", Command_MapTime, "Display Time Left For The Map.");
}
//When map starts
public void OnMapStart()
{
g_hTimer = CreateTimer(600.0, MapTimer,_, TIMER_REPEAT);
g_hTimer = CreateTimer(1.0, SaveTimer,_, TIMER_REPEAT);
}
//When user runs command
public Action Command_MapTime(int client, int args)
{
int timeleft;
GetMapTimeLeft(timeleft);
CPrintToChat(client,"{blue}|CelMod| {default}%d Minutes Remaining.", (timeleft / 60));
return Plugin_Handled;
}
//When the map timer reaches 10 minutes
public Action MapTimer(Handle timer, Handle hndl)
{
int timeleft; // blocked-scoped variable
GetMapTimeLeft(timeleft);
CPrintToChatAll("{blue}|CelMod| {default}%d Minutes Remaining.", (timeleft / 60));
return Plugin_Continue;
}
public Action SaveTimer(Handle timer, Handle hndl)
{
int timeleft;
GetMapTimeLeft(timeleft);
if (timeleft == 300){
//ClientCommand(client,"play ambient/alarms/warningbell1.wav");
//ClientCommand(client,"play npc/combine_soldier/vo/stayalert.wav");
CPrintToChatAll("{blue}-=-=-={green}5 MINUTES REMAINING - SAVE YOUR BUILDS{blue}=-=-=-");
}
if (timeleft == 60){
//ClientCommand(client,"play ambient/alarms/warningbell1.wav");
//ClientCommand(client,"play npc/overwatch/cityvoice/fcitadel_1minutetosingularity.wav");
CPrintToChatAll("{blue}-=-=-={green}1 MINUTE REMAINING - SAVE YOUR BUILDS{blue}=-=-=-");
}
return Plugin_Continue;
}
public void OnMapEnd()
{
CloseHandle(g_hTimer);
}