diff --git a/addons/sourcemod/scripting/include/autoexecconfig.inc b/addons/sourcemod/scripting/include/autoexecconfig.inc
index 87a91a7619..1ca1743d25 100644
--- a/addons/sourcemod/scripting/include/autoexecconfig.inc
+++ b/addons/sourcemod/scripting/include/autoexecconfig.inc
@@ -1,6 +1,6 @@
/**
* AutoExecConfig
- *
+ *
* Copyright (C) 2013-2017 Impact
*
* This program is free software: you can redistribute it and/or modify
@@ -16,7 +16,10 @@
* You should have received a copy of the GNU General Public License
* along with this program. If not, see
*/
-
+
+#pragma semicolon 1
+#pragma newdecls required
+
#if defined _autoexecconfig_included
#endinput
#endif
@@ -27,7 +30,7 @@
#include
#define AUTOEXECCONFIG_VERSION "0.1.5"
-#define AUTOEXECCONFIG_URL "https://forums.alliedmods.net/showthread.php?t=204254"
+#define AUTOEXECCONFIG_URL "https://forums.alliedmods.net/showthread.php?t=204254"
// Append
#define AUTOEXEC_APPEND_BAD_FILENAME 0
@@ -35,8 +38,6 @@
#define AUTOEXEC_APPEND_BAD_HANDLE 2
#define AUTOEXEC_APPEND_SUCCESS 3
-
-
// Find
#define AUTOEXEC_FIND_BAD_FILENAME 10
#define AUTOEXEC_FIND_FILE_NOT_FOUND 11
@@ -44,26 +45,18 @@
#define AUTOEXEC_FIND_NOT_FOUND 13
#define AUTOEXEC_FIND_SUCCESS 14
-
-
// Clean
#define AUTOEXEC_CLEAN_FILE_NOT_FOUND 20
#define AUTOEXEC_CLEAN_BAD_HANDLE 21
#define AUTOEXEC_CLEAN_SUCCESS 22
-
-
// General
#define AUTOEXEC_NO_CONFIG 30
-
-
// Formatter
#define AUTOEXEC_FORMAT_BAD_FILENAME 40
#define AUTOEXEC_FORMAT_SUCCESS 41
-
-
// Global variables
static char g_sConfigFile[PLATFORM_MAX_PATH];
static char g_sRawFileName[PLATFORM_MAX_PATH];
@@ -75,7 +68,6 @@ static Handle g_hPluginHandle = null;
static bool g_bCreateDirectory = false;
static int g_bCreateDirectoryMode = FPERM_U_READ|FPERM_U_WRITE|FPERM_U_EXEC|FPERM_G_READ|FPERM_G_EXEC|FPERM_O_READ|FPERM_O_EXEC;
-
// Workaround for now
static int g_iLastFindResult;
static int g_iLastAppendResult;
@@ -84,7 +76,7 @@ static int g_iLastAppendResult;
stock void AutoExecConfig_EC_File()
{
// Execute and clean the cfg file
- AutoExecConfig_ExecuteFile();
+ AutoExecConfig_ExecuteFile();
AutoExecConfig_CleanFile();
}
stock void AutoExecConfig_Setup(char[] file, bool create = true)
@@ -93,7 +85,6 @@ stock void AutoExecConfig_Setup(char[] file, bool create = true)
AutoExecConfig_SetFile(file);
}
-
/**
* Returns the last result from the parser.
*
@@ -104,10 +95,6 @@ stock int AutoExecConfig_GetFindResult()
return g_iLastFindResult;
}
-
-
-
-
/**
* Returns the last result from the appender.
*
@@ -118,7 +105,6 @@ stock int AutoExecConfig_GetAppendResult()
return g_iLastAppendResult;
}
-
/**
* Set if the config file should be created by the autoexecconfig include itself if it doesn't exist.
*
@@ -130,10 +116,9 @@ stock void AutoExecConfig_SetCreateFile(bool create)
g_bCreateFile = create;
}
-
/**
* Set if the config file's folder should be created by the autoexecconfig include itself if it doesn't exist.
- * Note: Must be used before AutoExecConfig_SetFile as the potential creation of it happens there
+ * Note: Must be used before AutoExecConfig_SetFile as the potential creation of it happens there
*
* @param create True if config file should be created, false otherwise.
* @param mode Folder permission mode, default is u=rwx,g=rx,o=rx.
@@ -145,7 +130,6 @@ stock void AutoExecConfig_SetCreateDirectory(bool create, int mode=FPERM_U_READ|
g_bCreateDirectoryMode = mode;
}
-
/**
* Returns if the config file should be created if it doesn't exist.
*
@@ -156,7 +140,6 @@ stock bool AutoExecConfig_GetCreateFile()
return g_bCreateFile;
}
-
/**
* Set the plugin for which the config file should be created.
* Set to null to use the calling plugin.
@@ -170,7 +153,6 @@ stock void AutoExecConfig_SetPlugin(Handle plugin)
g_hPluginHandle = plugin;
}
-
/**
* Returns the plugin's handle for which the config file is created.
*
@@ -181,7 +163,6 @@ stock Handle AutoExecConfig_GetPlugin()
return g_hPluginHandle;
}
-
/**
* Set the global autoconfigfile used by functions of this file.
* Note: does not support subfolders like folder1/folder2
@@ -203,11 +184,6 @@ stock bool AutoExecConfig_SetFile(char[] file, char[] folder="sourcemod")
return AutoExecConfig_FormatFileName(g_sConfigFile, sizeof(g_sConfigFile), folder) == AUTOEXEC_FORMAT_SUCCESS;
}
-
-
-
-
-
/**
* Get the formatted autoconfigfile used by functions of this file.
*
@@ -230,11 +206,6 @@ stock bool AutoExecConfig_GetFile(char[] buffer,int size)
return false;
}
-
-
-
-
-
/**
* Creates a convar and appends it to the autoconfigfile if not found.
* FCVAR_DONTRECORD will be skipped.
@@ -268,7 +239,7 @@ stock ConVar AutoExecConfig_CreateConVar(const char[] name, const char[] default
// We only add this convar if it doesn't exist, or the file doesn't exist and it should be auto-generated
if (g_iLastFindResult == AUTOEXEC_FIND_NOT_FOUND || (g_iLastFindResult == AUTOEXEC_FIND_FILE_NOT_FOUND && g_bCreateFile))
{
- g_iLastAppendResult = AutoExecConfig_AppendValue(name, defaultValue, description, flags, hasMin, min, hasMax, max);
+ g_iLastAppendResult = AutoExecConfig_AppendValue(name, defaultValue, description, hasMin, min, hasMax, max);
}
}
@@ -277,9 +248,6 @@ stock ConVar AutoExecConfig_CreateConVar(const char[] name, const char[] default
return CreateConVar(name, defaultValue, description, flags, hasMin, min, hasMax, max);
}
-
-
-
/**
* Executes the autoconfigfile and adds it to the OnConfigsExecuted forward.
* If we didn't create it ourselves we let SourceMod create it.
@@ -288,14 +256,10 @@ stock ConVar AutoExecConfig_CreateConVar(const char[] name, const char[] default
*/
stock void AutoExecConfig_ExecuteFile()
{
- // Only let sourcemod create the file, if we didn't do that already.
+ // Only let sourcemod create the file, if we didn't do that already.
AutoExecConfig(!g_bCreateFile, g_sRawFileName, g_sFolderPath);
}
-
-
-
-
/**
* Formats a autoconfigfile, prefixes path and adds .cfg extension if missing.
*
@@ -359,25 +323,19 @@ stock static int AutoExecConfig_FormatFileName(char[] buffer, int size, char[] f
return AUTOEXEC_FORMAT_SUCCESS;
}
-
-
-
-
-
/**
* Appends a convar to the global autoconfigfile
*
* @param name Name of new convar.
* @param defaultValue String containing the default value of new convar.
* @param description Optional description of the convar.
- * @param flags Optional bitstring of flags determining how the convar should be handled. See FCVAR_* constants for more details.
* @param hasMin Optional boolean that determines if the convar has a minimum value.
* @param min Minimum floating point value that the convar can have if hasMin is true.
* @param hasMax Optional boolean that determines if the convar has a maximum value.
* @param max Maximum floating point value that the convar can have if hasMax is true.
* @return Returns one of the AUTOEXEC_APPEND values
*/
-stock int AutoExecConfig_AppendValue(const char[] name, const char[] defaultValue, const char[] description, int flags, bool hasMin, float min, bool hasMax, float max)
+stock int AutoExecConfig_AppendValue(const char[] name, const char[] defaultValue, const char[] description, bool hasMin, float min, bool hasMax, float max)
{
// No config set
if (strlen(g_sConfigFile) < 1)
@@ -474,7 +432,7 @@ stock int AutoExecConfig_AppendValue(const char[] name, const char[] defaultValu
fFile.WriteLine(writebuffer);
- fFile.Close();
+ fFile.Close();
return AUTOEXEC_APPEND_SUCCESS;
}
@@ -482,11 +440,6 @@ stock int AutoExecConfig_AppendValue(const char[] name, const char[] defaultValu
return AUTOEXEC_APPEND_FILE_NOT_FOUND;
}
-
-
-
-
-
/**
* Returns a convar's value from the global autoconfigfile
*
@@ -582,7 +535,7 @@ stock int AutoExecConfig_FindValue(const char[] cvar, char[] value, int size, bo
}
- // Get the start of the cvar,
+ // Get the start of the cvar,
if ( (cvarend = StrContains(readbuffer, " ")) == -1 || cvarend >= valuestart)
{
continue;
@@ -623,7 +576,7 @@ stock int AutoExecConfig_FindValue(const char[] cvar, char[] value, int size, bo
}
}
- fFile.Close();
+ fFile.Close();
return AUTOEXEC_FIND_NOT_FOUND;
}
@@ -631,11 +584,6 @@ stock int AutoExecConfig_FindValue(const char[] cvar, char[] value, int size, bo
return AUTOEXEC_FIND_FILE_NOT_FOUND;
}
-
-
-
-
-
/**
* Cleans the global autoconfigfile from too much spaces
*
@@ -738,11 +686,6 @@ stock int AutoExecConfig_CleanFile()
return AUTOEXEC_CLEAN_SUCCESS;
}
-
-
-
-
-
/**
* Returns how many times the given char occures in the given string.
*
@@ -765,11 +708,6 @@ stock static int GetCharCountInStr(int character, const char[] str)
return count;
}
-
-
-
-
-
#pragma deprecated
stock bool AutoExecConfig_CacheConvars()
{
diff --git a/addons/sourcemod/scripting/include/sourcebans.inc b/addons/sourcemod/scripting/include/sourcebans.inc
index 0b06229cd6..9360f61157 100644
--- a/addons/sourcemod/scripting/include/sourcebans.inc
+++ b/addons/sourcemod/scripting/include/sourcebans.inc
@@ -1,16 +1,19 @@
+#pragma semicolon 1
+#pragma newdecls required
+
#if defined _sourcebans_included
- #endinput
+ #endinput
#endif
#define _sourcebans_included
-public SharedPlugin:__pl_sourcebans =
+public SharedPlugin __pl_sourcebans =
{
name = "SourceBans",
file = "sourcebans.smx",
#if defined REQUIRE_PLUGIN
- required = 1
+ required = 1
#else
- required = 0
+ required = 0
#endif
};
@@ -21,7 +24,6 @@ public __pl_sourcebans_SetNTVOptional()
}
#endif
-
/*********************************************************
* Ban Player from server
*
@@ -29,8 +31,6 @@ public __pl_sourcebans_SetNTVOptional()
* @param target The client index of the player to ban
* @param time The time to ban the player for (in minutes, 0 = permanent)
* @param reason The reason to ban the player from the server
- * @noreturn
+ * @noreturn
*********************************************************/
-native SBBanPlayer(client, target, time, String:reason[]);
-
-//Yarr!
+native void SBBanPlayer(int client, int target, int time, char[] reason);
diff --git a/addons/sourcemod/scripting/nd_bot_features.sp b/addons/sourcemod/scripting/nd_bot_features.sp
index 4ae57c834e..6ba00299d1 100644
--- a/addons/sourcemod/scripting/nd_bot_features.sp
+++ b/addons/sourcemod/scripting/nd_bot_features.sp
@@ -3,6 +3,9 @@
* Filler Quota: When lots of people are on teams, fill player count differences with bots
*/
+#pragma semicolon 1
+#pragma newdecls required
+
#include
#include
#include
@@ -12,10 +15,9 @@
#include
/* Auto-Updater Support */
-#define UPDATE_URL "https://github.com/stickz/Redstone/raw/build/updater/nd_bot_features/nd_bot_features.txt"
+#define UPDATE_URL "https://github.com/stickz/Redstone/raw/build/updater/nd_bot_features/nd_bot_features.txt"
#include "updater/standard.sp"
-#pragma newdecls required
#include
#include
#include
@@ -45,7 +47,7 @@ public void OnPluginStart()
{
CreatePluginConvars(); // convars.sp
RegisterPluginCMDS(); // commands.sp
- AddUpdaterLibrary(); //auto-updater
+ AddUpdaterLibrary(); // auto-updater
// Late-Loading Support
if (ND_MapStarted())
@@ -59,17 +61,17 @@ public void OnMapStart() {
void SetBotValues()
{
SetBotDisableValues(); // convars.sp
- //SetBotReductionValues(); // convars.sp
+ //SetBotReductionValues(); // convars.sp
}
-public void OnMapEnd()
+public void OnMapEnd()
{
disableBots = false;
isSwitchingBots = false;
- SignalMapChange();
+ SignalMapChange();
}
-public void ND_OnPlayerTeamChanged(int client, bool valid)
+public void ND_OnPlayerTeamChanged(int client, bool valid)
{
if (valid)
CreateTimer(0.5, TIMER_CC, _, TIMER_FLAG_NO_MAPCHANGE);
@@ -101,15 +103,15 @@ void checkCount()
// The plugin to get the server slot is available
else if (GDSC_AVAILABLE() && g_cvar.EnableFillerQuota.BoolValue)
- {
+ {
// Get team count difference and team skill difference multiplier
int posOverBalance = getPositiveOverBalance();
float teamDiffMult = getTeamDiffMult();
// If one team has less players than the other
if (posOverBalance >= 1)
- {
- quota = getBotFillerQuota(posOverBalance, teamDiffMult); // Get number of bots to fill
+ {
+ quota = getBotFillerQuota(posOverBalance); // Get number of bots to fill
// Create a timer after envoking bot quota, to switch bots to the fill team
CreateTimer(timerDuration, TIMER_CheckAndSwitchFiller, _, TIMER_FLAG_NO_MAPCHANGE);
@@ -121,7 +123,7 @@ void checkCount()
quota = getBotEvenQuota(teamDiffMult); // Get number of bots to fill
// Create a timer after envoking bot quota, to switch bots to the fill team
- CreateTimer(timerDuration, TIMER_CheckAndSwitchEven, _, TIMER_FLAG_NO_MAPCHANGE)
+ CreateTimer(timerDuration, TIMER_CheckAndSwitchEven, _, TIMER_FLAG_NO_MAPCHANGE);
}
// Otherwise, set filler quota to 0
@@ -145,7 +147,7 @@ public void ND_OnRoundStarted() {
void InitializeServerBots()
{
- int quota = 0;
+ int quota = 0;
// Team count means the requirement for modulous bot quota
// Decide which type of modulous quota we're using (boosted or regular)
@@ -156,9 +158,9 @@ void InitializeServerBots()
ServerCommand("mp_limitteams %d", g_cvar.RegOverblance.IntValue);
}
-//Turn 32 slots on or off for bot quota
+// Turn 32 slots on or off for bot quota
void toggleBooster(bool state)
-{
+{
// Exit function if the state is not changing
if (visibleBoosted == state)
return;
@@ -176,7 +178,7 @@ void toggleBooster(bool state)
}
}
-//Disable the 32 slots (if activate) when the map changes
+// Disable the 32 slots (if activate) when the map changes
void SignalMapChange()
{
toggleBooster(false);
@@ -184,17 +186,17 @@ void SignalMapChange()
ServerCommand("mp_limitteams 1");
}
-stock int getBotFillerQuota(int plyDiff, float teamDiffMult)
+stock int getBotFillerQuota(int plyDiff)
{
// Get the team count offset to properly fill the bot quota
int specCount = ValidTeamCount(TEAM_SPEC);
int teamCount = GetOnTeamCount(specCount);
- // Set bot count to player count difference ^ x or skill difference ^ x
- int add = RoundPowToNearest(float(plyDiff), g_cvar.BotDiffMult.FloatValue);
+ // Set bot count to player count difference ^ x or skill difference ^ x
+ int add = RoundPowToNearest(float(plyDiff), g_cvar.BotDiffMult.FloatValue);
int physical = teamCount + Math_Max(add, 3);
- // Set a ceiling to be returned, leave two connecting slots
+ // Set a ceiling to be returned, leave two connecting slots
// Determine the maximum bot count to use. Skill difference or player difference.
// Limit the bot count to the maximum available on the server. (if required)
return Math_Max(physical, GetMaxBotCount(specCount));
@@ -247,12 +249,12 @@ float getTeamDiffMult()
}
int getBotModulusQuota()
-{
+{
// Get max quota and the current spectator & team count
int maxQuota = g_cvar.BoosterQuota.IntValue;
- int specCount = ValidTeamCount(TEAM_SPEC);
+ int specCount = ValidTeamCount(TEAM_SPEC);
int botAmount = maxQuota - specCount - ValidTeamCount(TEAM_UNASSIGNED);
-
+
// If required, modulate the bot count so the number is even on the scoreboard
return botAmount % 2 != specCount % 2 ? botAmount - 1 : botAmount;
}
@@ -265,10 +267,10 @@ bool boostBots()
}
bool CheckShutOffBots()
-{
+{
// Get the empire, consort and total on team count
int empireCount = RED_GetTeamCount(TEAM_EMPIRE);
- int consortCount = RED_GetTeamCount(TEAM_CONSORT);
+ int consortCount = RED_GetTeamCount(TEAM_CONSORT);
// If total count on one or both teams is reached, disable bots
bool isTotalDisable = (empireCount + consortCount) >= totalDisable;
diff --git a/addons/sourcemod/scripting/nd_continents.sp b/addons/sourcemod/scripting/nd_continents.sp
index d39bfb692f..7ef378b22a 100644
--- a/addons/sourcemod/scripting/nd_continents.sp
+++ b/addons/sourcemod/scripting/nd_continents.sp
@@ -11,42 +11,44 @@ GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
-Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
-#define UPDATE_URL "https://github.com/stickz/Redstone/raw/build/updater/nd_continents/nd_continents.txt"
+#pragma semicolon 1
+#pragma newdecls required
+
+#define UPDATE_URL "https://github.com/stickz/Redstone/raw/build/updater/nd_continents/nd_continents.txt"
#include "updater/standard.sp"
-#pragma newdecls required
#include
#include
#include
// possible values are:
-//AF = Africa
-//EU = Europe
-//AS = Asia
-//NA = North America
-//SA = South America
-//AU = Australia
-//AN = Antarctica
-//XX = Unknown
-
-char aAfrica[][2] = {"AO","BF","BI","BJ","BW","CD","CF","CG","CI","CM","CV","DJ","DZ","EG","EH","ER","ET","GA","GH","GM","GN","GQ","GW","KE","KM","LR","LS","LY","MA","MG","ML","MR","MU","MW","MZ","NA","NE","NG","RE","RW","SC","SD","SH","SL","SN","SO","ST","SZ","TD","TG","TN","TZ","UG","YT","ZA","ZM","ZW"},
- aEurope[][2] = {"AD","AL","AT","AX","BA","BE","BG","BY","CH","CZ","DE","DK","EE","ES","EU","FI","FO","FR","FX","GB","GG","GI","GR","HR","HU","IE","IM","IS","IT","JE","LI","LT","LU","LV","MC","MD","ME","MK","MT","NL","NO","PL","PT","RO","RS","RU","SE","SI","SJ","SK","SM","TR","UA","VA"},
- aAsia[][2] = {"AE","AF","AM","AP","AZ","BD","BH","BN","BT","CC","CN","CX","CY","GE","HK","ID","IL","IN","IO","IQ","IR","JO","JP","KG","KH","KP","KR","KW","KZ","LA","LB","LK","MM","MN","MO","MV","MY","NP","OM","PH","PK","PS","QA","SA","SG","SY","TH","TJ","TL","TM","TW","UZ","VN","YE"},
- aNorthAmerica[][2] = {"AG","AI","AN","AW","BB","BL","BM","BS","BZ","CA","CR","CU","DM","DO","GD","GL","GP","GT","HN","HT","JM","KN","KY","LC","MF","MQ","MS","MX","NI","PA","PM","PR","SV","TC","TT","US","VC","VG","VI"},
- aAustralia[][2] = {"AS","AU","CK","FJ","FM","GU","KI","MH","MP","NC","NF","NR","NU","NZ","PF","PG","PN","PW","SB","TK","TO","TV","UM","VU","WF","WS"},
- aSouthAmerica[][2] = {"AR","BO","BR","CL","CO","EC","FK","GF","GY","PE","PY","SR","UY","VE"},
- aAntarctica[][2] = {"AQ","BV","GS","HM","TF"};
+// AF = Africa
+// EU = Europe
+// AS = Asia
+// NA = North America
+// SA = South America
+// AU = Australia
+// AN = Antarctica
+// XX = Unknown
+
+char aAfrica[][] = {"AO","BF","BI","BJ","BW","CD","CF","CG","CI","CM","CV","DJ","DZ","EG","EH","ER","ET","GA","GH","GM","GN","GQ","GW","KE","KM","LR","LS","LY","MA","MG","ML","MR","MU","MW","MZ","NA","NE","NG","RE","RW","SC","SD","SH","SL","SN","SO","ST","SZ","TD","TG","TN","TZ","UG","YT","ZA","ZM","ZW"};
+char aEurope[][] = {"AD","AL","AT","AX","BA","BE","BG","BY","CH","CZ","DE","DK","EE","ES","EU","FI","FO","FR","FX","GB","GG","GI","GR","HR","HU","IE","IM","IS","IT","JE","LI","LT","LU","LV","MC","MD","ME","MK","MT","NL","NO","PL","PT","RO","RS","RU","SE","SI","SJ","SK","SM","TR","UA","VA"};
+char aAsia[][] = {"AE","AF","AM","AP","AZ","BD","BH","BN","BT","CC","CN","CX","CY","GE","HK","ID","IL","IN","IO","IQ","IR","JO","JP","KG","KH","KP","KR","KW","KZ","LA","LB","LK","MM","MN","MO","MV","MY","NP","OM","PH","PK","PS","QA","SA","SG","SY","TH","TJ","TL","TM","TW","UZ","VN","YE"};
+char aNorthAmerica[][] = {"AG","AI","AN","AW","BB","BL","BM","BS","BZ","CA","CR","CU","DM","DO","GD","GL","GP","GT","HN","HT","JM","KN","KY","LC","MF","MQ","MS","MX","NI","PA","PM","PR","SV","TC","TT","US","VC","VG","VI"};
+char aSouthAmerica[][] = {"AR","BO","BR","CL","CO","EC","FK","GF","GY","PE","PY","SR","UY","VE"};
+char aAustralia[][] = {"AS","AU","CK","FJ","FM","GU","KI","MH","MP","NC","NF","NR","NU","NZ","PF","PG","PN","PW","SB","TK","TO","TV","UM","VU","WF","WS"};
+char aAntarctica[][] = {"AQ","BV","GS","HM","TF"};
public Plugin myinfo =
{
- name = "[ND] Continents",
- author = "Stickz",
- description = "Show a player's continent based on their IP.",
- version = "dummy",
- url = "https://github.com/stickz/Redstone/"
+ name = "[ND] Continents",
+ author = "Stickz",
+ description = "Show a player's continent based on their IP.",
+ version = "dummy",
+ url = "https://github.com/stickz/Redstone/"
};
public void OnPluginStart()
@@ -54,12 +56,12 @@ public void OnPluginStart()
RegConsoleCmd("sm_locations", CMD_CheckLocations);
LoadTranslations("nd_continents.phrases");
- AddUpdaterLibrary(); //auto-updater
+ AddUpdaterLibrary(); // auto-updater
}
public Action CMD_CheckLocations(int client, int args)
{
- int counter[8]; //in order of possible values
+ int counter[8]; // in order of possible values
char playerContinent[MAXPLAYERS + 1][4];
for (int idx = 0; idx <= MaxClients; idx++)
@@ -130,20 +132,20 @@ char[] getContient(int client)
char code[4];
char clientIp[16];
- if(!GetClientIP(client, clientIp, sizeof(clientIp), true)) //failed to get IP of client, do not procede further
+ if(!GetClientIP(client, clientIp, sizeof(clientIp), true)) // failed to get IP of client, do not procede further
{
code = "XX";
return code;
}
char countryCode[3];
- if (!GeoipCode2(clientIp, countryCode)) //failed to get Geo Location of client, do not procede further
+ if (!GeoipCode2(clientIp, countryCode)) // failed to get Geo Location of client, do not procede further
{
code = "XX";
return code;
}
- //check Europe Array
+ // check Europe Array
for(int i=0;i
#include
/* Auto Updater Suport */
-#define UPDATE_URL "https://github.com/stickz/Redstone/raw/build/updater/sourcebans/sourcebans.txt"
-#include "updater/standard.sp"
+#define UPDATE_URL "https://github.com/stickz/Redstone/raw/build/updater/sourcebans/sourcebans.txt"
+#include "updater/standard.sp"
#undef REQUIRE_PLUGIN
#include
@@ -122,7 +123,7 @@ bool g_bConnecting = false;
int serverID = -1;
-public Plugin myinfo =
+public Plugin myinfo =
{
name = "SourceBans++",
author = "SourceBans Development Team, Sarabveer(VEER™)",
@@ -626,8 +627,6 @@ public Action sm_rehash(args)
return Plugin_Handled;
}
-
-
// MENU CODE //
public OnAdminMenuReady(Handle:topmenu)
@@ -669,7 +668,7 @@ public AdminMenu_Ban(Handle:topmenu, TopMenuAction:action, TopMenuObject:object_
case TopMenuAction_SelectOption:
{
- DisplayBanTargetMenu(param); // Someone chose to ban someone, show the list of users menu
+ DisplayBanTargetMenu(param); // Someone chose to ban someone, show the list of users menu
}
}
}
@@ -839,11 +838,11 @@ stock DisplayBanTargetMenu(client)
char title[100];
Format(title, sizeof(title), "%T:", "Ban player", client);
- //Format(title, sizeof(title), "Ban player", client); // Create the title of the menu
+ //Format(title, sizeof(title), "Ban player", client); // Create the title of the menu
SetMenuTitle(menu, title); // Set the title
SetMenuExitBackButton(menu, true); // Yes we want back/exit
- AddTargetsToMenu(menu, client, false, false);
+ AddTargetsToMenu(menu, client, false, false);
DisplayMenu(menu, client, MENU_TIME_FOREVER); // Show the menu to the client FOREVER!
}
@@ -909,7 +908,7 @@ public GotDatabase(Handle owner, Handle hndl, const char[] error, any:data)
if (loadGroups && enableAdmins)
{
- FormatEx(query, 1024, "SELECT name, flags, immunity, groups_immune \
+ FormatEx(query, 1024, "SELECT name, flags, immunity, groups_immune \
FROM %s_srvgroups ORDER BY id", DatabasePrefix);
curLoading++;
SQL_TQuery(DB, GroupsDone, query);
@@ -926,18 +925,18 @@ public GotDatabase(Handle owner, Handle hndl, const char[] error, any:data)
if (serverID == -1)
{
- FormatEx(query, 1024, "SELECT authid, srv_password, (SELECT name FROM %s_srvgroups WHERE name = srv_group AND flags != '') AS srv_group, srv_flags, user, immunity \
+ FormatEx(query, 1024, "SELECT authid, srv_password, (SELECT name FROM %s_srvgroups WHERE name = srv_group AND flags != '') AS srv_group, srv_flags, user, immunity \
FROM %s_admins_servers_groups AS asg \
LEFT JOIN %s_admins AS a ON a.aid = asg.admin_id \
- WHERE %s (server_id = (SELECT sid FROM %s_servers WHERE ip = '%s' AND port = '%s' LIMIT 0,1) \
+ WHERE %s (server_id = (SELECT sid FROM %s_servers WHERE ip = '%s' AND port = '%s' LIMIT 0,1) \
OR srv_group_id = ANY (SELECT group_id FROM %s_servers_groups WHERE server_id = (SELECT sid FROM %s_servers WHERE ip = '%s' AND port = '%s' LIMIT 0,1))) \
GROUP BY aid, authid, srv_password, srv_group, srv_flags, user",
DatabasePrefix, DatabasePrefix, DatabasePrefix, queryLastLogin, DatabasePrefix, ServerIp, ServerPort, DatabasePrefix, DatabasePrefix, ServerIp, ServerPort);
} else {
- FormatEx(query, 1024, "SELECT authid, srv_password, (SELECT name FROM %s_srvgroups WHERE name = srv_group AND flags != '') AS srv_group, srv_flags, user, immunity \
+ FormatEx(query, 1024, "SELECT authid, srv_password, (SELECT name FROM %s_srvgroups WHERE name = srv_group AND flags != '') AS srv_group, srv_flags, user, immunity \
FROM %s_admins_servers_groups AS asg \
LEFT JOIN %s_admins AS a ON a.aid = asg.admin_id \
- WHERE %s server_id = %d \
+ WHERE %s server_id = %d \
OR srv_group_id = ANY (SELECT group_id FROM %s_servers_groups WHERE server_id = %d) \
GROUP BY aid, authid, srv_password, srv_group, srv_flags, user",
DatabasePrefix, DatabasePrefix, DatabasePrefix, queryLastLogin, serverID, DatabasePrefix, serverID);
@@ -1009,7 +1008,7 @@ public VerifyInsert(Handle owner, Handle hndl, const char[] error, any:dataPack)
if (Reason[0] == '\0')
ShowActivityEx(admin, Prefix, "%t", "Permabanned player", Name);
else
- ShowActivityEx(admin, Prefix, "%t", "Permabanned player reason", Name, Reason);
+ ShowActivityEx(admin, Prefix, "%t", "Permabanned player reason", Name, Reason);
}
else
@@ -1017,7 +1016,7 @@ public VerifyInsert(Handle owner, Handle hndl, const char[] error, any:dataPack)
if (Reason[0] == '\0')
ShowActivityEx(admin, Prefix, "%t", "Banned player", Name, time);
else
- ShowActivityEx(admin, Prefix, "%t", "Banned player reason", Name, time, Reason);
+ ShowActivityEx(admin, Prefix, "%t", "Banned player reason", Name, time, Reason);
}
LogAction(admin, client, "\"%L\" banned \"%L\" (minutes \"%d\") (reason \"%s\")", admin, client, time, Reason);
@@ -1332,7 +1331,7 @@ public ProcessQueueCallback(Handle owner, Handle hndl, const char[] error, any:d
if (serverID == -1)
{
FormatEx(query, sizeof(query),
- "INSERT INTO %s_bans (ip, authid, name, created, ends, length, reason, aid, adminIp, sid) VALUES \
+ "INSERT INTO %s_bans (ip, authid, name, created, ends, length, reason, aid, adminIp, sid) VALUES \
('%s', '%s', '%s', %d, %d, %d, '%s', (SELECT aid FROM %s_admins WHERE authid = '%s' OR authid REGEXP '^STEAM_[0-9]:%s$'), '%s', \
(SELECT sid FROM %s_servers WHERE ip = '%s' AND port = '%s' LIMIT 0,1))",
DatabasePrefix, ip, auth, banName, startTime, startTime + time * 60, time * 60, banReason, DatabasePrefix, adminAuth, adminAuth[8], adminIp, DatabasePrefix, ServerIp, ServerPort);
@@ -1340,7 +1339,7 @@ public ProcessQueueCallback(Handle owner, Handle hndl, const char[] error, any:d
else
{
FormatEx(query, sizeof(query),
- "INSERT INTO %s_bans (ip, authid, name, created, ends, length, reason, aid, adminIp, sid) VALUES \
+ "INSERT INTO %s_bans (ip, authid, name, created, ends, length, reason, aid, adminIp, sid) VALUES \
('%s', '%s', '%s', %d, %d, %d, '%s', (SELECT aid FROM %s_admins WHERE authid = '%s' OR authid REGEXP '^STEAM_[0-9]:%s$'), '%s', \
%d)",
DatabasePrefix, ip, auth, banName, startTime, startTime + time * 60, time * 60, banReason, DatabasePrefix, adminAuth, adminAuth[8], adminIp, serverID);
@@ -1436,14 +1435,14 @@ public VerifyBan(Handle owner, Handle hndl, const char[] error, any:userid)
SQL_EscapeString(DB, clientName, Name, sizeof(Name));
if (serverID == -1)
{
- FormatEx(Query, sizeof(Query), "INSERT INTO %s_banlog (sid ,time ,name ,bid) VALUES \
+ FormatEx(Query, sizeof(Query), "INSERT INTO %s_banlog (sid ,time ,name ,bid) VALUES \
((SELECT sid FROM %s_servers WHERE ip = '%s' AND port = '%s' LIMIT 0,1), UNIX_TIMESTAMP(), '%s', \
(SELECT bid FROM %s_bans WHERE ((type = 0 AND authid REGEXP '^STEAM_[0-9]:%s$') OR (type = 1 AND ip = '%s')) AND RemoveType IS NULL LIMIT 0,1))",
DatabasePrefix, DatabasePrefix, ServerIp, ServerPort, Name, DatabasePrefix, clientAuth[8], clientIp);
}
else
{
- FormatEx(Query, sizeof(Query), "INSERT INTO %s_banlog (sid ,time ,name ,bid) VALUES \
+ FormatEx(Query, sizeof(Query), "INSERT INTO %s_banlog (sid ,time ,name ,bid) VALUES \
(%d, UNIX_TIMESTAMP(), '%s', \
(SELECT bid FROM %s_bans WHERE ((type = 0 AND authid REGEXP '^STEAM_[0-9]:%s$') OR (type = 1 AND ip = '%s')) AND RemoveType IS NULL LIMIT 0,1))",
DatabasePrefix, serverID, Name, DatabasePrefix, clientAuth[8], clientIp);
@@ -1711,7 +1710,7 @@ public GroupsSecondPass(Handle owner, Handle hndl, const char[] error, any:data)
if (immuneGrp == INVALID_GROUP_ID)
continue;
- SetAdmGroupImmuneFrom(curGrp, immuneGrp);
+ SetAdmGroupImmuneFrom(curGrp, immuneGrp);
}
--curLoading;
CheckLoadAdmins();
@@ -1984,7 +1983,6 @@ public SMCResult:ReadConfig_EndSection(Handle smc)
return SMCParse_Continue;
}
-
/*********************************************************
* Ban Player from server
*
@@ -2024,7 +2022,6 @@ public Native_SBBanPlayer(Handle plugin, numParams)
return true;
}
-
// STOCK FUNCTIONS //
public void InitializeBackupDB()
@@ -2219,7 +2216,7 @@ void PrepareBan(int client, int target, int time, char[] reason)
if (reason[0] == '\0')
ShowActivity(client, "%t", "Permabanned player", name);
else
- ShowActivity(client, "%t", "Permabanned player reason", name, reason);
+ ShowActivity(client, "%t", "Permabanned player reason", name, reason);
}
else
@@ -2227,7 +2224,7 @@ void PrepareBan(int client, int target, int time, char[] reason)
if (reason[0] == '\0')
ShowActivity(client, "%t", "Banned player", name, time);
else
- ShowActivity(client, "%t", "Banned player reason", name, time, reason);
+ ShowActivity(client, "%t", "Banned player reason", name, time, reason);
}
LogAction(client, target, "\"%L\" banned \"%L\" (minutes \"%d\") (reason \"%s\")", client, target, time, reason);
@@ -2354,5 +2351,3 @@ stock void AccountForLateLoading()
}
}
}
-
-//Yarr!
diff --git a/addons/sourcemod/scripting/sourcecomms.sp b/addons/sourcemod/scripting/sourcecomms.sp
index ec19f81586..7ef86d63a6 100644
--- a/addons/sourcemod/scripting/sourcecomms.sp
+++ b/addons/sourcemod/scripting/sourcecomms.sp
@@ -11,7 +11,7 @@
// You should have received a copy of the GNU General Public License
// along with Sourcecomms. If not, see .
//
-// This file is based off work covered by the following copyright(s):
+// This file is based off work covered by the following copyright(s):
//
// SourceComms 0.9.266
// Copyright (C) 2013-2014 Alexandr Duplishchev
@@ -31,8 +31,8 @@
#include
/* Auto Updater Suport */
-#define UPDATE_URL "https://github.com/stickz/Redstone/raw/build/updater/sourcecomms/sourcecomms.txt"
-#include "updater/standard.sp"
+#define UPDATE_URL "https://github.com/stickz/Redstone/raw/build/updater/sourcecomms/sourcecomms.txt"
+#include "updater/standard.sp"
#undef REQUIRE_PLUGIN
#include
@@ -78,18 +78,18 @@ char g_sTimeDisplays[MAX_TIMES][DISPLAY_SIZE];
enum State/* ConfigState */
{
- ConfigStateNone = 0,
- ConfigStateConfig,
- ConfigStateReasons,
- ConfigStateTimes,
- ConfigStateServers,
+ ConfigStateNone = 0,
+ ConfigStateConfig,
+ ConfigStateReasons,
+ ConfigStateTimes,
+ ConfigStateServers,
}
enum DatabaseState/* Database connection state */
{
- DatabaseState_None = 0,
- DatabaseState_Wait,
- DatabaseState_Connecting,
- DatabaseState_Connected,
+ DatabaseState_None = 0,
+ DatabaseState_Wait,
+ DatabaseState_Connecting,
+ DatabaseState_Connected,
}
new DatabaseState:g_DatabaseState;
@@ -119,7 +119,6 @@ Handle g_hPlayerRecheck[MAXPLAYERS + 1] = { INVALID_HANDLE, ... };
Handle g_hGagExpireTimer[MAXPLAYERS + 1] = { INVALID_HANDLE, ... };
Handle g_hMuteExpireTimer[MAXPLAYERS + 1] = { INVALID_HANDLE, ... };
-
/* Log Stuff */
#if defined LOG_QUERIES
char logQuery[256];
@@ -136,11 +135,11 @@ int serverID = 0;
/* List menu */
enum PeskyPanels
{
- curTarget,
- curIndex,
- viewingMute,
- viewingGag,
- viewingList,
+ curTarget,
+ curIndex,
+ viewingMute,
+ viewingGag,
+ viewingList,
}
int g_iPeskyPanels[MAXPLAYERS + 1][PeskyPanels];
@@ -165,12 +164,12 @@ char g_sGagAdminAuth[MAXPLAYERS + 1][64];
Handle g_hServersWhiteList = INVALID_HANDLE;
-public Plugin myinfo =
+public Plugin myinfo =
{
- name = "SourceComms",
- author = "Alex, Sarabveer(VEER™)",
- description = "Advanced punishments management for the Source engine in SourceBans style",
- version = "dummy",
+ name = "SourceComms",
+ author = "Alex, Sarabveer(VEER™)",
+ description = "Advanced punishments management for the Source engine in SourceBans style",
+ version = "dummy",
url = "https://sarabveer.github.io/SourceBans-Fork/"
};
@@ -218,7 +217,7 @@ public void OnPluginStart()
// Catch config error
if (!SQL_CheckConfig(DATABASE))
{
- SetFailState("Database failure: could not find database conf %s", DATABASE);
+ SetFailState("Database failure: could not find database conf %s", DATABASE);
return;
}
DB_Connect();
@@ -226,14 +225,14 @@ public void OnPluginStart()
ServerInfo();
- //Late loading support
+ // Late loading support
for (int client = 1; client <= MaxClients; client++)
{
if (IsClientInGame(client) && IsClientAuthorized(client))
OnClientPostAdminCheck(client);
}
- AddUpdaterLibrary(); //auto-updater
+ AddUpdaterLibrary(); // auto-updater
}
public void OnLibraryRemoved(const char[] name)
@@ -257,7 +256,6 @@ public void OnMapEnd()
g_hDatabase = INVALID_HANDLE;
}
-
// CLIENT CONNECTION FUNCTIONS //
public void OnClientDisconnect(client)
@@ -312,7 +310,7 @@ public void OnClientPostAdminCheck(client)
SQL_EscapeString(g_hDatabase, clientAuth[8], sClAuthYZEscaped, sizeof(sClAuthYZEscaped));
char Query[4096];
- FormatEx(Query, sizeof(Query),
+ FormatEx(Query, sizeof(Query),
"SELECT (c.ends - UNIX_TIMESTAMP()) AS remaining, \
c.length, c.type, c.created, c.reason, a.user, \
IF (a.immunity>=g.immunity, a.immunity, IFNULL(g.immunity,0)) AS immunity, \
@@ -322,7 +320,7 @@ public void OnClientPostAdminCheck(client)
LEFT JOIN %s_srvgroups AS g ON g.name = a.srv_group \
WHERE RemoveType IS NULL \
AND c.authid REGEXP '^STEAM_[0-9]:%s$' \
- AND (length = '0' OR ends > UNIX_TIMESTAMP())",
+ AND (length = '0' OR ends > UNIX_TIMESTAMP())",
DatabasePrefix, DatabasePrefix, DatabasePrefix, sClAuthYZEscaped);
#if defined LOG_QUERIES
LogToFile(logQuery, "OnClientPostAdminCheck for: %s. QUERY: %s", clientAuth, Query);
@@ -331,7 +329,6 @@ public void OnClientPostAdminCheck(client)
}
}
-
// OTHER CLIENT CODE //
public Action Event_OnPlayerName(Handle event, const char[] name, bool dontBroadcast)
@@ -525,7 +522,6 @@ public Action FWUnmute(args)
return Plugin_Handled;
}
-
public Action CommandCallback(client, const char[] command, args)
{
if (client && !CheckCommandAccess(client, command, ADMFLAG_CHAT))
@@ -566,7 +562,6 @@ public Action CommandCallback(client, const char[] command, args)
return Plugin_Stop;
}
-
// MENU CODE //
public OnAdminMenuReady(Handle topmenu)
@@ -1177,14 +1172,13 @@ public PanelHandler_ListTargetReason(Handle menu, MenuAction action, param1, par
{
if (action == MenuAction_Select)
{
- AdminMenu_ListTarget(param1, g_iPeskyPanels[param1][curTarget],
- g_iPeskyPanels[param1][curIndex],
- g_iPeskyPanels[param1][viewingMute],
+ AdminMenu_ListTarget(param1, g_iPeskyPanels[param1][curTarget],
+ g_iPeskyPanels[param1][curIndex],
+ g_iPeskyPanels[param1][viewingMute],
g_iPeskyPanels[param1][viewingGag]);
}
}
-
// SQL CALLBACKS //
public GotDatabase(Handle owner, Handle hndl, const char[] error, any:data)
@@ -1229,7 +1223,7 @@ public GotDatabase(Handle owner, Handle hndl, const char[] error, any:data)
}
// Process queue
- SQL_TQuery(SQLiteDB, Query_ProcessQueue,
+ SQL_TQuery(SQLiteDB, Query_ProcessQueue,
"SELECT id, steam_id, time, start_time, reason, name, admin_id, admin_ip, type \
FROM queue2");
@@ -1276,12 +1270,12 @@ public Query_UnBlockSelect(Handle owner, Handle hndl, const char[] error, any:da
int target = GetClientOfUserId(targetUserID);
#if defined DEBUG
- PrintToServer("Query_UnBlockSelect(adminUID: %d/%d, targetUID: %d/%d, type: %d, adminAuth: %s, targetAuth: %s, reason: %s)",
+ PrintToServer("Query_UnBlockSelect(adminUID: %d/%d, targetUID: %d/%d, type: %d, adminAuth: %s, targetAuth: %s, reason: %s)",
adminUserID, admin, targetUserID, target, type, adminAuth, targetAuth, reason);
#endif
char targetName[MAX_NAME_LENGTH];
- strcopy(targetName, MAX_NAME_LENGTH, target && IsClientInGame(target) ? g_sName[target] : targetAuth); //FIXME
+ strcopy(targetName, MAX_NAME_LENGTH, target && IsClientInGame(target) ? g_sName[target] : targetAuth); // FIXME
bool hasErrors = false;
// If error is not an empty string the query failed
@@ -1388,13 +1382,13 @@ public Query_UnBlockSelect(Handle owner, Handle hndl, const char[] error, any:da
SQL_EscapeString(g_hDatabase, reason, unbanReason, sizeof(unbanReason));
char query[2048];
- Format(query, sizeof(query),
+ Format(query, sizeof(query),
"UPDATE %s_comms \
SET RemovedBy = %d, \
RemoveType = 'U', \
RemovedOn = UNIX_TIMESTAMP(), \
ureason = '%s' \
- WHERE bid = %d",
+ WHERE bid = %d",
DatabasePrefix, iAID, unbanReason, bid);
#if defined LOG_QUERIES
LogToFile(logQuery, "Query_UnBlockSelect. QUERY: %s", query);
@@ -1545,7 +1539,7 @@ public Query_ProcessQueue(Handle owner, Handle hndl, const char[] error, any:dat
char sAdmAuthYZEscaped[sizeof(adminAuth) * 2 + 1];
// if we get to here then there are rows in the queue pending processing
- //steam_id TEXT, time INTEGER, start_time INTEGER, reason TEXT, name TEXT, admin_id TEXT, admin_ip TEXT, type INTEGER
+ // steam_id TEXT, time INTEGER, start_time INTEGER, reason TEXT, name TEXT, admin_id TEXT, admin_ip TEXT, type INTEGER
int id = SQL_FetchInt(hndl, 0);
SQL_FetchString(hndl, 1, auth, sizeof(auth));
int time = SQL_FetchInt(hndl, 2);
@@ -1567,11 +1561,11 @@ public Query_ProcessQueue(Handle owner, Handle hndl, const char[] error, any:dat
continue;
// all blocks should be entered into db!
- FormatEx(query, sizeof(query),
+ FormatEx(query, sizeof(query),
"INSERT INTO %s_comms (authid, name, created, ends, length, reason, aid, adminIp, sid, type) \
VALUES ('%s', '%s', %d, %d, %d, '%s', \
IFNULL((SELECT aid FROM %s_admins WHERE authid = '%s' OR authid REGEXP '^STEAM_[0-9]:%s$'), '0'), \
- '%s', %d, %d)",
+ '%s', %d, %d)",
DatabasePrefix, sAuthEscaped, banName, startTime, (startTime + (time * 60)), (time * 60), banReason, DatabasePrefix, sAdmAuthEscaped, sAdmAuthYZEscaped, adminIp, serverID, type);
#if defined LOG_QUERIES
LogToFile(logQuery, "Query_ProcessQueue. QUERY: %s", query);
@@ -1586,9 +1580,9 @@ public Query_AddBlockFromQueue(Handle owner, Handle hndl, const char[] error, an
if (error[0] == '\0')
{
// The insert was successful so delete the record from the queue
- FormatEx(query, sizeof(query),
+ FormatEx(query, sizeof(query),
"DELETE FROM queue2 \
- WHERE id = %d",
+ WHERE id = %d",
data);
#if defined LOG_QUERIES
LogToFile(logQuery, "Query_AddBlockFromQueue. QUERY: %s", query);
@@ -1683,7 +1677,6 @@ public Query_VerifyBlock(Handle owner, Handle hndl, const char[] error, any:user
g_bPlayerStatus[client] = true;
}
-
// TIMER CALL BACKS //
public Action ClientRecheck(Handle timer, any:userid)
@@ -1999,7 +1992,7 @@ stock InitializeBackupDB()
SetFailState(error);
}
- SQL_TQuery(SQLiteDB, Query_ErrorCheck,
+ SQL_TQuery(SQLiteDB, Query_ErrorCheck,
"CREATE TABLE IF NOT EXISTS queue2 ( \
id INTEGER PRIMARY KEY, \
steam_id TEXT, \
@@ -2018,8 +2011,8 @@ stock CreateBlock(client, targetId = 0, length = -1, type, const char[] sReason
PrintToServer("CreateBlock(admin: %d, target: %d, length: %d, type: %d, reason: %s, args: %s)", client, targetId, length, type, sReason, sArgs);
#endif
- decl target_list[MAXPLAYERS], target_count;
- bool tn_is_ml;
+ decl target_list[MAXPLAYERS], target_count;
+ bool tn_is_ml;
char target_name[MAX_NAME_LENGTH];
char reason[256];
bool skipped = false;
@@ -2053,13 +2046,13 @@ stock CreateBlock(client, targetId = 0, length = -1, type, const char[] sReason
// Get the target, find target returns a message on failure so we do not
if ((target_count = ProcessTargetString(
- sArg[0],
- client,
- target_list,
- MAXPLAYERS,
- COMMAND_FILTER_NO_BOTS,
- target_name,
- sizeof(target_name),
+ sArg[0],
+ client,
+ target_list,
+ MAXPLAYERS,
+ COMMAND_FILTER_NO_BOTS,
+ target_name,
+ sizeof(target_name),
tn_is_ml)) <= 0)
{
ReplyToTargetError(client, target_count);
@@ -2252,13 +2245,13 @@ stock ProcessUnBlock(client, targetId = 0, type, char[] sReason = "", const char
// Get the target, find target returns a message on failure so we do not
if ((target_count = ProcessTargetString(
- sArg[0],
- client,
- target_list,
- MAXPLAYERS,
- COMMAND_FILTER_NO_BOTS,
- target_name,
- sizeof(target_name),
+ sArg[0],
+ client,
+ target_list,
+ MAXPLAYERS,
+ COMMAND_FILTER_NO_BOTS,
+ target_name,
+ sizeof(target_name),
tn_is_ml)) <= 0)
{
ReplyToTargetError(client, target_count);
@@ -2308,7 +2301,7 @@ stock ProcessUnBlock(client, targetId = 0, type, char[] sReason = "", const char
}
case TYPE_UNSILENCE:
{
- if ((g_MuteType[target] == bTime || g_MuteType[target] == bPerm) &&
+ if ((g_MuteType[target] == bTime || g_MuteType[target] == bPerm) &&
(g_GagType[target] == bTime || g_GagType[target] == bPerm))
continue;
}
@@ -2416,7 +2409,7 @@ stock ProcessUnBlock(client, targetId = 0, type, char[] sReason = "", const char
SQL_EscapeString(g_hDatabase, targetAuth[8], sTargetAuthYZEscaped, sizeof(sTargetAuthYZEscaped));
char query[4096];
- Format(query, sizeof(query),
+ Format(query, sizeof(query),
"SELECT c.bid, \
IFNULL((SELECT aid FROM %s_admins WHERE authid = '%s' OR authid REGEXP '^STEAM_[0-9]:%s$'), '0') as iaid, \
c.aid, \
@@ -2428,7 +2421,7 @@ stock ProcessUnBlock(client, targetId = 0, type, char[] sReason = "", const char
WHERE RemoveType IS NULL \
AND (c.authid = '%s' OR c.authid REGEXP '^STEAM_[0-9]:%s$') \
AND (length = '0' OR ends > UNIX_TIMESTAMP()) \
- AND %s",
+ AND %s",
DatabasePrefix, sAdminAuthEscaped, sAdminAuthYZEscaped, DatabasePrefix, DatabasePrefix, DatabasePrefix, sTargetAuthEscaped, sTargetAuthYZEscaped, typeWHERE);
#if defined LOG_QUERIES
@@ -2558,9 +2551,9 @@ stock InsertTempBlock(length, type, const char[] name, const char[] auth, const
char banReason[256 * 2 + 1];
char sAuthEscaped[64 * 2 + 1];
char sAdminAuthEscaped[64 * 2 + 1];
- char sQuery[4096];
+ char sQuery[4096];
char sQueryVal[2048];
- char sQueryMute[2048];
+ char sQueryMute[2048];
char sQueryGag[2048];
// escaping everything
@@ -2570,8 +2563,8 @@ stock InsertTempBlock(length, type, const char[] name, const char[] auth, const
SQL_EscapeString(SQLiteDB, adminAuth, sAdminAuthEscaped, sizeof(sAdminAuthEscaped));
// steam_id time start_time reason name admin_id admin_ip
- FormatEx(sQueryVal, sizeof(sQueryVal),
- "'%s', %d, %d, '%s', '%s', '%s', '%s'",
+ FormatEx(sQueryVal, sizeof(sQueryVal),
+ "'%s', %d, %d, '%s', '%s', '%s', '%s'",
sAuthEscaped, length, GetTime(), banReason, banName, sAdminAuthEscaped, adminIp);
switch (type)
@@ -2585,8 +2578,8 @@ stock InsertTempBlock(length, type, const char[] name, const char[] auth, const
}
}
- FormatEx(sQuery, sizeof(sQuery),
- "INSERT INTO queue2 (steam_id, time, start_time, reason, name, admin_id, admin_ip, type) VALUES %s%s%s",
+ FormatEx(sQuery, sizeof(sQuery),
+ "INSERT INTO queue2 (steam_id, time, start_time, reason, name, admin_id, admin_ip, type) VALUES %s%s%s",
sQueryMute, type == TYPE_SILENCE ? ", " : "", sQueryGag);
#if defined LOG_QUERIES
@@ -2626,7 +2619,7 @@ stock ReadConfig()
PrintToServer("%sLoading configs/sourcebans/sourcebans.cfg config file", PREFIX);
InternalReadConfig(ConfigFile1);
}
- else
+ else
SetFailState("FATAL *** ERROR *** can't find %s", ConfigFile1);
if (FileExists(ConfigFile2))
@@ -2658,7 +2651,6 @@ stock ReadConfig()
#endif
}
-
// some more
AdminMenu_GetPunishPhrase(client, target, char[] name, length)
@@ -2708,7 +2700,7 @@ stock bool IsAllowedBlockLength(admin, length, target_count = 1)
if (!ConfigMaxLength || !admin || AdmHasFlag(admin))
return true;
- //return false if one of these statements evaluates to true; otherwise, return true
+ // return false if one of these statements evaluates to true; otherwise, return true
return !(!length || length > ConfigMaxLength);
}
else
@@ -2716,7 +2708,7 @@ stock bool IsAllowedBlockLength(admin, length, target_count = 1)
if (length < 0) //'session punishments allowed for mass-targeting'
return true;
- //return false if one of these statements evaluates to true; otherwise, return true
+ // return false if one of these statements evaluates to true; otherwise, return true
return !(!length || length > MAX_TIME_MULTI || length > DefaultTime);
}
}
@@ -2728,7 +2720,7 @@ stock bool AdmHasFlag(admin)
stock _:GetAdmImmunity(admin)
{
- return admin > 0 && GetUserAdmin(admin) != INVALID_ADMIN_ID ?
+ return admin > 0 && GetUserAdmin(admin) != INVALID_ADMIN_ID ?
GetAdminImmunityLevel(GetUserAdmin(admin)) : 0;
}
@@ -2940,14 +2932,14 @@ stock SavePunishment(admin = 0, target, type, length = -1, const char[] reason =
SQL_EscapeString(g_hDatabase, adminAuth, sAdminAuthIdEscaped, sizeof(sAdminAuthIdEscaped));
SQL_EscapeString(g_hDatabase, adminAuth[8], sAdminAuthIdYZEscaped, sizeof(sAdminAuthIdYZEscaped));
- // bid authid name created ends lenght reason aid adminip sid removedBy removedType removedon type ureason
- FormatEx(sQueryAdm, sizeof(sQueryAdm),
- "IFNULL((SELECT aid FROM %s_admins WHERE authid = '%s' OR authid REGEXP '^STEAM_[0-9]:%s$'), 0)",
+ // bid, authid, name, created, ends, lenght, reason, aid, adminip, sid, removedBy, removedType, removedon, type, ureason
+ FormatEx(sQueryAdm, sizeof(sQueryAdm),
+ "IFNULL((SELECT aid FROM %s_admins WHERE authid = '%s' OR authid REGEXP '^STEAM_[0-9]:%s$'), 0)",
DatabasePrefix, sAdminAuthIdEscaped, sAdminAuthIdYZEscaped);
- // authid name, created, ends, length, reason, aid, adminIp, sid
- FormatEx(sQueryVal, sizeof(sQueryVal),
- "'%s', '%s', UNIX_TIMESTAMP(), UNIX_TIMESTAMP() + %d, %d, '%s', %s, '%s', %d",
+ // authid, name, created, ends, length, reason, aid, adminIp, sid
+ FormatEx(sQueryVal, sizeof(sQueryVal),
+ "'%s', '%s', UNIX_TIMESTAMP(), UNIX_TIMESTAMP() + %d, %d, '%s', %s, '%s', %d",
sAuthidEscaped, banName, length * 60, length * 60, banReason, sQueryAdm, adminIp, serverID);
switch (type)
@@ -2962,8 +2954,8 @@ stock SavePunishment(admin = 0, target, type, length = -1, const char[] reason =
}
// litle magic - one query for all actions (mute, gag or silence)
- FormatEx(sQuery, sizeof(sQuery),
- "INSERT INTO %s_comms (authid, name, created, ends, length, reason, aid, adminIp, sid, type) VALUES %s%s%s",
+ FormatEx(sQuery, sizeof(sQuery),
+ "INSERT INTO %s_comms (authid, name, created, ends, length, reason, aid, adminIp, sid, type) VALUES %s%s%s",
DatabasePrefix, sQueryMute, type == TYPE_SILENCE ? ", " : "", sQueryGag);
#if defined LOG_QUERIES
@@ -2989,11 +2981,11 @@ stock SavePunishment(admin = 0, target, type, length = -1, const char[] reason =
stock ShowActivityToServer(admin, type, length = 0, char[] reason = "", char[] targetName, bool ml = false)
{
#if defined DEBUG
- PrintToServer("ShowActivityToServer(admin: %d, type: %d, length: %d, reason: %s, name: %s, ml: %b",
+ PrintToServer("ShowActivityToServer(admin: %d, type: %d, length: %d, reason: %s, name: %s, ml: %b",
admin, type, length, reason, targetName, ml);
#endif
- char actionName[32];
+ char actionName[32];
char translationName[64];
switch (type)
{
@@ -3013,7 +3005,7 @@ stock ShowActivityToServer(admin, type, length = 0, char[] reason = "", char[] t
strcopy(actionName, sizeof(actionName), "Gagged");
else if (length == 0)
strcopy(actionName, sizeof(actionName), "Permagagged");
- else //temp block
+ else // temp block
strcopy(actionName, sizeof(actionName), "Temp gagged");
}
//-------------------------------------------------------------------------------------------------
@@ -3023,7 +3015,7 @@ stock ShowActivityToServer(admin, type, length = 0, char[] reason = "", char[] t
strcopy(actionName, sizeof(actionName), "Silenced");
else if (length == 0)
strcopy(actionName, sizeof(actionName), "Permasilenced");
- else //temp block
+ else // temp block
strcopy(actionName, sizeof(actionName), "Temp silenced");
}
//-------------------------------------------------------------------------------------------------
@@ -3219,5 +3211,3 @@ public Native_GetClientGagType(Handle hPlugin, numParams)
return bType:g_GagType[target];
}
-
-//Yarr!
diff --git a/addons/sourcemod/scripting/votemute_p.sp b/addons/sourcemod/scripting/votemute_p.sp
index 292dd945aa..526fb55c14 100644
--- a/addons/sourcemod/scripting/votemute_p.sp
+++ b/addons/sourcemod/scripting/votemute_p.sp
@@ -1,3 +1,6 @@
+#pragma semicolon 1
+#pragma newdecls required
+
#include
#include
#include
@@ -17,8 +20,8 @@ Menu g_hVoteMenu = null;
#define VOTE_CLIENTID 0
#define VOTE_USERID 1
#define VOTE_NAME 0
-#define VOTE_NO "###no###"
-#define VOTE_YES "###yes###"
+#define VOTE_NO "###no###"
+#define VOTE_YES "###yes###"
#define VOTE_TYPE_GAG 0
#define VOTE_TYPE_MUTE 1
@@ -31,18 +34,18 @@ char g_voteInfo[3][65];
int g_votetype = 0;
-//Version is auto-filled by the travis builder
+// Version is auto-filled by the travis builder
public Plugin myinfo =
{
- name = "Vote Gag, Mute, Silence",
- author = "Dog, Stickz",
- description = "Allows vote gag, mute and silencing for sourcecomms",
- version = "dummy",
- url = "http://www.theville.org"
+ name = "Vote Gag, Mute, Silence",
+ author = "Dog, Stickz",
+ description = "Allows vote gag, mute and silencing for sourcecomms",
+ version = "dummy",
+ url = "http://www.theville.org"
}
/* Auto Updater */
-#define UPDATE_URL "https://github.com/stickz/Redstone/raw/build/updater/votemute_p/votemute_p.txt"
+#define UPDATE_URL "https://github.com/stickz/Redstone/raw/build/updater/votemute_p/votemute_p.txt"
#include "updater/standard.sp"
public void OnPluginStart()
@@ -53,15 +56,15 @@ public void OnPluginStart()
AutoExecConfig(true, "votemute_p");
- //Allowed for ALL players
- RegConsoleCmd("sm_votemute", Command_Votemute, "sm_votemute ");
- RegConsoleCmd("sm_votesilence", Command_Votesilence, "sm_votesilence ");
- RegConsoleCmd("sm_votegag", Command_Votegag, "sm_votegag ");
+ // Allowed for ALL players
+ RegConsoleCmd("sm_votemute", Command_Votemute, "sm_votemute ");
+ RegConsoleCmd("sm_votesilence", Command_Votesilence, "sm_votesilence ");
+ RegConsoleCmd("sm_votegag", Command_Votegag, "sm_votegag ");
LoadTranslations("common.phrases"); // required for find target
LoadTranslations("votemute_p.phrases");
- AddUpdaterLibrary(); //auto-updater
+ AddUpdaterLibrary(); // auto-updater
}
public Action Command_Votemute(int client, int args)
@@ -85,7 +88,7 @@ public Action Command_Votemute(int client, int args)
else if (SourceComms_GetClientMuteType(target) != bNot)
{
- PrintMessage(client, "Already Muted"); //This client is already muted!
+ PrintMessage(client, "Already Muted"); // This client is already muted!
return Plugin_Handled;
}
@@ -109,7 +112,7 @@ public Action Command_Votesilence(int client, int args)
else
{
char arg[64];
- GetCmdArg(1, arg, sizeof(args));
+ GetCmdArg(1, arg, sizeof(arg));
int target = FindTarget(client, arg);
if (target == INVALID_TARGET)
@@ -117,8 +120,8 @@ public Action Command_Votesilence(int client, int args)
else if (IsSourceCommSilenced(target))
{
- PrintMessage(client, "Already Silenced"); //This client is already silenced
- return Plugin_Handled;
+ PrintMessage(client, "Already Silenced"); // This client is already silenced
+ return Plugin_Handled;
}
g_votetype = VOTE_TYPE_SILENCE;
@@ -148,7 +151,7 @@ public Action Command_Votegag(int client, int args)
else if (SourceComms_GetClientGagType(target) != bNot)
{
- PrintMessage(client, "Already Gagged"); //This client is already gagged
+ PrintMessage(client, "Already Gagged"); // This client is already gagged
return Plugin_Handled;
}
@@ -162,23 +165,23 @@ bool CanStartVote(int client)
{
if (IsVoteInProgress())
{
- PrintMessage(client, "Vote in Progress"); //Please wait for the current server-wide vote to finish
+ PrintMessage(client, "Vote in Progress"); // Please wait for the current server-wide vote to finish
return false;
}
if (g_Cvar_Admins.BoolValue && !IsValidAdmin(client, "k"))
{
- PrintMessage(client, "Moderater Only"); //This command is for server moderators only
+ PrintMessage(client, "Moderater Only"); // This command is for server moderators only
return false;
- }
+ }
if (!TestVoteDelay(client))
return false;
if (IsSourceCommSilenced(client))
{
- PrintMessage(client, "Silence Use"); //You cannot use this feature while silenced
- return false;
+ PrintMessage(client, "Silence Use"); // You cannot use this feature while silenced
+ return false;
}
return true;
@@ -194,9 +197,9 @@ void DisplayVoteMuteMenu(int client, int target)
char Name[16];
switch (g_votetype)
{
- case VOTE_TYPE_MUTE: Format(Name, sizeof(Name), "Mute");
- case VOTE_TYPE_GAG: Format(Name, sizeof(Name), "Gag");
- case VOTE_TYPE_SILENCE: Format(Name, sizeof(Name), "Silence");
+ case VOTE_TYPE_MUTE: Format(Name, sizeof(Name), "Mute");
+ case VOTE_TYPE_GAG: Format(Name, sizeof(Name), "Gag");
+ case VOTE_TYPE_SILENCE: Format(Name, sizeof(Name), "Silence");
}
PrintAndLogVoteStart(client, target, Name);
@@ -205,17 +208,17 @@ void DisplayVoteMuteMenu(int client, int target)
Menu CreateGlobalVoteMenu(const char[] name)
{
- //Create new menu object
- Menu menu = new Menu(Handler_VoteCallback, MenuAction:MENU_ACTIONS_ALL);
+ // Create new menu object
+ Menu menu = new Menu(Handler_VoteCallback, MENU_ACTIONS_ALL);
- //Set various menu properties
+ // Set various menu properties
menu.SetTitle("%s Player:", name);
menu.AddItem(VOTE_YES, "Yes");
menu.AddItem(VOTE_NO, "No");
menu.ExitButton = false;
menu.DisplayVoteToAll(20);
- //return the created menu
+ // return the created menu
return menu;
}
@@ -250,7 +253,6 @@ void DisplayVoteTargetMenu(int client)
menu.Display(client, MENU_TIME_FOREVER);
}
-
public int MenuHandler_Vote(Menu menu, MenuAction action, int param1, int param2)
{
switch (action)
@@ -266,9 +268,9 @@ public int MenuHandler_Vote(Menu menu, MenuAction action, int param1, int param2
PrintToChat(param1, "[SM] %s", "Player no longer available");
else
- DisplayVoteMuteMenu(param1, target);
+ DisplayVoteMuteMenu(param1, target);
}
- }
+ }
return 0;
}
@@ -290,28 +292,28 @@ public int Handler_VoteCallback(Menu menu, MenuAction action, int param1, int pa
char buffer[255];
Format(buffer, sizeof(buffer), "%s %s", title, g_voteInfo[VOTE_NAME]);
- new Handle:panel = Handle:param2;
- SetPanelTitle(panel, buffer);
+ Panel panel = view_as(param2);
+ panel.SetTitle(buffer);
}
case MenuAction_DisplayItem:
{
char display[64];
menu.GetItem(param2, "", 0, _, display, sizeof(display));
-
+
if (strcmp(display, "No") == 0 || strcmp(display, "Yes") == 0)
{
char buffer[255];
Format(buffer, sizeof(buffer), "%s", display);
return RedrawMenuItem(buffer);
- }
+ }
}
//case MenuAction_Select: VoteSelect(menu, param1, param2);
case MenuAction_VoteCancel:
{
- if (param1 == VoteCancel_NoVotes)
+ if (param1 == VoteCancel_NoVotes)
PrintToChatAll("[SM] %s", "No Votes Cast");
}
@@ -337,7 +339,7 @@ public int Handler_VoteCallback(Menu menu, MenuAction action, int param1, int pa
}
else
{
- PrintToChatAll("[SM] %s", "Vote Successful", RoundToNearest(100.0*percent), totalVotes);
+ PrintToChatAll("[SM] %s", "Vote Successful", RoundToNearest(100.0*percent), totalVotes);
switch (g_votetype)
{
@@ -350,38 +352,38 @@ public int Handler_VoteCallback(Menu menu, MenuAction action, int param1, int pa
case VOTE_TYPE_GAG:
{
- PrintToChatAll("[SM] %s", "Gagged target", "_s", g_voteInfo[VOTE_NAME]);
+ PrintToChatAll("[SM] %s", "Gagged target", "_s", g_voteInfo[VOTE_NAME]);
LogAction(-1, g_voteClient[VOTE_CLIENTID], "Vote gag successful, gagged \"%L\" ", g_voteClient[VOTE_CLIENTID]);
- SourceComms_SetClientGag(g_voteClient[VOTE_CLIENTID], true, g_Cvar_Duration.IntValue, true, "Voted by players");
+ SourceComms_SetClientGag(g_voteClient[VOTE_CLIENTID], true, g_Cvar_Duration.IntValue, true, "Voted by players");
}
case VOTE_TYPE_SILENCE:
{
- PrintToChatAll("[SM] %s", "Silenced target", "_s", g_voteInfo[VOTE_NAME]);
+ PrintToChatAll("[SM] %s", "Silenced target", "_s", g_voteInfo[VOTE_NAME]);
LogAction(-1, g_voteClient[VOTE_CLIENTID], "Vote silence successful, silenced \"%L\" ", g_voteClient[VOTE_CLIENTID]);
SourceComms_SetClientGag(g_voteClient[VOTE_CLIENTID], true, g_Cvar_Duration.IntValue, true, "Voted by players");
- SourceComms_SetClientMute(g_voteClient[VOTE_CLIENTID], true, g_Cvar_Duration.IntValue, true, "Voted by players");
+ SourceComms_SetClientMute(g_voteClient[VOTE_CLIENTID], true, g_Cvar_Duration.IntValue, true, "Voted by players");
}
}
}
}
}
- return 0;
+ return 0;
}
float GetVotePercent(int votes, int totalVotes) {
return float(votes) / float(totalVotes);
}
-bool TestVoteDelay(client)
+bool TestVoteDelay(int client)
{
- int delay = CheckVoteDelay();
-
- if (delay > 0)
- {
- PrintToChat(client, "%s %t.", PREFIX, "Wait Seconds", delay);
- return false;
- }
-
+ int delay = CheckVoteDelay();
+
+ if (delay > 0)
+ {
+ PrintToChat(client, "%s %t.", PREFIX, "Wait Seconds", delay);
+ return false;
+ }
+
return true;
}