trim whitespace & add licenses

This commit is contained in:
rtldg 2022-01-01 09:53:34 +00:00
parent 168968800d
commit 0c91c19ba6
26 changed files with 261 additions and 312 deletions

View File

@ -1,9 +1,33 @@
/*
MIT License
Copyright (c) 2019 KiD Fearless
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
*/
#if defined _convar_class_included
#endinput
#endif
#define _convar_class_included
// todo: track previous default values
// todo: track previous default values
static ArrayList _ConvarList;
@ -48,7 +72,7 @@ methodmap Convar < ConVar
savedValue.cvar = cvar;
strcopy(savedValue.description, 512, description);
strcopy(savedValue.defValue, sizeof(savedValue.defValue), defaultValue);
// Can't set default values :T
savedValue.SetMin(hasMin, min);
savedValue.SetMax(hasMax, max);
@ -126,7 +150,7 @@ methodmap Convar < ConVar
{
continue;
}
// make a copy of our description
char descr[512];
descr = convar.description;
@ -257,7 +281,7 @@ methodmap Convar < ConVar
{
file.WriteLine("// Maximum: \"%02f\"", x);
}
// only difference is that now we check for a stored value.
char storedValue[512];
if(convars.GetString(name, storedValue, 512))
@ -277,7 +301,7 @@ methodmap Convar < ConVar
char pluginName[64];
GetPluginFilename(GetMyHandle(), pluginName, 64);
LogError("Failed to auto generate config for %s, make sure the directory has write permission.", pluginName);
if(clearWhenDone)
{
delete _ConvarList;
@ -286,7 +310,7 @@ methodmap Convar < ConVar
delete convars;
return false;
}
delete convars;
}
if(fileExists)

View File

@ -1,4 +1,22 @@
/*
* shavit's Timer - anti-sv_cheats.sp
* by: rtldg
*
* This file is part of shavit's Timer.
*
* This program is free software; you can redistribute it and/or modify it under
* the terms of the GNU General Public License, version 3.0, as published by the
* Free Software Foundation.
*
* This program is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
* FOR A PARTICULAR PURPOSE. See the 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, see <http://www.gnu.org/licenses/>.
*
*/
Convar gCV_DisableSvCheats = null;

View File

@ -129,28 +129,28 @@ methodmap Shavit_BunnyhopStats __nullable__
}
property bool OnGround
{
{
public get()
{
return Shavit_Bhopstats_IsOnGround(this.index);
}
}
}
property bool HoldingJump
{
{
public get()
{
return Shavit_Bhopstats_IsHoldingJump(this.index);
}
}
}
property float PerfectJumps
{
{
public get()
{
return Shavit_Bhopstats_GetPerfectJumps(this.index);
}
}
}
public void ResetPrefects()
{
@ -158,29 +158,29 @@ methodmap Shavit_BunnyhopStats __nullable__
}
public static int GetScrollCount(int client)
{
{
return Shavit_Bhopstats_GetScrollCount(client);
}
}
public static bool IsOnGround(int client)
{
{
return Shavit_Bhopstats_IsOnGround(client);
}
}
public static bool IsHoldingJump(int client)
{
{
return Shavit_Bhopstats_IsHoldingJump(client);
}
}
public static float GetPerfectJumps(int client)
{
{
return Shavit_Bhopstats_GetPerfectJumps(client);
}
}
public static void ResetPrefectJumps(int client)
{
{
Shavit_Bhopstats_ResetPerfectJumps(client);
}
}
}
#if !defined REQUIRE_PLUGIN

View File

