You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
sm-plugins/mapend.sp

213 lines
5.6 KiB

//////////////////////////////////////////////////////////////////
// Mapend Action By HSFighter / http://www.hsfighter.net" //
//////////////////////////////////////////////////////////////////
#include <sourcemod>
#include <sdktools>
#pragma semicolon 1
#define PLUGIN_VERSION "4.0"
//////////////////////////////////////////////////////////////////
// Delcare Variables and Handles
//////////////////////////////////////////////////////////////////
new Handle:CvarMCenabled;
new Handle:CvarMCdebug;
new g_MapendTemp = 0;
//////////////////////////////////////////////////////////////////
// Plugin Info
//////////////////////////////////////////////////////////////////
public Plugin:myinfo =
{
name = "Simple Mapend Countdown",
author = "HSFighter",
description = "Mapendaction with countdown",
version = PLUGIN_VERSION,
url = "http://www.hsfighter.net"
}
//////////////////////////////////////////////////////////////////
// Start Plugin
//////////////////////////////////////////////////////////////////
public OnPluginStart()
{
CvarMCenabled = CreateConVar("sm_mapend_countdown_enabled", "1", "Enable/disable mapend action.");
CvarMCdebug = CreateConVar("sm_mapend_countdown_debug", "0", "Debug countdown.");
AutoExecConfig(true);
}
//////////////////////////////////////////////////////////////////
// Start Map
//////////////////////////////////////////////////////////////////
public OnMapStart(){
PrecacheSound( "hl1/fvox/beep.wav", true);
PrecacheSound( "oktoberfest/fvox/ten.wav", true);
PrecacheSound( "oktoberfest/fvox/nine.wav", true);
PrecacheSound( "oktoberfest/fvox/eight.wav", true);
PrecacheSound( "oktoberfest/fvox/seven.wav", true);
PrecacheSound( "oktoberfest/fvox/six.wav", true);
PrecacheSound( "oktoberfest/fvox/five.wav", true);
PrecacheSound( "oktoberfest/fvox/four.wav", true);
PrecacheSound( "oktoberfest/fvox/three.wav", true);
PrecacheSound( "oktoberfest/fvox/two.wav", true);
PrecacheSound( "oktoberfest/fvox/one.wav", true);
AddFileToDownloadsTable("sound/oktoberfest/fvox/ten.wav");
AddFileToDownloadsTable("sound/oktoberfest/fvox/nine.wav");
AddFileToDownloadsTable("sound/oktoberfest/fvox/eight.wav");
AddFileToDownloadsTable("sound/oktoberfest/fvox/seven.wav");
AddFileToDownloadsTable("sound/oktoberfest/fvox/six.wav");
AddFileToDownloadsTable("sound/oktoberfest/fvox/five.wav");
AddFileToDownloadsTable("sound/oktoberfest/fvox/four.wav");
AddFileToDownloadsTable("sound/oktoberfest/fvox/three.wav");
AddFileToDownloadsTable("sound/oktoberfest/fvox/two.wav");
AddFileToDownloadsTable("sound/oktoberfest/fvox/one.wav");
g_MapendTemp = 0;
CreateTimer(0.5, Checktime, INVALID_HANDLE, TIMER_REPEAT|TIMER_FLAG_NO_MAPCHANGE);
}
//////////////////////////////////////////////////////////////////
// Timer
//////////////////////////////////////////////////////////////////
public Action:Checktime(Handle:timer)
{
if (GetConVarBool(CvarMCenabled)) {
new timeleft;
GetMapTimeLeft(timeleft);
timeleft = timeleft + 1;
if (g_MapendTemp != timeleft)
{
g_MapendTemp = timeleft;
if (GetConVarBool(CvarMCdebug)) PrintToChatAll("Debug: %i Sec. left",timeleft);
switch (timeleft)
{
case 1200:
{
EmitSoundToAll("hl1/fvox/beep.wav");
PrintToChatAll("Endmap in 20 Min...");
}
case 600:
{
EmitSoundToAll("hl1/fvox/beep.wav");
PrintToChatAll("Endmap in 10 Min...");
}
case 300:
{
EmitSoundToAll("hl1/fvox/beep.wav");
PrintToChatAll("Endmap in 5 Min...");
}
case 60:
{
EmitSoundToAll("hl1/fvox/beep.wav");
PrintToChatAll("Endmap in 60 Sec...");
}
case 30:
{
EmitSoundToAll("hl1/fvox/beep.wav");
PrintToChatAll("Endmap in 30 Sec...");
}
case 20:
{
EmitSoundToAll("hl1/fvox/beep.wav");
PrintToChatAll("Endmap in 20 Sec...");
}
case 10:
{
EmitSoundToAll("oktoberfest/fvox/ten.wav");
PrintToChatAll("Endmap in 10 Sec...");
}
case 9:
{
EmitSoundToAll("oktoberfest/fvox/nine.wav");
PrintToChatAll("Endmap in 9 Sec...");
}
case 8:
{
EmitSoundToAll("oktoberfest/fvox/eight.wav");
PrintToChatAll("Endmap in 8 Sec...");
}
case 7:
{
EmitSoundToAll("oktoberfest/fvox/seven.wav");
PrintToChatAll("Endmap in 7 Sec...");
}
case 6:
{
EmitSoundToAll("oktoberfest/fvox/six.wav");
PrintToChatAll("Endmap in 6 Sec...");
}
case 5:
{
EmitSoundToAll("oktoberfest/fvox/five.wav");
PrintToChatAll("Endmap in 5 Sec...");
}
case 4:
{
EmitSoundToAll("oktoberfest/fvox/four.wav");
PrintToChatAll("Endmap in 4 Sec...");
}
case 3:
{
EmitSoundToAll("oktoberfest/fvox/three.wav");
PrintToChatAll("Endmap in 3 Sec...");
}
case 2:
{
EmitSoundToAll("oktoberfest/fvox/two.wav");
PrintToChatAll("Endmap in 2 Sec...");
}
case 1:
{
EmitSoundToAll("oktoberfest/fvox/one.wav");
ServerCommand("mp_ignore_round_win_conditions 0");
ServerCommand("cssdm_enabled 0");
PrintToChatAll("Endmap in 1 Sec...");
}
}
if (timeleft <= 0)
{
new String:nextmap[250];
GetConVarString(FindConVar("sm_nextmap"), nextmap, sizeof(nextmap));
ServerCommand("changelevel %s", nextmap);
return Plugin_Continue;
}
}
}
return Plugin_Handled;
}
//////////////////////////////////////////////////////////////////
//
//////////////////////////////////////////////////////////////////
public OnMapEnd()
{
}
public OnPluginEnd()
{
}
//////////////////////////////////////////////////////////////////
// End Plugin
//////////////////////////////////////////////////////////////////