From 328ca0cd6439431d6788cf5be906c7fd1f7c61e6 Mon Sep 17 00:00:00 2001 From: caxanga334 <10157643+caxanga334@users.noreply.github.com> Date: Sat, 26 Jan 2019 10:53:00 -0200 Subject: [PATCH] Update customvotes.sp Using a different method to detect sourcebans. --- addons/sourcemod/scripting/customvotes.sp | 21 ++++++++++++++++++--- 1 file changed, 18 insertions(+), 3 deletions(-) diff --git a/addons/sourcemod/scripting/customvotes.sp b/addons/sourcemod/scripting/customvotes.sp index 92f970c..a05dcd5 100644 --- a/addons/sourcemod/scripting/customvotes.sp +++ b/addons/sourcemod/scripting/customvotes.sp @@ -9,11 +9,10 @@ // ====[ DEFINES ]============================================================= #define PLUGIN_NAME "Custom Votes" -#define PLUGIN_VERSION "1.16U" +#define PLUGIN_VERSION "1.16.1U" #define MAX_VOTE_TYPES 32 #define MAX_VOTE_MAPS 1024 #define MAX_VOTE_OPTIONS 32 -#define SBPP_AVAILABLE() (GetFeatureStatus(FeatureType_Native, "SBPP_BanPlayer") == FeatureStatus_Available) // ====[ HANDLES ]============================================================= new Handle:g_hArrayVotePlayerSteamID[MAXPLAYERS + 1][MAX_VOTE_TYPES]; @@ -52,6 +51,7 @@ new bool:g_bVoteForMap[MAXPLAYERS + 1][MAX_VOTE_TYPES][MAX_VOTE_MAPS]; new bool:g_bVoteForOption[MAXPLAYERS + 1][MAX_VOTE_TYPES][MAX_VOTE_OPTIONS]; new bool:g_bVoteForSimple[MAXPLAYERS + 1][MAX_VOTE_TYPES]; new bool:g_bKzTimer = false; +new bool:g_bSourceBans = false; new Float:g_flVoteRatio[MAX_VOTE_TYPES]; new String:g_strVoteName[MAX_VOTE_TYPES][MAX_NAME_LENGTH]; new String:g_strVoteConVar[MAX_VOTE_TYPES][MAX_NAME_LENGTH]; @@ -195,6 +195,11 @@ public OnLibraryAdded(const String:szName[]) { g_bKzTimer = true; } + + if (StrEqual(szName, "sourcebans++")) + { + g_bSourceBans = true; + } } public OnLibraryRemoved(const String:szName[]) @@ -203,6 +208,11 @@ public OnLibraryRemoved(const String:szName[]) { g_bKzTimer = false; } + + if (StrEqual(szName, "sourcebans++")) + { + g_bSourceBans = false; + } } public OnClientConnected(iTarget) @@ -366,7 +376,7 @@ public OnClientDisconnect(iTarget) if(bAutoBanEnabled) { - if(SBPP_AVAILABLE() && bAutoBanType) // SourceBans is available and the plugin is told to use it + if(g_bSourceBans && bAutoBanType) // SourceBans is available and the plugin is told to use it { SBPP_BanPlayer(0, iTarget, iAutoBanDuration, "Vote Evasion"); } @@ -374,6 +384,11 @@ public OnClientDisconnect(iTarget) { BanClient(iTarget, iAutoBanDuration, BANFLAG_AUTO, "Vote Evasion", "Vote Evasion", "CVR"); } + + if(!g_bSourceBans && bAutoBanType) // Plugin is told to use sourcebans but sourcebans is not available + { + LogError("Unable to ban using SourceBans++."); + } } } }