//////////////////////////////////////////////////////////////////
// Mapend Action By HSFighter / <!-- w --><a class="postlink" href="http://www.hsfighter.net">www.hsfighter.net</a><!-- w -->
//////////////////////////////////////////////////////////////////
#include <sourcemod>
#include <sdktools>
#pragma semicolon 1
#define PLUGIN_VERSION "2.1"
//////////////////////////////////////////////////////////////////
// Delcare Variables and Handles
//////////////////////////////////////////////////////////////////
//new Handle:cvarMAfrequency;
new Handle:cvarMAenabled;
new Handle:cvarMASlayenabled;
new Handle:MAhandle;
new x = 0;
new y = 0;
//////////////////////////////////////////////////////////////////
// Plugin Info
//////////////////////////////////////////////////////////////////
public Plugin:myinfo =
{
name = "Mapend Action",
author = "HSFighter",
description = "Exec an Action to mapend with countdown",
version = PLUGIN_VERSION,
url = "http://www.hsfighter.net"
}
//////////////////////////////////////////////////////////////////
// Start Plugin
//////////////////////////////////////////////////////////////////
public OnPluginStart(){
CreateConVar("sm_mapend_action_version", PLUGIN_VERSION, "Mapend Action Version", FCVAR_PLUGIN|FCVAR_SPONLY|FCVAR_REPLICATED|FCVAR_NOTIFY);
cvarMAenabled = CreateConVar("sm_mapend_action_enabled", "1", "Enable/disable mapend action.");
cvarMASlayenabled = CreateConVar("sm_mapend_action_slay_enabled", "0", "Slay all players with mapend.");
}
//////////////////////////////////////////////////////////////////
// Start Map
//////////////////////////////////////////////////////////////////
public OnMapStart(){
CreateTimer(1.0, Timeleft_Start);
PrecacheSound( "hl1/fvox/beep.wav", true);
PrecacheSound( "fvox/ten.wav", true);
PrecacheSound( "fvox/nine.wav", true);
PrecacheSound( "fvox/eight.wav", true);
PrecacheSound( "fvox/seven.wav", true);
PrecacheSound( "fvox/six.wav", true);
PrecacheSound( "fvox/five.wav", true);
PrecacheSound( "fvox/four.wav", true);
PrecacheSound( "fvox/three.wav", true);
PrecacheSound( "fvox/two.wav", true);
PrecacheSound( "fvox/one.wav", true);
AddFileToDownloadsTable("sound/fvox/ten.wav");
AddFileToDownloadsTable("sound/fvox/nine.wav");
AddFileToDownloadsTable("sound/fvox/eight.wav");
AddFileToDownloadsTable("sound/fvox/seven.wav");
AddFileToDownloadsTable("sound/fvox/six.wav");
AddFileToDownloadsTable("sound/fvox/five.wav");
AddFileToDownloadsTable("sound/fvox/four.wav");
AddFileToDownloadsTable("sound/fvox/three.wav");
AddFileToDownloadsTable("sound/fvox/two.wav");
AddFileToDownloadsTable("sound/fvox/one.wav");
}
//////////////////////////////////////////////////////////////////
// Create Timer for Timeleft
//////////////////////////////////////////////////////////////////
public Action:Timeleft_Start(Handle:timer){
if (GetConVarBool(cvarMAenabled)) {
MAhandle = CreateTimer(1.0, Checktime, INVALID_HANDLE, TIMER_REPEAT);
}
}
//////////////////////////////////////////////////////////////////
// Check Timer id Timeleft = 0 and exec Action
//////////////////////////////////////////////////////////////////
public Action:Checktime(Handle:timer){
if (GetConVarBool(cvarMAenabled)) {
new timeleft;
GetMapTimeLeft(timeleft);
timeleft = timeleft + 1;
if (timeleft == 1200){
x = 0;
if (y != 1){
y = 1;
EmitSoundToAll("hl1/fvox/beep.wav");
PrintToChatAll("Endmap in 20 Min...");
}
}
if (timeleft == 600){
y = 0;
if (x != 1){
x = 1;
EmitSoundToAll("hl1/fvox/beep.wav");
PrintToChatAll("Endmap in 10 Min...");
}
}
if (timeleft == 300){
x = 0;
if (y != 1){
y = 1;
EmitSoundToAll("hl1/fvox/beep.wav");
PrintToChatAll("Endmap in 5 Min...");
}
}
if (timeleft == 60){
y = 0;
if (x != 1){
x = 1;
EmitSoundToAll("hl1/fvox/beep.wav");
PrintToChatAll("Endmap in 60 Sec...");
}
}
if (timeleft == 30){
x = 0;
if (y != 1){
y = 1;
EmitSoundToAll("hl1/fvox/beep.wav");
PrintToChatAll("Endmap in 30 Sec...");
}
}
if (timeleft == 20){
y = 0;
if (x != 1){
x = 1;
EmitSoundToAll("hl1/fvox/beep.wav");
PrintToChatAll("Endmap in 20 Sec...");
}
}
if (timeleft == 10){
x = 0;
if (y != 1){
y = 1;
EmitSoundToAll("fvox/ten.wav");
PrintToChatAll("Endmap in 10 Sec...");
}
}
if (timeleft == 9){
y = 0;
if (x != 1){
x = 1;
EmitSoundToAll("fvox/9.wav");
PrintToChatAll("Endmap in 9 Sec...");
}
}
if (timeleft ==
{
y = 0;
if (x != 1){
x = 1;
EmitSoundToAll("fvox/eight.wav");
PrintToChatAll("Endmap in 8 Sec...");
}
}
if (timeleft == 7){
y = 0;
if (x != 1){
x = 1;
EmitSoundToAll("fvox/seven.wav");
PrintToChatAll("Endmap in 7 Sec...");
}
}
if (timeleft == 6){
y = 0;
if (x != 1){
x = 1;
EmitSoundToAll("fvox/six.wav");
PrintToChatAll("Endmap in 6 Sec...");
}
}
if (timeleft == 5){
y = 0;
if (x != 1){
x = 1;
EmitSoundToAll("fvox/five.wav");
PrintToChatAll("Endmap in 5 Sec...");
}
}
if (timeleft == 4){
x = 0;
if (y != 1){
y = 1;
EmitSoundToAll("fvox/four.wav");
PrintToChatAll("Endmap in 4 Sec...");
}
}
if (timeleft == 3){
y = 0;
if (x != 1){
x = 1;
EmitSoundToAll("fvox/three.wav");
PrintToChatAll("Endmap in 3 Sec...");
}
}
if (timeleft == 2){
x = 0;
if (y != 1){
y = 1;
EmitSoundToAll("fvox/two.wav");
PrintToChatAll("Endmap in 2 Sec...");
}
}
if (timeleft <= 1){
if (x != 1){
x = 1;
PrintToChatAll("Endmap in 1 Sec...");
EmitSoundToAll("fvox/one.wav");
ServerCommand("cssdm_enabled 0");
}
}
if (timeleft <= 0){
if (GetConVarBool(cvarMASlayenabled)) ServerCommand("sm_slay @all");
return Plugin_Stop;
}
}
return Plugin_Handled;
}
//////////////////////////////////////////////////////////////////
// Close Handles
//////////////////////////////////////////////////////////////////
public OnMapEnd(){
}
public OnPluginEnd(){
CloseHandle(MAhandle);
}
//////////////////////////////////////////////////////////////////
// End Plugin
//////////////////////////////////////////////////////////////////