From 9330953244b3619cc16d3fbdb2d9c8d46bf783c0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jonathan=20=C3=96hrstr=C3=B6m?= Date: Fri, 18 Aug 2017 22:36:18 +0200 Subject: [PATCH] Fixed the beacon Fixed the beacon radius. Player freedays now gets removed automatically at the end of the round. --- scripting/cmenu.sp | 14 ++++++++++++-- scripting/include/betterwarden.inc | 2 +- scripting/include/cmenu.inc | 1 - 3 files changed, 13 insertions(+), 4 deletions(-) diff --git a/scripting/cmenu.sp b/scripting/cmenu.sp index 8e55523..9281372 100644 --- a/scripting/cmenu.sp +++ b/scripting/cmenu.sp @@ -128,7 +128,6 @@ public OnPluginStart() { cvRestFreeday = CreateConVar("sm_cmenu_restricted_freeday", "1", "Add an option for a restricted freeday in the menu?\nThis event uses the same configuration as a normal freeday.\n0 = Disable.\n1 = Enable.", FCVAR_NOTIFY, true, 0.0, true, 1.0); cvEnablePlayerFreeday = CreateConVar("sm_cmenu_player_freeday", "1", "Add an option for giving a specific player a freeday in the menu?\n0 = Disable.\n1 = Enable.", FCVAR_NOTIFY, true, 0.0, true, 1.0); cvEnableDoors = CreateConVar("sm_cmenu_doors", "1", "sm_warden_cellscmd needs to be set to 1 for this to work!\nAdd an option for opening doors via the menu.\n0 = Disable.\n1 = Enable", FCVAR_NOTIFY, true, 0.0, true, 1.0); - cvBeaconRadius = FindConVar("sm_beacon_radius"); RegConsoleCmd("sm_abortgames", sm_abortgames); RegConsoleCmd("sm_cmenu", sm_cmenu); @@ -152,6 +151,10 @@ public OnPluginStart() { } +public void OnAllPluginsLoaded() { + cvBeaconRadius = FindConVar("sm_beacon_radius"); +} + public void OnClientPutInServer(int client) { SDKHook(client, SDKHook_OnTakeDamageAlive, OnTakeDamageAlive); } @@ -201,6 +204,13 @@ public void OnRoundStart(Event event, const char[] name, bool dontBroadcast) { aliveTs = 0; aliveTs = GetTeamAliveClientCount(CS_TEAM_T); + for(int client = 1; client <= MaxClients; client++) { + if(IsValidClient(client)) { + if(ClientHasFreeday(client)) { + RemoveClientFreeday(client); + } + } + } } public void OnMapStart() { @@ -1222,7 +1232,7 @@ public Action BeaconTimer(Handle timer, any client) { if(g_BeamSprite > -1 && g_HaloSprite > -1) { - TE_SetupBeamRingPoint(vec, 10.0, 375.0, g_BeamSprite, g_HaloSprite, 0, 10, 0.6, 10.0, 0.5, beamColor, 10, 0); + TE_SetupBeamRingPoint(vec, 10.0, cvBeaconRadius.FloatValue, g_BeamSprite, g_HaloSprite, 0, 10, 0.6, 10.0, 0.5, beamColor, 10, 0); TE_SendToAll(); } diff --git a/scripting/include/betterwarden.inc b/scripting/include/betterwarden.inc index b146a29..ea7ad9b 100644 --- a/scripting/include/betterwarden.inc +++ b/scripting/include/betterwarden.inc @@ -8,7 +8,7 @@ #endinput #endif #define bwardenincluded -#define VERSION "0.3.5b" +#define VERSION "0.3.5c" #define a ADMFLAG_RESERVATION #define b ADMFLAG_GENERIC diff --git a/scripting/include/cmenu.inc b/scripting/include/cmenu.inc index 4489bc0..8b90ebb 100644 --- a/scripting/include/cmenu.inc +++ b/scripting/include/cmenu.inc @@ -84,7 +84,6 @@ native bool GiveClientFreeday(int client); * Remove a client's freeday * * @param client index -* @param set a beacon * @return true if successful */ native bool RemoveClientFreeday(int client);