@ -124,7 +124,6 @@ public void Bhopstats_PostThinkPost(int client)
gB_PlayerTouchingGround[client] = false;
}
else if(!gB_PlayerTouchingGround[client] && ((gB_JumpHeld[client] && iGroundEntity != -1) || iGroundEntity == -1 || bOnLadder))
{
Call_StartForward(gH_Forwards_OnLeaveGround);
@ -156,7 +155,6 @@ public void Bhopstats_PostThinkPost(int client)
}
}
}
else if(gI_Buttons[client] & IN_JUMP && !(buttons & IN_JUMP))
{
Call_StartForward(gH_Forwards_OnJumpReleased);

View File

@ -295,7 +295,7 @@ stock void GetTimerSQLPrefix(char[] buffer, int maxlen)
{
SetFailState("Cannot open \"configs/shavit-prefix.txt\". Make sure this file exists and that the server has read permissions to it.");
}
char sLine[PLATFORM_MAX_PATH * 2];
if(fFile.ReadLine(sLine, PLATFORM_MAX_PATH * 2))
@ -501,16 +501,16 @@ stock void TrimDisplayString(const char[] str, char[] outstr, int outstrlen, int
for(int i = 0; str[i]; i++)
{
count += ((str[i] & 0xc0) != 0x80) ? 1 : 0;
if(count <= max_allowed_length)
{
outstr[i] = str[i];
finallen = i;
}
}
outstr[finallen + 1] = '\0';
if(count > max_allowed_length)
Format(outstr, outstrlen, "%s...", outstr);
}
@ -521,7 +521,7 @@ stock void TrimDisplayString(const char[] str, char[] outstr, int outstrlen, int
* Use this forward in modules that use OnPlayerRunCmd to avoid errors and unintended behavior.
* If a module conflicts with buttons/velocity/angles being changed in shavit-core, this forward is recommended.
* This forward will NOT be called if a player's timer is paused.
*
*
* @param client Client index.
* @param buttons Buttons sent in the usercmd.
* @param impulse Impulse sent in the usercmd.
@ -771,7 +771,7 @@ forward Action Shavit_OnClanTagChangePre(int client, char[] clantag, int clantag
* @param client Client index.
* @param customtag Reference to the custom clan tag buffer.
* @param customtaglength Max length of the customtag buffer.
* @noreturn
* @noreturn
*/
forward void Shavit_OnClanTagChangePost(int client, char[] customtag, int customtaglength);
@ -782,7 +782,7 @@ forward void Shavit_OnClanTagChangePost(int client, char[] customtag, int custom
* @param zonetype Zone type (Zone_Start or Zone_End).
* @param offset Time offset from the given zone.
* @param distance Distance used in time offset.
* @noreturn
* @noreturn
*/
forward void Shavit_OnTimeOffsetCalculated(int client, int zonetype, float offset, float distance);

View File

@ -80,4 +80,4 @@ public void __pl_shavit_mapchooser_SetNTVOptional()
MarkNativeAsOptional("Shavit_GetMapsArrayList");
MarkNativeAsOptional("Shavit_GetMapsStringMap");
}
#endif
#endif

View File

@ -1,3 +1,23 @@
/*
* shavit's Timer - replay file stocks & format
* by: shavit
*
* This file is part of shavit's Timer.
*
* This program is free software; you can redistribute it and/or modify it under
* the terms of the GNU General Public License, version 3.0, as published by the
* Free Software Foundation.
*
* This program is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
* FOR A PARTICULAR PURPOSE. See the 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, see <http://www.gnu.org/licenses/>.
*
*/
#if defined _shavit_replay_file_included
#endinput
#endif
@ -231,7 +251,7 @@ stock File ReadReplayHeader(const char[] path, replay_header_t header, int style
file.ReadString(header.sMap, PLATFORM_MAX_PATH);
file.ReadUint8(header.iStyle);
file.ReadUint8(header.iTrack);
file.ReadInt32(header.iPreFrames);
// In case the replay was from when there could still be negative preframes
@ -371,4 +391,3 @@ stock void WriteReplayFrames(ArrayList playerrecording, int iSize, File file_a,
}
}
}

View File

@ -301,7 +301,7 @@ native bool Shavit_IsReplayEntity(int ent);
native void Shavit_SetReplayCacheName(int bot, char[] name);
/**
* Starts a replay given a style and track.
* Starts a replay given a style and track.
*
* @param style Bhop style.
* @param track Timer track.
@ -356,7 +356,7 @@ native int Shavit_StartReplayFromFile(int style, int track, float delay, int cli
* @param restart Restart the playback of the replay bot if it's playing?
* @param path Path to the replay file. Use `BuildPath(Path_SM, ...)` to generate one. Leave as empty to use default.
* @return Was the replay loaded?
*/
*/
native bool Shavit_ReloadReplay(int style, int track, bool restart, char[] path = "");
/**

View File

@ -1,3 +1,22 @@
/*
* shavit's Timer - stocks used by the replay plugins
* by: shavit
*
* This file is part of shavit's Timer.
*
* This program is free software; you can redistribute it and/or modify it under
* the terms of the GNU General Public License, version 3.0, as published by the
* Free Software Foundation.
*
* This program is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
* FOR A PARTICULAR PURPOSE. See the 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, see <http://www.gnu.org/licenses/>.
*
*/
stock bool Shavit_ReplayEnabledStyle(int style)
{
@ -10,7 +29,7 @@ stock bool Shavit_GetReplayFolderPath_Stock(char buffer[PLATFORM_MAX_PATH])
BuildPath(Path_SM, sPath, PLATFORM_MAX_PATH, "configs/shavit-replay.cfg");
KeyValues kv = new KeyValues("shavit-replay");
if (!kv.ImportFromFile(sPath))
{
delete kv;
@ -68,4 +87,4 @@ stock void Shavit_Replay_CreateDirectories(const char[] sReplayFolder, int style
{
SetFailState("Failed to write to replay folder (%s). Make sure you have file permissions.", sReplayFolder);
}
}
}

View File

@ -1,3 +1,20 @@
/*
* Steam ID handling stocks
* by: rtldg
*
* This program is free software; you can redistribute it and/or modify it under
* the terms of the GNU General Public License, version 3.0, as published by the
* Free Software Foundation.
*
* This program is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
* FOR A PARTICULAR PURPOSE. See the 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, see <http://www.gnu.org/licenses/>.
*
*/
#if defined _steamid_stocks_included
#endinput

View File

@ -372,6 +372,7 @@ public SMCResult OnStyleKeyValue(SMCParser smc, const char[] key, const char[] v
{
SetStyleSetting(gI_CurrentParserIndex, key, value);
gSM_StyleKeysSet.SetValue(key, true);
return SMCParse_Continue;
}
@ -414,7 +415,7 @@ public int Native_GetStyleSetting(Handle handler, int numParams)
GetNativeString(2, sKey, sizeof(sKey));
int maxlength = GetNativeCell(4);
char sValue[128];
bool ret = GetStyleSetting(style, sKey, sValue, sizeof(sValue));

View File

@ -1,3 +1,22 @@
/*
* shavit's Timer - weapon stocks
* by: shavit
*
* This file is part of shavit's Timer.
*
* This program is free software; you can redistribute it and/or modify it under
* the terms of the GNU General Public License, version 3.0, as published by the
* Free Software Foundation.
*
* This program is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
* FOR A PARTICULAR PURPOSE. See the 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, see <http://www.gnu.org/licenses/>.
*
*/
#if defined _shavit_weapon_stocks_included
#endinput

View File

@ -260,7 +260,7 @@ bool LoadChatConfig()
BuildPath(Path_SM, sPath, PLATFORM_MAX_PATH, "configs/shavit-chat.cfg");
KeyValues kv = new KeyValues("shavit-chat");
if(!kv.ImportFromFile(sPath) || !kv.GotoFirstSubKey())
{
delete kv;
@ -277,7 +277,7 @@ bool LoadChatConfig()
kv.GetString("ranks", sRanks, 32, "0");
if(sRanks[0] == 'p')
{
{
chat_title.iRequire = Require_Points;
}
else if(sRanks[0] == 'w')
@ -337,10 +337,10 @@ bool LoadChatConfig()
continue;
}
}
chat_title.bFree = view_as<bool>(kv.GetNum("free", false));
chat_title.bEasterEgg = view_as<bool>(kv.GetNum("easteregg", false));
kv.GetString("name", chat_title.sName, MAXLENGTH_NAME, "{name}");
kv.GetString("message", chat_title.sMessage, MAXLENGTH_MESSAGE, "");
kv.GetString("display", chat_title.sDisplay, MAXLENGTH_DISPLAY, "");
@ -364,7 +364,7 @@ bool LoadChatSettings()
BuildPath(Path_SM, sPath, PLATFORM_MAX_PATH, "configs/shavit-chatsettings.cfg");
KeyValues kv = new KeyValues("shavit-chat");
if(!kv.ImportFromFile(sPath))
{
delete kv;
@ -379,7 +379,6 @@ bool LoadChatSettings()
{
failed = !kv.JumpToKey("CS:S");
}
else if(gEV_Type == Engine_CSGO)
{
failed = !kv.JumpToKey("CS:GO");
@ -448,7 +447,6 @@ public Action Hook_SayText2(UserMsg msg_id, any msg, const int[] players, int pl
pbmsg.ReadString("params", sOriginalName, MAXLENGTH_NAME, 0);
pbmsg.ReadString("params", sOriginalText, MAXLENGTH_TEXT, 1);
}
else
{
BfRead bfmsg = UserMessageToBfRead(msg);
@ -520,7 +518,6 @@ public Action Hook_SayText2(UserMsg msg_id, any msg, const int[] players, int pl
TrimString(sOriginalText);
Format(sOriginalText, MAXLENGTH_MESSAGE, "%s%s", sFixedMessage, sCMessage);
}
else
{
Format(sOriginalText, MAXLENGTH_MESSAGE, "%s%s", sCMessage, sOriginalText);
@ -580,7 +577,7 @@ void Frame_SendText(DataPack pack)
{
return;
}
Handle hSayText2 = StartMessage("SayText2", clients, count, USERMSG_RELIABLE|USERMSG_BLOCKHOOKS);
if(hSayText2 == null)
@ -597,14 +594,13 @@ void Frame_SendText(DataPack pack)
pbmsg.SetInt("ent_idx", client);
pbmsg.SetBool("chat", true);
pbmsg.SetString("msg_name", sText);
// needed to not crash
for(int i = 1; i <= 4; i++)
{
pbmsg.AddString("params", "");
}
}
else
{
BfWrite bfmsg = UserMessageToBfWrite(hSayText2);
@ -622,12 +618,10 @@ public void OnLibraryAdded(const char[] name)
{
gB_RTLer = true;
}
else if(StrEqual(name, "shavit-rankings"))
{
gB_Rankings = true;
}
else if(StrEqual(name, "shavit-stats"))
{
gB_Stats = true;
@ -640,12 +634,10 @@ public void OnLibraryRemoved(const char[] name)
{
gB_RTLer = false;
}
else if(StrEqual(name, "shavit-rankings"))
{
gB_Rankings = false;
}
else if(StrEqual(name, "shavit-stats"))
{
gB_Stats = false;
@ -662,7 +654,6 @@ public void OnClientCookiesCached(int client)
SetClientCookie(client, gH_ChatCookie, "-2");
gI_ChatSelection[client] = -2;
}
else
{
gI_ChatSelection[client] = StringToInt(sChatSettings);
@ -718,7 +709,6 @@ public Action Command_CCHelp(int client, int args)
"CCHelp_CSS_1", client,
"CCHelp_CSS_2", client);
}
else
{
PrintToConsole(client, "%T", "CCHelp_CSGO_1", client);
@ -754,7 +744,6 @@ public Action Command_CCName(int client, int args)
return Plugin_Handled;
}
else if(StrEqual(sArgs, "off"))
{
Shavit_PrintToChat(client, "%T", "NameOff", client, sArgs);
@ -804,7 +793,6 @@ public Action Command_CCMessage(int client, int args)
return Plugin_Handled;
}
else if(StrEqual(sArgs, "off"))
{
Shavit_PrintToChat(client, "%T", "MessageOff", client, sArgs);
@ -910,7 +898,7 @@ Action ShowChatRanksMenu(int client, int item)
else if (iSize == 1)
{
AdminFlag afFlag = view_as<AdminFlag>(0);
if(FindFlagByChar(cache.sAdminFlag[0], afFlag))
{
bFlagAccess = GetAdminFlag(GetUserAdmin(client), afFlag);
@ -1049,13 +1037,12 @@ void PreviewChat(int client, int rank)
pbmsg.SetInt("ent_idx", client);
pbmsg.SetBool("chat", true);
pbmsg.SetString("msg_name", sTextFormatting);
for(int i = 1; i <= 4; i++)
{
pbmsg.AddString("params", "");
}
}
else
{
BfWrite bfmsg = UserMessageToBfWrite(hSayText2);
@ -1080,7 +1067,6 @@ bool HasRankAccess(int client, int rank)
{
return true;
}
else if(!(0 <= rank <= (gA_ChatRanks.Length - 1)))
{
return false;
@ -1099,17 +1085,15 @@ bool HasRankAccess(int client, int rank)
{
bFlagAccess = true;
}
else if(iSize == 1)
{
AdminFlag afFlag = view_as<AdminFlag>(0);
if(FindFlagByChar(sFlag[0], afFlag))
{
bFlagAccess = GetAdminFlag(GetUserAdmin(client), afFlag);
}
}
else
{
bFlagAccess = CheckCommandAccess(client, sFlag, 0, true);
@ -1188,7 +1172,7 @@ bool HasRankAccess(int client, int rank)
}
float fPercentile = (fVal / fTotal) * 100.0;
if(cache.fFrom <= fPercentile <= cache.fTo)
{
return true;
@ -1396,7 +1380,6 @@ void FormatRandom(char[] buffer, int size)
{
FormatEx(temp, 8, "\x07%06X", GetRandomInt(0, 0xFFFFFF));
}
else
{
strcopy(temp, 8, gS_CSGOColors[GetRandomInt(0, sizeof(gS_CSGOColors) - 1)]);
@ -1444,7 +1427,7 @@ void FormatChat(int client, char[] buffer, int size)
FormatEx(temp, 32, "%0.f", Shavit_GetPoints(client));
ReplaceString(buffer, size, "{pts}", temp);
FormatEx(temp, 32, "%d", Shavit_GetWRHolderRank(client));
ReplaceString(buffer, size, "{wrrank}", temp);
@ -1569,7 +1552,7 @@ void RemoveFromString(char[] buf, char[] thing, int extra)
{
int index, len = strlen(buf);
extra += strlen(thing);
while ((index = StrContains(buf, thing, true)) != -1)
{
// Search sequence is in the end of the string, so just cut it and exit
@ -1578,7 +1561,7 @@ void RemoveFromString(char[] buf, char[] thing, int extra)
buf[index] = '\0';
break;
}
while (buf[index] != 0)
{
buf[index] = buf[index+extra];
@ -1676,7 +1659,7 @@ public int Native_GetPlainChatrank(Handle handler, int numParams)
FormatEx(sRank, 16, "%.02f", fPercentile);
ReplaceString(buf, sizeof(buf), "{rank2}", sRank);
FormatEx(sRank, 16, "%.03f", fPercentile);
ReplaceString(buf, sizeof(buf), "{rank3}", sRank);

View File

@ -414,9 +414,9 @@ public void OnClientPutInServer(int client)
if(gA_Checkpoints[client] == null)
{
gA_Checkpoints[client] = new ArrayList(sizeof(cp_cache_t));
gA_Checkpoints[client] = new ArrayList(sizeof(cp_cache_t));
}
else
else
{
ResetCheckpoints(client);
}
@ -467,7 +467,7 @@ public void Shavit_OnStyleChanged(int client, int oldstyle, int newstyle, int tr
// OnClientPutInServer will still fire but we need a valid arraylist in the mean time.
if(gA_Checkpoints[client] == null)
{
gA_Checkpoints[client] = new ArrayList(sizeof(cp_cache_t));
gA_Checkpoints[client] = new ArrayList(sizeof(cp_cache_t));
}
OpenCheckpointsMenu(client);
@ -704,7 +704,7 @@ void DeleteCheckpointCacheList(ArrayList cps)
cps.GetArray(i, cache);
DeleteCheckpointCache(cache);
}
cps.Clear();
}
}
@ -766,7 +766,7 @@ public Action Command_Save(int client, int args)
}
if(SaveCheckpoint(client))
{
{
Shavit_PrintToChat(client, "%T", "MiscCheckpointsSaved", client, gI_CurrentCheckpoint[client], gS_ChatStrings.sVariable, gS_ChatStrings.sText);
if (ShouldReopenCheckpointMenu(client))
@ -1007,7 +1007,6 @@ public int MenuHandler_KZCheckpoints(Menu menu, MenuAction action, int param1, i
OpenCheckpointsMenu(param1);
}
else if(action == MenuAction_Cancel)
{
if(param2 == MenuCancel_Exit)
@ -1015,7 +1014,6 @@ public int MenuHandler_KZCheckpoints(Menu menu, MenuAction action, int param1, i
gB_ClosedKZCP[param1] = true;
}
}
else if(action == MenuAction_End)
{
delete menu;
@ -1041,7 +1039,6 @@ void OpenNormalCPMenu(int client)
{
menu.SetTitle("%T\n%T\n ", "MiscCheckpointMenu", client, "MiscCheckpointWarning", client);
}
else
{
menu.SetTitle("%T\n ", "MiscCheckpointMenuSegmented", client);
@ -1120,7 +1117,7 @@ public int MenuHandler_Checkpoints(Menu menu, MenuAction action, int param1, int
Call_PushCell(param1);
Call_PushCell(param2);
Call_PushStringEx(sInfo, 16, SM_PARAM_STRING_COPY, SM_PARAM_COPYBACK);
Call_PushCell(16);
Call_PushCell(16);
Call_PushCell(iCurrent);
Call_PushCell(iMaxCPs);
@ -1244,7 +1241,6 @@ public int MenuHandler_CheckpointsDelete(Menu menu, MenuAction action, int param
OpenCheckpointsMenu(param1);
}
else if(action == MenuAction_End)
{
delete menu;
@ -1313,7 +1309,7 @@ bool SaveCheckpoint(int client)
if(style < 0 || track < 0)
{
Shavit_PrintToChat(client, "%T", "CommandAliveSpectate", client, gS_ChatStrings.sVariable, gS_ChatStrings.sText, gS_ChatStrings.sVariable, gS_ChatStrings.sText);
return false;
}
}
@ -1328,7 +1324,7 @@ bool SaveCheckpoint(int client)
Call_PushCell(index);
Call_PushCell(overflow);
Call_Finish(result);
if(result != Plugin_Continue)
{
return false;
@ -1513,7 +1509,7 @@ void TeleportToCheckpoint(int client, int index, bool suppressMessage)
Call_PushCell(client);
Call_PushCell(index);
Call_Finish(result);
if(result != Plugin_Continue)
{
return;
@ -1703,7 +1699,7 @@ public any Native_SetCheckpoint(Handle plugin, int numParams)
DeleteCheckpoint(client, position, true);
gA_Checkpoints[client].SetArray(position-1, cpcache);
return true;
}
@ -1762,7 +1758,7 @@ public any Native_SetCurrentCheckpoint(Handle plugin, int numParams)
{
int client = GetNativeCell(1);
int index = GetNativeCell(2);
gI_CurrentCheckpoint[client] = index;
return 0;
}

View File

@ -264,7 +264,6 @@ public void OnPluginStart()
sv_autobunnyhopping = FindConVar("sv_autobunnyhopping");
sv_autobunnyhopping.BoolValue = false;
}
else if(gEV_Type != Engine_CSS && gEV_Type != Engine_TF2)
{
SetFailState("This plugin was meant to be used in CS:S, CS:GO and TF2 *only*.");
@ -770,7 +769,6 @@ public Action Command_TogglePause(int client, int args)
Shavit_PrintToChat(client, "%T", "MessageUnpause", client, gS_ChatStrings.sText, gS_ChatStrings.sVariable, gS_ChatStrings.sText);
}
else
{
if((iFlags & CPR_NotOnGround) > 0)
@ -1006,7 +1004,6 @@ public Action Command_Migration(int client, int args)
bApplyMigration[i] = true;
}
}
else
{
int iMigration = StringToInt(sArg);
@ -1063,7 +1060,6 @@ public Action Command_WipePlayer(int client, int args)
Shavit_PrintToChat(client, "Preparing to delete all user data for SteamID %s[U:1:%d]%s. To confirm, enter %s!wipeplayer %s",
gS_ChatStrings.sVariable, gI_WipePlayerID[client], gS_ChatStrings.sText, gS_ChatStrings.sVariable2, gS_Verification[client]);
}
else
{
Shavit_PrintToChat(client, "Deleting data for SteamID %s[U:1:%d]%s...",
@ -1275,7 +1271,6 @@ public Action Command_Style(int client, int args)
{
menu.AddItem("-1", "Nothing");
}
else if(menu.ItemCount <= ((gEV_Type == Engine_CSS)? 9:8))
{
menu.Pagination = MENU_NO_PAGINATION;
@ -1303,7 +1298,6 @@ public int StyleMenu_Handler(Menu menu, MenuAction action, int param1, int param
ChangeClientStyle(param1, style, true);
}
else if(action == MenuAction_End)
{
delete menu;
@ -1567,7 +1561,6 @@ void VelocityChanges(int data)
{
SetEntPropVector(client, Prop_Data, "m_vecAbsVelocity", fAbsVelocity);
}
else
{
TeleportEntity(client, NULL_VECTOR, NULL_VECTOR, fAbsVelocity);
@ -2546,7 +2539,6 @@ public void OnClientPutInServer(int client)
"INSERT INTO %susers (auth, name, ip, lastlogin) VALUES (%d, '%s', %d, %d) ON DUPLICATE KEY UPDATE name = '%s', ip = %d, lastlogin = %d;",
gS_MySQLPrefix, iSteamID, sEscapedName, iIPAddress, iTime, sEscapedName, iIPAddress, iTime);
}
else
{
FormatEx(sQuery, 512,
@ -2567,7 +2559,6 @@ public void SQL_InsertUser_Callback(Database db, DBResultSet results, const char
{
LogError("Timer error! Failed to insert a disconnected player's data to the table. Reason: %s", error);
}
else
{
LogError("Timer error! Failed to insert \"%N\"'s data to the table. Reason: %s", client, error);
@ -2648,7 +2639,6 @@ public void Shavit_OnEnterZone(int client, int type, int track, int id, int enti
UpdateAiraccelerate(client, gF_ZoneAiraccelerate[client]);
}
else if(type == Zone_CustomSpeedLimit)
{
gF_ZoneSpeedLimit[client] = float(Shavit_GetZoneData(id));

View File

@ -195,7 +195,7 @@ public void OnPluginStart()
..."HUD_USP 8192\n"
..."HUD_GLOCK 16384\n"
);
IntToString(HUD_DEFAULT2, defaultHUD, 8);
gCV_DefaultHUD2 = new Convar("shavit_hud2_default", defaultHUD, "Default HUD2 settings as a bitflag of what to remove\n"
..."HUD2_TIME 1\n"
@ -280,22 +280,18 @@ public void OnLibraryAdded(const char[] name)
{
gB_ReplayPlayback = true;
}
else if(StrEqual(name, "shavit-zones"))
{
gB_Zones = true;
}
else if(StrEqual(name, "shavit-sounds"))
{
gB_Sounds = true;
}
else if(StrEqual(name, "shavit-rankings"))
{
gB_Rankings = true;
}
else if(StrEqual(name, "DynamicChannels"))
{
gB_DynamicChannels = true;
@ -308,22 +304,18 @@ public void OnLibraryRemoved(const char[] name)
{
gB_ReplayPlayback = false;
}
else if(StrEqual(name, "shavit-zones"))
{
gB_Zones = false;
}
else if(StrEqual(name, "shavit-sounds"))
{
gB_Sounds = false;
}
else if(StrEqual(name, "shavit-rankings"))
{
gB_Rankings = false;
}
else if(StrEqual(name, "DynamicChannels"))
{
gB_DynamicChannels = false;
@ -453,7 +445,6 @@ public void OnClientCookiesCached(int client)
SetClientCookie(client, gH_HUDCookie, sHUDSettings);
gI_HUDSettings[client] = gCV_DefaultHUD.IntValue;
}
else
{
gI_HUDSettings[client] = StringToInt(sHUDSettings);
@ -468,7 +459,6 @@ public void OnClientCookiesCached(int client)
SetClientCookie(client, gH_HUDCookieMain, sHUDSettings);
gI_HUD2Settings[client] = gCV_DefaultHUD2.IntValue;
}
else
{
gI_HUD2Settings[client] = StringToInt(sHUDSettings);
@ -565,7 +555,6 @@ void ToggleHUD(int client, int hud, bool chat)
Shavit_PrintToChat(client, "%T", "HudEnabledComponent", client,
gS_ChatStrings.sVariable, sHUDSetting, gS_ChatStrings.sText, gS_ChatStrings.sVariable2, gS_ChatStrings.sText);
}
else
{
Shavit_PrintToChat(client, "%T", "HudDisabledComponent", client,
@ -736,7 +725,7 @@ Action ShowHUDMenu(int client, int item)
FormatEx(sInfo, 16, "@%d", HUD2_SYNC);
FormatEx(sHudItem, 64, "%T", "HudSync", client);
menu.AddItem(sInfo, sHudItem);
FormatEx(sInfo, 16, "@%d", HUD2_PERFS);
FormatEx(sHudItem, 64, "%T", "HudPerfs", client);
menu.AddItem(sInfo, sHudItem);
@ -839,7 +828,6 @@ public int MenuHandler_HUD(Menu menu, MenuAction action, int param1, int param2)
ShowHUDMenu(param1, GetMenuSelectionPosition());
}
else if(action == MenuAction_DisplayItem)
{
char sInfo[16];
@ -871,7 +859,6 @@ public int MenuHandler_HUD(Menu menu, MenuAction action, int param1, int param2)
return RedrawMenuItem(sDisplay);
}
else if(action == MenuAction_End)
{
delete menu;
@ -1080,7 +1067,7 @@ void Cron()
GetEntPropVector(GetSpectatorTarget(i, i), Prop_Data, "m_vecVelocity", fSpeed);
gI_PreviousSpeed[i] = RoundToNearest(((gI_HUDSettings[i] & HUD_2DVEL) == 0)? GetVectorLength(fSpeed):(SquareRoot(Pow(fSpeed[0], 2.0) + Pow(fSpeed[1], 2.0))));
}
TriggerHUDUpdate(i);
}
}
@ -1231,7 +1218,6 @@ int AddHUDToBuffer_Source2013(int client, huddata_t data, char[] buffer, int max
AddHUDLine(buffer, maxlen, sLine, iLines);
}
}
else
{
FormatEx(sLine, 128, "%T", (gEV_Type == Engine_TF2)? "NoReplayDataTF2":"NoReplayData", client);
@ -1253,7 +1239,6 @@ int AddHUDToBuffer_Source2013(int client, huddata_t data, char[] buffer, int max
{
FormatEx(sLine, 128, "%T ", "HudInStartZone", client, data.iSpeed);
}
else
{
FormatEx(sLine, 128, "%T ", "HudInEndZone", client, data.iSpeed);
@ -1282,7 +1267,7 @@ int AddHUDToBuffer_Source2013(int client, huddata_t data, char[] buffer, int max
FormatSeconds(data.fTime, sTime, 32, false);
char sTimeDiff[32];
if (gB_ReplayPlayback && Shavit_GetReplayFrameCount(Shavit_GetClosestReplayStyle(data.iTarget), data.iTrack) != 0 && (gI_HUD2Settings[client] & HUD2_TIMEDIFFERENCE) == 0)
{
float fClosestReplayTime = Shavit_GetClosestReplayTime(data.iTarget);
@ -1299,12 +1284,11 @@ int AddHUDToBuffer_Source2013(int client, huddata_t data, char[] buffer, int max
{
FormatEx(sLine, 128, "%T: %s%s (%d)", "HudTimeText", client, sTime, sTimeDiff, data.iRank);
}
else
{
FormatEx(sLine, 128, "%T: %s%s", "HudTimeText", client, sTime, sTimeDiff);
}
AddHUDLine(buffer, maxlen, sLine, iLines);
}
@ -1345,7 +1329,6 @@ int AddHUDToBuffer_Source2013(int client, huddata_t data, char[] buffer, int max
FormatEx(sLine, 128, "%T: %d", "HudSpeedText", client, data.iSpeed);
}
}
else
{
IntToString(data.iSpeed, sLine, 128);
@ -1361,7 +1344,6 @@ int AddHUDToBuffer_Source2013(int client, huddata_t data, char[] buffer, int max
{
FormatEx(sLine, 128, "%T", "HudNoSpeedLimit", data.iTarget);
}
else
{
FormatEx(sLine, 128, "%T", "HudCustomSpeedLimit", client, gI_ZoneSpeedLimit[data.iTarget]);
@ -1419,7 +1401,7 @@ int AddHUDToBuffer_CSGO(int client, huddata_t data, char[] buffer, int maxlen)
AddHUDLine(buffer, maxlen, sLine, iLines);
if((gI_HUD2Settings[client] & HUD2_TIME) == 0)
{
{
char sTime[32];
FormatSeconds(data.fTime, sTime, 32, false);
@ -1436,7 +1418,6 @@ int AddHUDToBuffer_CSGO(int client, huddata_t data, char[] buffer, int maxlen)
AddHUDLine(buffer, maxlen, sLine, iLines);
}
}
else
{
FormatEx(sLine, 128, "%T", "NoReplayData", client);
@ -1506,8 +1487,8 @@ int AddHUDToBuffer_CSGO(int client, huddata_t data, char[] buffer, int maxlen)
if((gI_HUD2Settings[client] & HUD2_TIME) == 0)
{
int iColor = 0xFF0000; // red, worse than both pb and wr
if (false && data.iTimerStatus == Timer_Paused)
if (false && data.iTimerStatus == Timer_Paused)
{
iColor = 0xA9C5E8; // blue sky
}
@ -1522,9 +1503,9 @@ int AddHUDToBuffer_CSGO(int client, huddata_t data, char[] buffer, int maxlen)
char sTime[32];
FormatSeconds(data.fTime, sTime, 32, false);
char sTimeDiff[32];
if (gB_ReplayPlayback && Shavit_GetReplayFrameCount(Shavit_GetClosestReplayStyle(data.iTarget), data.iTrack) != 0 && (gI_HUD2Settings[client] & HUD2_TIMEDIFFERENCE) == 0)
{
float fClosestReplayTime = Shavit_GetClosestReplayTime(data.iTarget);
@ -1541,12 +1522,11 @@ int AddHUDToBuffer_CSGO(int client, huddata_t data, char[] buffer, int maxlen)
{
FormatEx(sLine, 128, "<span color='#%06X'>%s%s</span> (#%d)", iColor, sTime, sTimeDiff, data.iRank);
}
else
{
FormatEx(sLine, 128, "<span color='#%06X'>%s%s</span>", iColor, sTime, sTimeDiff);
}
AddHUDLine(buffer, maxlen, sLine, iLines);
}
}
@ -1554,7 +1534,7 @@ int AddHUDToBuffer_CSGO(int client, huddata_t data, char[] buffer, int maxlen)
if((gI_HUD2Settings[client] & HUD2_SPEED) == 0)
{
int iColor = 0xA0FFFF;
if((data.iSpeed - gI_PreviousSpeed[client]) < 0)
{
iColor = 0xFFC966;
@ -2069,7 +2049,7 @@ void UpdateTopLeftHUD(int client, bool wait)
{
Format(sTopLeft, sizeof(sTopLeft), "%s\n%s (#%d) (%N)", sTopLeft, sTargetPB, Shavit_GetRankForTime(style, fTargetPB, track), target);
}
else
else
{
Format(sTopLeft, sizeof(sTopLeft), "%s\n%s (%N)", sTopLeft, sTargetPB, target);
}
@ -2081,7 +2061,7 @@ void UpdateTopLeftHUD(int client, bool wait)
{
Format(sTopLeft, sizeof(sTopLeft), "%s\n%s (#%d) (%N)", sTopLeft, sSelfPB, Shavit_GetRankForTime(style, fSelfPB, track), client);
}
else
else
{
Format(sTopLeft, sizeof(sTopLeft), "%s\n%s (%N)", sTopLeft, sSelfPB, client);
}
@ -2099,7 +2079,7 @@ void UpdateTopLeftHUD(int client, bool wait)
Call_PushStringEx(sTopLeft, sizeof(sTopLeft), SM_PARAM_STRING_COPY, SM_PARAM_COPYBACK);
Call_PushCell(sizeof(sTopLeft));
Call_Finish(postresult);
if (postresult != Plugin_Continue && postresult != Plugin_Changed)
{
return;
@ -2161,7 +2141,7 @@ void UpdateKeyHint(int client)
}
if (!Shavit_GetStyleSettingBool(style, "autobhop") && (gI_HUD2Settings[client] & HUD2_PERFS) == 0)
{
{
Format(sMessage, 256, "%s%s\n%T: %.1f", sMessage, perf_double_newline ? "\n":"", "HudPerfs", client, Shavit_GetPerfectJumps(target));
}
}
@ -2192,7 +2172,7 @@ void UpdateKeyHint(int client)
{
Format(sMessage, 256, "%s%s%spectators (%d):", sMessage, (strlen(sMessage) > 0)? "\n\n":"", (client == target)? "S":"Other S", iSpectators);
char sName[MAX_NAME_LENGTH];
for(int i = 0; i < iSpectators; i++)
{
if(i == 7)
@ -2313,6 +2293,6 @@ void PrintCSGOHUDText(int client, const char[] str)
pb.AddString("params", NULL_STRING);
pb.AddString("params", NULL_STRING);
pb.AddString("params", NULL_STRING);
EndMessage();
}

View File

@ -957,7 +957,7 @@ public int Handler_MapVoteMenu(Menu menu, MenuAction action, int param1, int par
{
char map[PLATFORM_MAX_PATH], buffer[255];
menu.GetItem(param2, map, sizeof(map));
if (strcmp(map, "extend", false) == 0)
{
FormatEx(buffer, sizeof(buffer), "%T", "Extend Map", param1);
@ -999,7 +999,7 @@ public int Handler_MapVoteMenu(Menu menu, MenuAction action, int param1, int par
menu.GetItem(item, map, sizeof(map), _, displayName, sizeof(displayName));
}
while(strcmp(map, "extend", false) == 0 || strcmp(map, "dontchange", false) == 0);
DoMapChangeAfterMapVote(map, displayName, 0, 0);
}
}
@ -2144,7 +2144,7 @@ public Action BaseCommands_Command_Map(int client, int args)
if (!foundMap)
{
// do a smaller
// do a smaller
StringMapSnapshot snapshot = maps.Snapshot();
int length = snapshot.Length;

View File

@ -423,7 +423,6 @@ public void OnClientCookiesCached(int client)
SetClientCookie(client, gH_HideCookie, "0");
gB_Hide[client] = false;
}
else
{
gB_Hide[client] = view_as<bool>(StringToInt(sSetting));
@ -461,7 +460,7 @@ void LoadMapFixes()
BuildPath(Path_SM, sPath, PLATFORM_MAX_PATH, "configs/shavit-mapfixes.cfg");
KeyValues kv = new KeyValues("shavit-mapfixes");
if (kv.ImportFromFile(sPath) && kv.JumpToKey(gS_Map) && kv.GotoFirstSubKey(false))
{
do {
@ -616,7 +615,7 @@ bool LoadAdvertisementsConfig()
BuildPath(Path_SM, sPath, PLATFORM_MAX_PATH, "configs/shavit-advertisements.cfg");
KeyValues kv = new KeyValues("shavit-advertisements");
if(!kv.ImportFromFile(sPath) || !kv.GotoFirstSubKey(false))
{
delete kv;
@ -710,7 +709,6 @@ int GetHumanTeam()
{
return 2;
}
else if(StrEqual(sTeam, "ct", false) || StrContains(sTeam, "blu", false) != -1)
{
return 3;
@ -1139,7 +1137,7 @@ void UpdateClanTag(int client)
Call_PushStringEx(sCustomTag, 32, SM_PARAM_STRING_COPY, SM_PARAM_COPYBACK);
Call_PushCell(32);
Call_Finish(result);
if(result != Plugin_Continue && result != Plugin_Changed)
{
return;
@ -1274,7 +1272,7 @@ public Action Shavit_OnUserCmdPre(int client, int &buttons, int &impulse, float
{
float zSpeed = fSpeed[2];
fSpeed[2] = 0.0;
ScaleVector(fSpeed, fScale);
fSpeed[2] = zSpeed;
}
@ -1460,7 +1458,7 @@ public void TF2_OnPreThink(int client)
if(IsPlayerAlive(client))
{
float maxspeed;
if (GetEntityFlags(client) & FL_ONGROUND)
{
maxspeed = Shavit_GetStyleSettingFloat(gI_Style[client], "runspeed");
@ -1645,7 +1643,6 @@ public Action Command_Teleport(int client, int args)
Teleport(client, GetClientSerial(iTarget));
}
else
{
Menu menu = new Menu(MenuHandler_Teleport);
@ -1686,7 +1683,6 @@ public int MenuHandler_Teleport(Menu menu, MenuAction action, int param1, int pa
Command_Teleport(param1, 0);
}
}
else if(action == MenuAction_End)
{
delete menu;
@ -1859,7 +1855,6 @@ public int MenuHandler_StopWarning(Menu menu, MenuAction action, int param1, int
Call_Finish();
}
}
else if(action == MenuAction_End)
{
delete menu;
@ -1961,13 +1956,11 @@ public Action CommandListener_Noclip(int client, const char[] command, int args)
Shavit_StopTimer(client);
SetEntityMoveType(client, MOVETYPE_NOCLIP);
}
else
{
OpenStopWarningMenu(client, DoNoclip);
}
}
else if(GetEntityMoveType(client) == MOVETYPE_NOCLIP)
{
SetEntityMoveType(client, MOVETYPE_WALK);
@ -2064,7 +2057,6 @@ public Action Command_Specs(int client, int args)
{
FormatEx(sSpecs, 192, "%s%N", gS_ChatStrings.sVariable2, i);
}
else
{
Format(sSpecs, 192, "%s%s, %s%N", sSpecs, gS_ChatStrings.sText, gS_ChatStrings.sVariable2, i);
@ -2076,7 +2068,6 @@ public Action Command_Specs(int client, int args)
{
Shavit_PrintToChat(client, "%T", "SpectatorCount", client, gS_ChatStrings.sVariable2, iObserverTarget, gS_ChatStrings.sText, gS_ChatStrings.sVariable, iCount, gS_ChatStrings.sText, sSpecs);
}
else
{
Shavit_PrintToChat(client, "%T", "SpectatorCountZero", client, gS_ChatStrings.sVariable2, iObserverTarget, gS_ChatStrings.sText);
@ -2171,7 +2162,6 @@ public void Shavit_OnWorldRecord(int client, int style, float time, int jumps, i
{
Shavit_PrintToChatAll("%t", "WRNotice", gS_ChatStrings.sWarning, sUpperCase);
}
else
{
Shavit_PrintToChatAll("%s[%s]%s %t", gS_ChatStrings.sVariable, sTrack, gS_ChatStrings.sText, "WRNotice", gS_ChatStrings.sWarning, sUpperCase);
@ -2256,7 +2246,6 @@ public Action Respawn(Handle timer, any data)
{
TF2_RespawnPlayer(client);
}
else
{
CS_RespawnPlayer(client);
@ -2432,7 +2421,6 @@ public Action Shotgun_Shot(const char[] te_name, const int[] Players, int numCli
TE_WriteFloat("m_fInaccuracy", TE_ReadFloat("m_fInaccuracy"));
TE_WriteFloat("m_fSpread", TE_ReadFloat("m_fSpread"));
}
else if(gEV_Type == Engine_CSGO)
{
TE_WriteNum("m_weapon", TE_ReadNum("m_weapon"));
@ -2442,14 +2430,13 @@ public Action Shotgun_Shot(const char[] te_name, const int[] Players, int numCli
TE_WriteNum("m_nItemDefIndex", TE_ReadNum("m_nItemDefIndex"));
TE_WriteNum("m_iSoundType", TE_ReadNum("m_iSoundType"));
}
else if(gEV_Type == Engine_TF2)
{
TE_WriteNum("m_iWeaponID", TE_ReadNum("m_iWeaponID"));
TE_WriteFloat("m_flSpread", TE_ReadFloat("m_flSpread"));
TE_WriteNum("m_bCritical", TE_ReadNum("m_bCritical"));
}
TE_Send(clients, count, delay);
return Plugin_Stop;
@ -2550,7 +2537,7 @@ public Action NormalSound(int clients[MAXPLAYERS], int &numClients, char sample[
{
clients[j] = clients[j+1];
}
numClients--;
i--;
}
@ -2559,7 +2546,7 @@ public Action NormalSound(int clients[MAXPLAYERS], int &numClients, char sample[
return Plugin_Changed;
}
return Plugin_Continue;
}

View File

@ -671,7 +671,7 @@ public Action Command_SetTier(int client, int args)
{
char sArg[8];
GetCmdArg(1, sArg, 8);
int tier = StringToInt(sArg);
if(args == 0 || tier < 1 || tier > 10)
@ -1069,7 +1069,7 @@ void UpdateAllPoints(bool recalcall = false)
sLastLogin, (sLastLogin[0] != 0) ? "AND" : "",
gS_MySQLPrefix);
}
gH_SQL.Query2(SQL_UpdateAllPoints_Callback, sQuery);
}
@ -1583,7 +1583,7 @@ public void SQL_DeleteMap_Callback(Database db, DBResultSet results, const char[
if(view_as<bool>(data))
{
gI_Tier = gCV_DefaultTier.IntValue;
UpdateAllPoints(true);
UpdateRankedPlayers();
}

View File

@ -339,7 +339,7 @@ public void OnPluginStart()
gH_OnReplayStart = CreateGlobalForward("Shavit_OnReplayStart", ET_Event, Param_Cell, Param_Cell, Param_Cell);
gH_OnReplayEnd = CreateGlobalForward("Shavit_OnReplayEnd", ET_Event, Param_Cell, Param_Cell, Param_Cell);
gH_OnReplaysLoaded = CreateGlobalForward("Shavit_OnReplaysLoaded", ET_Event);
// game specific
gEV_Type = GetEngineVersion();
gF_Tickrate = (1.0 / GetTickInterval());
@ -456,7 +456,7 @@ public void OnPluginStart()
Shavit_OnStyleConfigLoaded(Shavit_GetStyleCount());
Shavit_OnChatConfigLoaded();
}
for(int i = 1; i <= MaxClients; i++)
{
ClearBotInfo(gA_BotInfo[i]);
@ -707,7 +707,7 @@ public void OnAdminMenuReady(Handle topmenu)
OnAdminMenuCreated(topmenu);
}
}
gH_AdminMenu.AddItem("sm_deletereplay", AdminMenu_DeleteReplay, gH_TimerCommands, "sm_deletereplay", ADMFLAG_RCON);
}
}
@ -718,7 +718,6 @@ public void AdminMenu_DeleteReplay(Handle topmenu, TopMenuAction action, TopMenu
{
FormatEx(buffer, maxlength, "%t", "DeleteReplayAdminMenu");
}
else if(action == TopMenuAction_SelectOption)
{
Command_DeleteReplay(param, 0);
@ -1436,7 +1435,7 @@ bool LoadStyling()
BuildPath(Path_SM, sPath, PLATFORM_MAX_PATH, "configs/shavit-replay.cfg");
KeyValues kv = new KeyValues("shavit-replay");
if(!kv.ImportFromFile(sPath))
{
delete kv;
@ -1457,7 +1456,7 @@ bool LoadStyling()
ReplaceString(sFolder, PLATFORM_MAX_PATH, "{SM}/", "");
BuildPath(Path_SM, sFolder, PLATFORM_MAX_PATH, "%s", sFolder);
}
strcopy(gS_ReplayFolder, PLATFORM_MAX_PATH, sFolder);
if (kv.JumpToKey("Looping Bots"))
@ -1664,7 +1663,7 @@ int InternalCreateReplayBot()
{
// Do all this mp_randomspawn stuff on CSGO since it's easier than updating the signature for CCSGameRules::TeamFull.
int mp_randomspawn_orig;
if (mp_randomspawn != null)
{
mp_randomspawn_orig = mp_randomspawn.IntValue;
@ -1862,7 +1861,7 @@ bool DeleteReplay(int style, int track, int accountid, const char[] mapname)
return false;
}
}
if(!DeleteFile(sPath))
{
return false;
@ -2154,7 +2153,6 @@ void UpdateReplayClient(int client)
{
ChangeClientTeam(client, gCV_DefaultTeam.IntValue);
}
else
{
CS_SwitchTeam(client, gCV_DefaultTeam.IntValue);
@ -2172,7 +2170,7 @@ void UpdateReplayClient(int client)
CS_RespawnPlayer(client);
}
}
int iFlags = GetEntityFlags(client);
if((iFlags & FL_ATCONTROLS) == 0)
@ -2411,7 +2409,7 @@ Action ReplayOnPlayerRunCmd(bot_info_t info, int &buttons, int &impulse, float v
{
int jumpAnim = (gEV_Type == Engine_CSS) ?
CSS_ANIM_JUMP : ((gEV_Type == Engine_TF2) ? TF2_ANIM_JUMP : CSGO_ANIM_JUMP);
if(gB_Linux)
{
SDKCall(gH_DoAnimationEvent, EntIndexToEntRef(info.iEnt), jumpAnim, 0);
@ -2435,7 +2433,7 @@ Action ReplayOnPlayerRunCmd(bot_info_t info, int &buttons, int &impulse, float v
if (isClient)
{
gI_LastReplayFlags[info.iEnt] = aFrame.flags;
gI_LastReplayFlags[info.iEnt] = aFrame.flags;
SetEntityMoveType(info.iEnt, mt);
}
@ -2567,7 +2565,7 @@ public Action BotEvents(Event event, const char[] name, bool dontBroadcast)
int client = GetClientOfUserId(event.GetInt("userid"));
if (event.GetBool("bot") || (client && IsFakeClient(client)))
if (event.GetBool("bot") || (client && IsFakeClient(client)))
{
event.BroadcastDisabled = true;
@ -2704,7 +2702,6 @@ public Action Command_DeleteReplay(int client, int args)
FormatEx(sDisplay, 64, "%s (%s) - %s", gS_StyleStrings[iStyle].sStyleName, sTrack, sTime);
}
else
{
FormatEx(sDisplay, 64, "%s (%s)", gS_StyleStrings[iStyle].sStyleName, sTrack);
@ -2736,7 +2733,7 @@ public int DeleteReplay_Callback(Menu menu, MenuAction action, int param1, int p
char sExploded[2][4];
ExplodeString(sInfo, ";", sExploded, 2, 4);
int style = StringToInt(sExploded[0]);
if(style == -1)
@ -2769,7 +2766,6 @@ public int DeleteReplay_Callback(Menu menu, MenuAction action, int param1, int p
submenu.ExitButton = true;
submenu.Display(param1, MENU_TIME_FOREVER);
}
else if(action == MenuAction_End)
{
delete menu;
@ -2795,7 +2791,6 @@ public int DeleteConfirmation_Callback(Menu menu, MenuAction action, int param1,
Shavit_PrintToChat(param1, "%T (%s%s%s)", "ReplayDeleted", param1, gS_ChatStrings.sStyle, gS_StyleStrings[style].sStyleName, gS_ChatStrings.sText, gS_ChatStrings.sVariable, sTrack, gS_ChatStrings.sText);
}
else
{
Shavit_PrintToChat(param1, "%T", "ReplayDeleteFailure", param1, gS_ChatStrings.sStyle, gS_StyleStrings[style].sStyleName, gS_ChatStrings.sText);
@ -2803,7 +2798,6 @@ public int DeleteConfirmation_Callback(Menu menu, MenuAction action, int param1,
Command_DeleteReplay(param1, 0);
}
else if(action == MenuAction_End)
{
delete menu;
@ -3453,7 +3447,7 @@ float GetReplayLength(int style, int track, frame_cache_t aCache)
{
return 0.0;
}
if(aCache.bNewFormat)
{
return aCache.fTime;
@ -3591,7 +3585,7 @@ float GetClosestReplayTime(int client)
int iPlayerFrames = Shavit_GetClientFrameCount(client) - Shavit_GetPlayerPreFrames(client);
int iStartFrame = iPlayerFrames - iSearch;
iEndFrame = iPlayerFrames + iSearch;
if(iSearch == 0)
{
iStartFrame = 0;
@ -3604,7 +3598,7 @@ float GetClosestReplayTime(int client)
{
iStartFrame = 0;
}
// check if the search ahead flag is off
if(gCV_DynamicTimeCheap.IntValue & 1 == 0)
{

View File

@ -183,7 +183,7 @@ bool LoadReplayConfig()
BuildPath(Path_SM, sPath, PLATFORM_MAX_PATH, "configs/shavit-replay.cfg");
KeyValues kv = new KeyValues("shavit-replay");
if(!kv.ImportFromFile(sPath))
{
delete kv;
@ -199,7 +199,7 @@ bool LoadReplayConfig()
ReplaceString(sFolder, PLATFORM_MAX_PATH, "{SM}/", "");
BuildPath(Path_SM, sFolder, PLATFORM_MAX_PATH, "%s", sFolder);
}
strcopy(gS_ReplayFolder, PLATFORM_MAX_PATH, sFolder);
delete kv;

View File

@ -121,7 +121,6 @@ public void OnMapStart()
{
SetFailState("Cannot open \"configs/shavit-sounds.cfg\". Make sure this file exists and that the server has read permissions to it.");
}
else
{
char sLine[PLATFORM_MAX_PATH*2];
@ -145,27 +144,22 @@ public void OnMapStart()
{
gA_FirstSounds.PushString(sExploded[1]);
}
else if(StrEqual(sExploded[0], "personal"))
{
gA_PersonalSounds.PushString(sExploded[1]);
}
else if(StrEqual(sExploded[0], "world"))
{
gA_WorldSounds.PushString(sExploded[1]);
}
else if(StrEqual(sExploded[0], "worst"))
{
gA_WorstSounds.PushString(sExploded[1]);
}
else if(StrEqual(sExploded[0], "worse") || StrEqual(sExploded[0], "noimprovement"))
{
gA_NoImprovementSounds.PushString(sExploded[1]);
}
else
{
gSM_RankSounds.SetString(sExploded[0], sExploded[1]);
@ -176,7 +170,6 @@ public void OnMapStart()
FormatEx(sDownloadString, PLATFORM_MAX_PATH, "sound/%s", sExploded[1]);
AddFileToDownloadsTable(sDownloadString);
}
else
{
LogError("\"sound/%s\" could not be accessed.", sExploded[1]);
@ -222,19 +215,16 @@ public void Shavit_OnFinish_Post(int client, int style, float time, int jumps, i
{
bEveryone = true;
}
else if(gA_WorldSounds.Length != 0 && rank == 1)
{
bEveryone = true;
gA_WorldSounds.GetString(GetRandomInt(0, gA_WorldSounds.Length - 1), sSound, PLATFORM_MAX_PATH);
}
else if(gA_PersonalSounds.Length != 0 && time < fOldTime)
{
gA_PersonalSounds.GetString(GetRandomInt(0, gA_PersonalSounds.Length - 1), sSound, PLATFORM_MAX_PATH);
}
else if(gA_FirstSounds.Length != 0 && overwrite == 1)
{
gA_FirstSounds.GetString(GetRandomInt(0, gA_FirstSounds.Length - 1), sSound, PLATFORM_MAX_PATH);

View File

@ -634,7 +634,6 @@ public Action Command_MapsDoneLeft(int client, int args)
gI_MapType[client] = MAPSDONE;
menu.SetTitle("%T\n ", "MapsDoneOnStyle", client, gS_TargetName[client]);
}
else
{
gI_MapType[client] = MAPSLEFT;
@ -685,7 +684,6 @@ public int MenuHandler_MapsDoneLeft(Menu menu, MenuAction action, int param1, in
submenu.Display(param1, MENU_TIME_FOREVER);
}
else if(action == MenuAction_End)
{
delete menu;
@ -704,7 +702,6 @@ public int MenuHandler_MapsDoneLeft_Track(Menu menu, MenuAction action, int para
ShowMaps(param1);
}
else if(action == MenuAction_End)
{
delete menu;
@ -775,7 +772,7 @@ Action OpenStatsMenu(int client, int steamid, int style = 0, int item = 0)
gH_SQL.Query2(OpenStatsMenu_Mapchooser_Callback, sQuery, data, DBPrio_Low);
return Plugin_Handled;
return Plugin_Handled;
}
return OpenStatsMenu_Main(steamid, style, data);
@ -1104,7 +1101,6 @@ public int MenuHandler_ProfileHandler(Menu menu, MenuAction action, int param1,
OpenStatsMenu(param1, gI_TargetSteamID[param1], iSelectedStyle, gI_MenuPos[param1]);
}
}
else if(action == MenuAction_End)
{
delete menu;
@ -1128,12 +1124,10 @@ public int MenuHandler_TypeHandler(Menu menu, MenuAction action, int param1, int
ShowMaps(param1);
}
else if(action == MenuAction_Cancel && param2 == MenuCancel_ExitBack)
{
OpenStatsMenu(param1, gI_TargetSteamID[param1], gI_Style[param1], gI_MenuPos[param1]);
}
else if(action == MenuAction_End)
{
delete menu;
@ -1157,7 +1151,6 @@ void ShowMaps(int client)
"SELECT a.map, a.time, a.jumps, a.id, COUNT(b.map) + 1 as 'rank', a.points FROM %splayertimes a LEFT JOIN %splayertimes b ON a.time > b.time AND a.map = b.map AND a.style = b.style AND a.track = b.track WHERE a.auth = %d AND a.style = %d AND a.track = %d GROUP BY a.map, a.time, a.jumps, a.id, a.points ORDER BY a.%s;",
gS_MySQLPrefix, gS_MySQLPrefix, gI_TargetSteamID[client], gI_Style[client], gI_Track[client], (gB_Rankings)? "points DESC":"map");
}
else
{
if(gB_Rankings)
@ -1166,7 +1159,6 @@ void ShowMaps(int client)
"SELECT DISTINCT m.map, t.tier FROM %smapzones m LEFT JOIN %smaptiers t ON m.map = t.map WHERE m.type = 0 AND m.track = %d AND m.map NOT IN (SELECT DISTINCT map FROM %splayertimes WHERE auth = %d AND style = %d AND track = %d) ORDER BY m.map;",
gS_MySQLPrefix, gS_MySQLPrefix, gI_Track[client], gS_MySQLPrefix, gI_TargetSteamID[client], gI_Style[client], gI_Track[client]);
}
else
{
FormatEx(sQuery, 512,
@ -1176,7 +1168,7 @@ void ShowMaps(int client)
}
gB_CanOpenMenu[client] = false;
gH_SQL.Query2(ShowMapsCallback, sQuery, GetClientSerial(client), DBPrio_High);
}
@ -1302,25 +1294,22 @@ public int MenuHandler_ShowMaps(Menu menu, MenuAction action, int param1, int pa
return 0;
}
else if(StringToInt(sInfo) == 0)
{
FakeClientCommand(param1, "sm_nominate %s", sInfo);
return 0;
}
char sQuery[512];
FormatEx(sQuery, 512, "SELECT u.name, p.time, p.jumps, p.style, u.auth, p.date, p.map, p.strafes, p.sync, p.points FROM %splayertimes p JOIN %susers u ON p.auth = u.auth WHERE p.id = '%s' LIMIT 1;", gS_MySQLPrefix, gS_MySQLPrefix, sInfo);
gH_SQL.Query2(SQL_SubMenu_Callback, sQuery, GetClientSerial(param1));
}
else if(action == MenuAction_Cancel && param2 == MenuCancel_ExitBack)
{
OpenStatsMenu(param1, gI_TargetSteamID[param1], gI_Style[param1], gI_MenuPos[param1]);
}
else if(action == MenuAction_End)
{
delete menu;
@ -1425,7 +1414,6 @@ public int SubMenu_Handler(Menu menu, MenuAction action, int param1, int param2)
{
ShowMaps(param1);
}
else if(action == MenuAction_End)
{
delete menu;

View File

@ -96,7 +96,7 @@ public void OnPluginStart()
mp_ignore_round_win_conditions = FindConVar("mp_ignore_round_win_conditions");
mp_timelimit = FindConVar("mp_timelimit");
mp_roundtime = FindConVar("mp_roundtime");
if(mp_roundtime != null)
{
mp_roundtime.SetBounds(ConVarBound_Upper, false);
@ -142,7 +142,6 @@ public void OnConVarChanged(ConVar convar, const char[] oldValue, const char[] n
delete gH_Timer;
gH_Timer = CreateTimer(1.0, Timer_PrintToChat, 0, TIMER_REPEAT|TIMER_FLAG_NO_MAPCHANGE);
}
else
{
delete gH_Timer;
@ -195,7 +194,6 @@ public void OnConfigsExecuted()
{
StartCalculating();
}
else
{
SetLimit(RoundToNearest(gCV_DefaultLimit.FloatValue));
@ -270,7 +268,6 @@ public void SQL_GetMapTimes(Database db, DBResultSet results, const char[] error
{
fAverage = gCV_MinimumLimit.FloatValue;
}
else if(fAverage > gCV_MaximumLimit.FloatValue)
{
fAverage = gCV_MaximumLimit.FloatValue;
@ -278,7 +275,6 @@ public void SQL_GetMapTimes(Database db, DBResultSet results, const char[] error
SetLimit(RoundToCeil(fAverage / 10) * 10);
}
else
{
SetLimit(RoundToNearest(gCV_DefaultLimit.FloatValue));
@ -414,7 +410,7 @@ public Action CS_OnTerminateRound(float &fDelay, CSRoundEndReason &iReason)
{
return Plugin_Handled;
}
return Plugin_Continue;
}

View File

@ -238,7 +238,6 @@ public void CategoryHandler(Handle topmenu, TopMenuAction action, TopMenuObject
{
FormatEx(buffer, maxlength, "%T:", "TimerCommands", param);
}
else if(action == TopMenuAction_DisplayOption)
{
FormatEx(buffer, maxlength, "%T", "TimerCommands", param);
@ -270,7 +269,6 @@ public void AdminMenu_Delete(Handle topmenu, TopMenuAction action, TopMenuObject
{
FormatEx(buffer, maxlength, "%t", "DeleteSingleRecord");
}
else if(action == TopMenuAction_SelectOption)
{
Command_Delete(param, 0);
@ -283,7 +281,6 @@ public void AdminMenu_DeleteAll(Handle topmenu, TopMenuAction action, TopMenuOb
{
FormatEx(buffer, maxlength, "%t", "DeleteAllRecords");
}
else if(action == TopMenuAction_SelectOption)
{
Command_DeleteAll(param, 0);
@ -296,12 +293,10 @@ public void OnLibraryAdded(const char[] name)
{
gB_Rankings = true;
}
else if(StrEqual(name, "shavit-stats"))
{
gB_Stats = true;
}
else if (StrEqual(name, "adminmenu"))
{
if ((gH_AdminMenu = GetAdminTopMenu()) != null)
@ -317,12 +312,10 @@ public void OnLibraryRemoved(const char[] name)
{
gB_Rankings = false;
}
else if(StrEqual(name, "shavit-stats"))
{
gB_Stats = false;
}
else if (StrEqual(name, "adminmenu"))
{
gH_AdminMenu = null;
@ -1003,7 +996,6 @@ public int MenuHandler_Delete_First(Menu menu, MenuAction action, int param1, in
DeleteSubmenu(param1);
}
else if(action == MenuAction_End)
{
delete menu;
@ -1120,7 +1112,6 @@ public int MenuHandler_DeleteAll_First(Menu menu, MenuAction action, int param1,
subMenu.ExitButton = true;
subMenu.Display(param1, 300);
}
else if(action == MenuAction_End)
{
delete menu;
@ -1139,7 +1130,6 @@ public int MenuHandler_DeleteAll_Second(Menu menu, MenuAction action, int param1
DeleteAllSubmenu(param1);
}
else if(action == MenuAction_End)
{
delete menu;
@ -1208,7 +1198,6 @@ public int MenuHandler_DeleteAll(Menu menu, MenuAction action, int param1, int p
gH_SQL.Query2(DeleteAll_Callback, sQuery, hPack, DBPrio_High);
}
else if(action == MenuAction_End)
{
delete menu;
@ -1227,7 +1216,6 @@ public int MenuHandler_Delete(Menu menu, MenuAction action, int param1, int para
OpenDelete(param1);
}
else if(action == MenuAction_End)
{
delete menu;
@ -1320,7 +1308,6 @@ public int OpenDelete_Handler(Menu menu, MenuAction action, int param1, int para
OpenDeleteMenu(param1, id);
}
}
else if(action == MenuAction_End)
{
delete menu;
@ -1384,7 +1371,6 @@ public int DeleteConfirm_Handler(Menu menu, MenuAction action, int param1, int p
gH_SQL.Query2(GetRecordDetails_Callback, sQuery, GetSteamAccountID(param1), DBPrio_High);
}
else if(action == MenuAction_End)
{
delete menu;
@ -1830,7 +1816,6 @@ public int MenuHandler_StyleChooser(Menu menu, MenuAction action, int param1, in
StartWRMenu(param1);
}
else if(action == MenuAction_End)
{
delete menu;
@ -1934,7 +1919,6 @@ public void SQL_WR_Callback(Database db, DBResultSet results, const char[] error
hMenu.AddItem("-1", sNoRecords);
}
else
{
int iStyle = gA_WRCache[client].iLastStyle;
@ -1947,7 +1931,6 @@ public void SQL_WR_Callback(Database db, DBResultSet results, const char[] error
{
FormatEx(sRanks, 32, "(%d %T)", iRecords, "WRRecord", client);
}
else
{
FormatEx(sRanks, 32, "(#%d/%d)", iMyRank, iRecords);
@ -1976,18 +1959,15 @@ public int WRMenu_Handler(Menu menu, MenuAction action, int param1, int param2)
{
OpenSubMenu(param1, id);
}
else
{
ShowWRStyleMenu(param1);
}
}
else if(action == MenuAction_Cancel && param2 == MenuCancel_ExitBack)
{
ShowWRStyleMenu(param1, gA_WRCache[param1].iPagePosition);
}
else if(action == MenuAction_End)
{
delete menu;
@ -2095,18 +2075,15 @@ public int RRMenu_Handler(Menu menu, MenuAction action, int param1, int param2)
OpenSubMenu(param1, StringToInt(sExploded[0]));
}
else
{
RetrieveWRMenu(param1, gA_WRCache[param1].iLastTrack);
}
}
else if(action == MenuAction_Cancel && param2 == MenuCancel_ExitBack)
{
RetrieveWRMenu(param1, gA_WRCache[param1].iLastTrack);
}
else if(action == MenuAction_End)
{
delete menu;
@ -2176,7 +2153,6 @@ public void SQL_SubMenu_Callback(Database db, DBResultSet results, const char[]
{
FormatEx(sDisplay, 128, "%T: %d", "WRJumps", client, iJumps);
}
else
{
FormatEx(sDisplay, 128, "%T: %d (%.2f%%)", "WRJumps", client, iJumps, fPerfs);
@ -2242,7 +2218,6 @@ public void SQL_SubMenu_Callback(Database db, DBResultSet results, const char[]
GetTrackName(client, results.FetchInt(11), sTrack, 32);
}
else
{
char sMenuItem[64];
@ -2254,7 +2229,6 @@ public void SQL_SubMenu_Callback(Database db, DBResultSet results, const char[]
{
FormatEx(sFormattedTitle, 256, "%s [U:1:%d]\n--- %s: [%s]", sName, iSteamID, sMap, sTrack);
}
else
{
FormatEx(sFormattedTitle, 256, "%T", "Error", client);
@ -2291,18 +2265,15 @@ public int SubMenu_Handler(Menu menu, MenuAction action, int param1, int param2)
}
}
}
else
{
StartWRMenu(param1);
}
}
else if(action == MenuAction_Cancel && param2 == MenuCancel_ExitBack)
{
StartWRMenu(param1);
}
else if(action == MenuAction_End)
{
delete menu;
@ -2352,12 +2323,10 @@ public void Shavit_OnFinish(int client, int style, float time, int jumps, int st
iOverwrite = 0; // ugly way of not writing to database
bIncrementCompletions = false;
}
else if(gF_PlayerRecord[client][style][track] == 0.0)
{
iOverwrite = 1;
}
else if(time < gF_PlayerRecord[client][style][track])
{
iOverwrite = 2;

View File

@ -243,7 +243,7 @@ public void OnPluginStart()
RegAdminCmd("sm_modifyzone", Command_ZoneEdit, ADMFLAG_RCON, "Modify an existing zone. Alias of sm_zoneedit.");
RegAdminCmd("sm_tptozone", Command_TpToZone, ADMFLAG_RCON, "Teleport to a zone");
RegAdminCmd("sm_reloadzonesettings", Command_ReloadZoneSettings, ADMFLAG_ROOT, "Reloads the zone settings.");
RegConsoleCmd("sm_stages", Command_Stages, "Opens the stage menu. Usage: sm_stages [stage #]");
@ -278,7 +278,6 @@ public void OnPluginStart()
{
HookEvent("teamplay_round_start", Round_Start);
}
else
{
HookEvent("round_start", Round_Start);
@ -395,7 +394,7 @@ public void OnLibraryRemoved(const char[] name)
{
gB_ReplayRecorder = false;
}
}
}
public void OnConVarChanged(ConVar convar, const char[] oldValue, const char[] newValue)
{
@ -453,7 +452,6 @@ public void CategoryHandler(Handle topmenu, TopMenuAction action, TopMenuObject
{
FormatEx(buffer, maxlength, "%T:", "TimerCommands", param);
}
else if(action == TopMenuAction_DisplayOption)
{
FormatEx(buffer, maxlength, "%T", "TimerCommands", param);
@ -488,7 +486,6 @@ public void AdminMenu_Zones(Handle topmenu, TopMenuAction action, TopMenuObject
{
FormatEx(buffer, maxlength, "%T", "AddMapZone", param);
}
else if(action == TopMenuAction_SelectOption)
{
Command_Zones(param, 0);
@ -501,7 +498,6 @@ public void AdminMenu_DeleteZone(Handle topmenu, TopMenuAction action, TopMenuOb
{
FormatEx(buffer, maxlength, "%T", "DeleteMapZone", param);
}
else if(action == TopMenuAction_SelectOption)
{
Command_DeleteZone(param, 0);
@ -514,7 +510,6 @@ public void AdminMenu_DeleteAllZones(Handle topmenu, TopMenuAction action, TopM
{
FormatEx(buffer, maxlength, "%T", "DeleteAllMapZone", param);
}
else if(action == TopMenuAction_SelectOption)
{
Command_DeleteAllZones(param, 0);
@ -527,7 +522,6 @@ public void AdminMenu_ZoneEdit(Handle topmenu, TopMenuAction action, TopMenuObje
{
FormatEx(buffer, maxlength, "%T", "ZoneEdit", param);
}
else if(action == TopMenuAction_SelectOption)
{
Reset(param);
@ -633,7 +627,6 @@ bool InsideZone(int client, int type, int track)
{
return gB_InsideZone[client][type][track];
}
else
{
for(int i = 0; i < TRACKS_SIZE; i++)
@ -728,7 +721,7 @@ bool LoadZonesConfig()
BuildPath(Path_SM, sPath, PLATFORM_MAX_PATH, "configs/shavit-zones.cfg");
KeyValues kv = new KeyValues("shavit-zones");
if(!kv.ImportFromFile(sPath))
{
delete kv;
@ -854,7 +847,7 @@ public void OnMapStart()
{
GetLowercaseMapName(gS_Map);
LoadZoneSettings();
if (gEV_Type == Engine_TF2)
{
PrecacheModel("models/error.mdl");
@ -1204,7 +1197,7 @@ void ClearZone(int index)
void KillZoneEntity(int index, bool kill=true)
{
int entity = gA_ZoneCache[index].iEntityID;
if(entity > MaxClients)
{
gA_ZoneCache[index].iEntityID = -1;
@ -1543,7 +1536,7 @@ public Action Command_SetStart(int client, int args)
if(!InsideZone(client, Zone_Start, track))
{
Shavit_PrintToChat(client, "%T", "SetStartNotInStartZone", client, gS_ChatStrings.sWarning, gS_ChatStrings.sText, gS_ChatStrings.sVariable2, gS_ChatStrings.sText);
return Plugin_Handled;
}
#endif
@ -1551,7 +1544,7 @@ public Action Command_SetStart(int client, int args)
Shavit_PrintToChat(client, "%T", "SetStart", client, gS_ChatStrings.sVariable2, gS_ChatStrings.sText);
SetStart(client, track, GetEntPropEnt(client, Prop_Send, "m_hGroundEntity") == -1);
return Plugin_Handled;
}
@ -1570,15 +1563,15 @@ void SetStart(int client, int track, bool anglesonly)
}
GetClientEyeAngles(client, gF_StartAng[client][track]);
char query[1024];
FormatEx(query, sizeof(query),
"REPLACE INTO %sstartpositions (auth, track, map, pos_x, pos_y, pos_z, ang_x, ang_y, ang_z, angles_only) VALUES (%d, %d, '%s', %.03f, %.03f, %.03f, %.03f, %.03f, %.03f, %d);",
gS_MySQLPrefix, GetSteamAccountID(client), track, gS_Map,
gF_StartPos[client][track][0], gF_StartPos[client][track][1], gF_StartPos[client][track][2],
gF_StartAng[client][track][0], gF_StartAng[client][track][1], gF_StartAng[client][track][2], anglesonly);
gH_SQL.Query2(SQL_InsertStartPosition_Callback, query);
}
@ -1613,7 +1606,7 @@ void DeleteSetStart(int client, int track)
gF_StartAng[client][track] = view_as<float>({0.0, 0.0, 0.0});
char query[512];
FormatEx(query, 512,
"DELETE FROM %sstartpositions WHERE auth = %d AND track = %d AND map = '%s';",
gS_MySQLPrefix, GetSteamAccountID(client), track, gS_Map);
@ -1749,7 +1742,6 @@ public int MenuHandler_AddCustomSpawn(Menu menu, MenuAction action, int param1,
InsertZone(param1);
}
else if(action == MenuAction_End)
{
delete menu;
@ -1818,7 +1810,6 @@ public int MenuHandler_DeleteCustomSpawn(Menu menu, MenuAction action, int param
gH_SQL.Query2(SQL_DeleteCustom_Spawn_Callback, sQuery, GetClientSerial(param1));
}
else if(action == MenuAction_End)
{
delete menu;
@ -1855,7 +1846,7 @@ void ClearCustomSpawn(int track)
return;
}
for(int i = 0; i < TRACKS_SIZE; i++)
{
gF_CustomSpawn[i] = NULL_VECTOR;
@ -1961,7 +1952,6 @@ public Action Command_Stages(int client, int args)
{
TeleportEntity(client, gV_Destinations[i], NULL_VECTOR, view_as<float>({0.0, 0.0, 0.0}));
}
else
{
TeleportEntity(client, gV_ZoneCenter[i], NULL_VECTOR, view_as<float>({0.0, 0.0, 0.0}));
@ -1975,19 +1965,19 @@ public Action Command_Stages(int client, int args)
menu.SetTitle("%T", "ZoneMenuStage", client);
char sDisplay[64];
for(int i = 0; i < gI_MapZones; i++)
{
if(gA_ZoneCache[i].bZoneInitialized && gA_ZoneCache[i].iZoneType == Zone_Stage)
{
char sTrack[32];
GetTrackName(client, gA_ZoneCache[i].iZoneTrack, sTrack, 32);
FormatEx(sDisplay, 64, "#%d - %T (%s)", (i + 1), "ZoneSetStage", client, gA_ZoneCache[i].iZoneData, sTrack);
char sInfo[8];
IntToString(i, sInfo, 8);
menu.AddItem(sInfo, sDisplay);
}
}
@ -2006,25 +1996,23 @@ public int MenuHandler_SelectStage(Menu menu, MenuAction action, int param1, int
char sInfo[8];
menu.GetItem(param2, sInfo, 8);
int iIndex = StringToInt(sInfo);
Shavit_StopTimer(param1);
if(!EmptyVector(gV_Destinations[iIndex]))
{
TeleportEntity(param1, gV_Destinations[iIndex], NULL_VECTOR, view_as<float>({0.0, 0.0, 0.0}));
}
else
{
TeleportEntity(param1, gV_ZoneCenter[iIndex], NULL_VECTOR, view_as<float>({0.0, 0.0, 0.0}));
}
}
else if(action == MenuAction_End)
{
delete menu;
}
return 0;
}
@ -2092,12 +2080,11 @@ public int MenuHandler_SelectZoneTrack(Menu menu, MenuAction action, int param1,
submenu.ExitButton = true;
submenu.Display(param1, 300);
}
else if(action == MenuAction_End)
{
delete menu;
}
return 0;
}
@ -2298,7 +2285,6 @@ public int MenuHandler_ZoneEdit(Menu menu, MenuAction action, int param1, int pa
}
}
}
else if(action == MenuAction_End)
{
delete menu;
@ -2354,7 +2340,7 @@ Action OpenDeleteMenu(int client, int pos = 0)
char sInfo[8];
IntToString(i, sInfo, 8);
if(gB_InsideZoneID[client][i])
{
Format(sDisplay, 64, "%s %T", sDisplay, "ZoneInside", client);
@ -2378,7 +2364,7 @@ public int MenuHandler_DeleteZone(Menu menu, MenuAction action, int param1, int
menu.GetItem(param2, info, 8);
int id = StringToInt(info);
switch(id)
{
case -2:
@ -2406,7 +2392,6 @@ public int MenuHandler_DeleteZone(Menu menu, MenuAction action, int param1, int
}
}
}
else if(action == MenuAction_End)
{
delete menu;
@ -2495,7 +2480,6 @@ public int MenuHandler_DeleteAllZones(Menu menu, MenuAction action, int param1,
gH_SQL.Query2(SQL_DeleteAllZones_Callback, sQuery, GetClientSerial(param1));
}
else if(action == MenuAction_End)
{
delete menu;
@ -2542,7 +2526,6 @@ public int MenuHandler_SelectZoneType(Menu menu, MenuAction action, int param1,
ShowPanel(param1, 1);
}
else if(action == MenuAction_End)
{
delete menu;
@ -2588,7 +2571,6 @@ void ShowPanel(int client, int step)
{
FormatEx(sPanelText, 128, "%T", "ZonePlaceTextTF2", client, (step == 1)? sFirst:sSecond);
}
else
{
FormatEx(sPanelText, 128, "%T", "ZonePlaceText", client, (step == 1)? sFirst:sSecond);
@ -2675,10 +2657,9 @@ public int ZoneCreation_Handler(Menu menu, MenuAction action, int param1, int pa
}
}
}
ShowPanel(param1, gI_MapStep[param1]);
}
else if(action == MenuAction_End)
{
delete menu;
@ -2694,7 +2675,7 @@ float[] SnapToGrid(float pos[3], int grid, bool third)
origin[0] = float(RoundToNearest(pos[0] / grid) * grid);
origin[1] = float(RoundToNearest(pos[1] / grid) * grid);
if(third)
{
origin[2] = float(RoundToNearest(pos[2] / grid) * grid);
@ -2857,12 +2838,10 @@ public Action Shavit_OnUserCmdPre(int client, int &buttons, int &impulse, float
{
origin = GetAimPosition(client);
}
else if(!(gB_SnapToWall[client] && SnapToWall(vPlayerOrigin, client, origin)))
{
origin = SnapToGrid(vPlayerOrigin, gI_GridSnap[client], false);
}
else
{
gV_WallSnap[client] = origin;
@ -2947,7 +2926,6 @@ public int CreateZoneConfirm_Handler(Menu menu, MenuAction action, int param1, i
return 0;
}
else if(StrEqual(sInfo, "no"))
{
if (gI_ZoneID[param1] != -1)
@ -2959,19 +2937,16 @@ public int CreateZoneConfirm_Handler(Menu menu, MenuAction action, int param1, i
return 0;
}
else if(StrEqual(sInfo, "adjust"))
{
CreateAdjustMenu(param1, 0);
return 0;
}
else if(StrEqual(sInfo, "tpzone"))
{
UpdateTeleportZone(param1);
}
else if(StrEqual(sInfo, "datafromchat"))
{
gI_ZoneData[param1] = 0;
@ -2981,7 +2956,6 @@ public int CreateZoneConfirm_Handler(Menu menu, MenuAction action, int param1, i
return 0;
}
else if(StrEqual(sInfo, "forcerender"))
{
gI_ZoneFlags[param1] ^= ZF_ForceRender;
@ -3040,7 +3014,6 @@ void UpdateTeleportZone(int client)
Shavit_PrintToChat(client, "%T", "ZoneTeleportUpdated", client);
}
else
{
bool bInside = true;
@ -3057,7 +3030,6 @@ void UpdateTeleportZone(int client)
{
Shavit_PrintToChat(client, "%T", "ZoneTeleportInsideZone", client);
}
else
{
gV_Teleport[client] = vTeleport;
@ -3085,7 +3057,6 @@ void CreateEditMenu(int client)
FormatEx(sMenuItem, 64, "%T", "ZoneSetTP", client);
menu.AddItem("-1", sMenuItem, ITEMDRAW_DISABLED);
}
else
{
FormatEx(sMenuItem, 64, "%T", "ZoneSetYes", client);
@ -3134,12 +3105,11 @@ void CreateEditMenu(int client)
{
FormatEx(sMenuItem, 64, "%T", "ZoneSetSpeedLimitUnlimited", client, gI_ZoneData[client]);
}
else
{
FormatEx(sMenuItem, 64, "%T", "ZoneSetSpeedLimit", client, gI_ZoneData[client]);
}
menu.AddItem("datafromchat", sMenuItem);
}
else if (gI_ZoneType[client] == Zone_Gravity)
@ -3198,7 +3168,6 @@ public int ZoneAdjuster_Handler(Menu menu, MenuAction action, int param1, int pa
{
CreateEditMenu(param1);
}
else if(StrEqual(sInfo, "cancel"))
{
if (gI_ZoneID[param1] != -1)
@ -3209,7 +3178,6 @@ public int ZoneAdjuster_Handler(Menu menu, MenuAction action, int param1, int pa
Reset(param1);
}
else
{
char sAxis[4];
@ -3284,11 +3252,10 @@ void InsertZone(int client)
{
Shavit_LogMessage("%L - added custom spawn {%.2f, %.2f, %.2f} to map `%s`.", client, gV_Point1[client][0], gV_Point1[client][1], gV_Point1[client][2], gS_Map);
FormatEx(sQuery, sizeof(sQuery),
FormatEx(sQuery, sizeof(sQuery),
"INSERT INTO %smapzones (map, type, destination_x, destination_y, destination_z, track) VALUES ('%s', %d, '%.03f', '%.03f', '%.03f', %d);",
gS_MySQLPrefix, gS_Map, Zone_CustomSpawn, gV_Point1[client][0], gV_Point1[client][1], gV_Point1[client][2], gI_ZoneTrack[client]);
}
else if(bInsert) // insert
{
Shavit_LogMessage("%L - added %s %s to map `%s`.", client, sTrack, gS_ZoneNames[iType], gS_Map);
@ -3297,7 +3264,6 @@ void InsertZone(int client)
"INSERT INTO %smapzones (map, type, corner1_x, corner1_y, corner1_z, corner2_x, corner2_y, corner2_z, destination_x, destination_y, destination_z, track, flags, data) VALUES ('%s', %d, '%.03f', '%.03f', '%.03f', '%.03f', '%.03f', '%.03f', '%.03f', '%.03f', '%.03f', %d, %d, %d);",
gS_MySQLPrefix, gS_Map, iType, gV_Point1[client][0], gV_Point1[client][1], gV_Point1[client][2], gV_Point2[client][0], gV_Point2[client][1], gV_Point2[client][2], gV_Teleport[client][0], gV_Teleport[client][1], gV_Teleport[client][2], gI_ZoneTrack[client], gI_ZoneFlags[client], gI_ZoneData[client]);
}
else // update
{
Shavit_LogMessage("%L - updated %s %s in map `%s`.", client, sTrack, gS_ZoneNames[iType], gS_Map);
@ -3474,12 +3440,10 @@ public Action Timer_Draw(Handle Timer, any data)
{
origin = GetAimPosition(client);
}
else if(!(gB_SnapToWall[client] && SnapToWall(vPlayerOrigin, client, origin)))
{
origin = SnapToGrid(vPlayerOrigin, gI_GridSnap[client], false);
}
else
{
gV_WallSnap[client] = origin;
@ -3489,7 +3453,6 @@ public Action Timer_Draw(Handle Timer, any data)
{
origin[2] = (vPlayerOrigin[2] + gCV_Height.FloatValue);
}
else
{
origin = gV_Point2[client];
@ -3622,7 +3585,6 @@ void CreateZonePoints(float point[8][3], float offset = 0.0)
{
point[i][j] += offset;
}
else if(point[i][j] > center[j])
{
point[i][j] -= offset;
@ -3861,7 +3823,7 @@ public void CreateZoneEntities(bool only_create_dead_entities)
DispatchKeyValue(entity, "wait", "0");
DispatchKeyValue(entity, "spawnflags", "4097");
if(!DispatchSpawn(entity))
{
LogError("\"trigger_multiple\" spawning failed, map %s.", gS_Map);
@ -4068,7 +4030,6 @@ public void TouchPost(int entity, int other)
{
Shavit_StartTimer(other, gA_ZoneCache[gI_EntityZone[entity]].iZoneTrack);
}
else if(gA_ZoneCache[gI_EntityZone[entity]].iZoneTrack == Track_Main)
{
Shavit_StartTimer(other, Track_Main);