Skip to content

Commit

Permalink
Update customvotes.sp
Browse files Browse the repository at this point in the history
Using a different method to detect sourcebans.
  • Loading branch information
caxanga334 committed Jan 26, 2019
1 parent 5d549f1 commit 328ca0c
Showing 1 changed file with 18 additions and 3 deletions.
21 changes: 18 additions & 3 deletions addons/sourcemod/scripting/customvotes.sp
Original file line number Diff line number Diff line change
Expand Up @@ -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];
Expand Down Expand Up @@ -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];
Expand Down Expand Up @@ -195,6 +195,11 @@ public OnLibraryAdded(const String:szName[])
{
g_bKzTimer = true;
}

if (StrEqual(szName, "sourcebans++"))
{
g_bSourceBans = true;
}
}

public OnLibraryRemoved(const String:szName[])
Expand All @@ -203,6 +208,11 @@ public OnLibraryRemoved(const String:szName[])
{
g_bKzTimer = false;
}

if (StrEqual(szName, "sourcebans++"))
{
g_bSourceBans = false;
}
}

public OnClientConnected(iTarget)
Expand Down Expand Up @@ -366,14 +376,19 @@ 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");
}
else
{
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++.");
}
}
}
}
Expand Down

0 comments on commit 328ca0c

Please sign in to comment.