From 3d573c08a14965c2dba5d960b340e2492771bf22 Mon Sep 17 00:00:00 2001 From: Fyren Date: Wed, 1 Apr 2009 04:35:51 -0700 Subject: [PATCH 01/10] Fix CommitSuicide offset (bug 3726, r=Srdog) --- gamedata/sdktools.games/game.dod.txt | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/gamedata/sdktools.games/game.dod.txt b/gamedata/sdktools.games/game.dod.txt index 6bf8b8d9a..a2076ead3 100644 --- a/gamedata/sdktools.games/game.dod.txt +++ b/gamedata/sdktools.games/game.dod.txt @@ -37,8 +37,8 @@ } "CommitSuicide" { - "windows" "388" - "linux" "388" + "windows" "390" + "linux" "390" } "GetVelocity" { From 9def5e57de8a7e0e5b4eeca27936e16704e2a724 Mon Sep 17 00:00:00 2001 From: Fyren Date: Wed, 1 Apr 2009 05:56:51 -0700 Subject: [PATCH 02/10] Disable nextmap in Synergy and Dystopia (bug 3687, bug 3741; r=liam) --- plugins/nextmap.sp | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/plugins/nextmap.sp b/plugins/nextmap.sp index 3dde38eaa..028aebcf6 100644 --- a/plugins/nextmap.sp +++ b/plugins/nextmap.sp @@ -54,10 +54,12 @@ new g_CurrentMapStartTime; public OnPluginStart() { - decl String:desc[128]; - GetGameFolderName(desc, sizeof(desc)); + decl String:game[128]; + GetGameFolderName(game, sizeof(game)); - if (StrEqual(desc, "left4dead", false)) + if (StrEqual(game, "left4dead", false) + || StrEqual(game, "dystopia", false) + || StrEqual(game, "synergy", false)) return; LoadTranslations("common.phrases"); @@ -81,10 +83,12 @@ public OnMapStart() public OnConfigsExecuted() { - decl String:desc[128]; - GetGameFolderName(desc, sizeof(desc)); + decl String:game[128]; + GetGameFolderName(game, sizeof(game)); - if (StrEqual(desc, "left4dead", false)) + if (StrEqual(game, "left4dead", false) + || StrEqual(game, "dystopia", false) + || StrEqual(game, "synergy", false)) return; decl String:lastMap[64], String:currentMap[64]; From 187c0a9bf7e61075e3d2909d3800ed3b648d53a4 Mon Sep 17 00:00:00 2001 From: Fyren Date: Tue, 7 Apr 2009 17:24:22 -0700 Subject: [PATCH 03/10] Fix GetCommandFlags for original engine games (bug 3759, r=dvander) --- public/compat_wrappers.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/public/compat_wrappers.h b/public/compat_wrappers.h index 40b6534d0..cf4db0725 100644 --- a/public/compat_wrappers.h +++ b/public/compat_wrappers.h @@ -84,7 +84,7 @@ { if (strcmp(pBase->GetName(), name) == 0) { - if (pBase->IsCommand()) + if (!pBase->IsCommand()) { return NULL; } From 0122686541f5a12d017b72f54e198efb6fb14639 Mon Sep 17 00:00:00 2001 From: Matt Woodrow Date: Mon, 13 Apr 2009 09:50:46 +1200 Subject: [PATCH 04/10] Clientprefs now loads cookies for clients on late load (bug 3735, r=dvander) --- extensions/clientprefs/extension.cpp | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/extensions/clientprefs/extension.cpp b/extensions/clientprefs/extension.cpp index 0aa17c78c..126761d00 100644 --- a/extensions/clientprefs/extension.cpp +++ b/extensions/clientprefs/extension.cpp @@ -132,6 +132,23 @@ bool ClientPrefs::SDK_OnLoad(char *error, size_t maxlength, bool late) phrases->AddPhraseFile("clientprefs.phrases"); phrases->AddPhraseFile("common.phrases"); + if (late) + { + int maxclients = playerhelpers->GetMaxClients(); + + for (int i = 1; i <= maxclients; i++) + { + IGamePlayer *pPlayer = playerhelpers->GetGamePlayer(i); + + if (!pPlayer || !pPlayer->IsAuthorized()) + { + continue; + } + + g_CookieManager.OnClientAuthorized(i, pPlayer->GetAuthString()); + } + } + return true; } From 2c190f502f6b1bd9cc66020b61be0b33b2a16cd7 Mon Sep 17 00:00:00 2001 From: Matt Woodrow Date: Mon, 13 Apr 2009 10:02:55 +1200 Subject: [PATCH 05/10] Added new playerhelpers interface --- public/IPlayerHelpers.h | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/public/IPlayerHelpers.h b/public/IPlayerHelpers.h index 5195c60cf..27b80e7ac 100644 --- a/public/IPlayerHelpers.h +++ b/public/IPlayerHelpers.h @@ -41,7 +41,7 @@ #include #define SMINTERFACE_PLAYERMANAGER_NAME "IPlayerManager" -#define SMINTERFACE_PLAYERMANAGER_VERSION 9 +#define SMINTERFACE_PLAYERMANAGER_VERSION 10 struct edict_t; class IPlayerInfo; @@ -190,6 +190,13 @@ namespace SourceMod * @return Serial number. */ virtual unsigned int GetSerial() =0; + + /** + * @brief Return whether the client is authorized. + * + * @return True if authorized, false otherwise. + */ + virtual bool IsAuthorized() =0; }; /** From 74a25097b258165ad858fea96d6a22b461c4ed0b Mon Sep 17 00:00:00 2001 From: Fyren Date: Mon, 13 Apr 2009 16:39:53 -0700 Subject: [PATCH 06/10] Fix OnClientConnect rejectmsg handling, improve doc (bug 3690, r=dvander) --- core/PlayerManager.cpp | 2 +- plugins/include/clients.inc | 4 ++++ 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/core/PlayerManager.cpp b/core/PlayerManager.cpp index daa6030da..d3b72bf90 100644 --- a/core/PlayerManager.cpp +++ b/core/PlayerManager.cpp @@ -421,7 +421,7 @@ bool PlayerManager::OnClientConnect(edict_t *pEntity, const char *pszName, const pPlayer->Initialize(pszName, pszAddress, pEntity); m_clconnect->PushCell(client); - m_clconnect->PushStringEx(reject, maxrejectlen, SM_PARAM_STRING_UTF8, SM_PARAM_COPYBACK); + m_clconnect->PushStringEx(reject, maxrejectlen, SM_PARAM_STRING_UTF8 | SM_PARAM_STRING_COPY, SM_PARAM_COPYBACK); m_clconnect->PushCell(maxrejectlen); m_clconnect->Execute(&res); diff --git a/plugins/include/clients.inc b/plugins/include/clients.inc index e252407c2..8c1326103 100644 --- a/plugins/include/clients.inc +++ b/plugins/include/clients.inc @@ -63,6 +63,10 @@ public const MaxClients; /**< Maximum number of players the server supports (dyn * If you return false (or return nothing), the client will be rejected. If the client is * rejected by this forward or any other, OnClientDisconnect will not be called. * + * Note: Do not write to rejectmsg if you plan on returning true. If multiple plugins write + * to the string buffer, it is not defined which plugin's string will be shown to the client, + * but it is guaranteed one of them will. + * * @param client Client index. * @param rejectmsg Buffer to store the rejection message when the connection is refused. * @param maxlen Maximum number of characters for rejection buffer. From 6aded88e14d4689ad818d5f5e2fd48fe845c013f Mon Sep 17 00:00:00 2001 From: Fyren Date: Mon, 20 Apr 2009 21:38:12 -0700 Subject: [PATCH 07/10] Fixed CommitSuicide offset for today's TF2 update --- gamedata/sdktools.games/game.tf.txt | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/gamedata/sdktools.games/game.tf.txt b/gamedata/sdktools.games/game.tf.txt index 41e51c26f..ecace4bff 100644 --- a/gamedata/sdktools.games/game.tf.txt +++ b/gamedata/sdktools.games/game.tf.txt @@ -37,8 +37,8 @@ } "CommitSuicide" { - "windows" "390" - "linux" "390" + "windows" "391" + "linux" "391" } "GetVelocity" { @@ -87,4 +87,4 @@ } } } -} \ No newline at end of file +} From 462e03d15065e6a9eeb17604b330510b9f9a8558 Mon Sep 17 00:00:00 2001 From: Fyren Date: Tue, 21 Apr 2009 02:38:35 -0700 Subject: [PATCH 08/10] Fix medigun/CalcIsAttackCritical Windows crash (bug 3791, r=pred) --- extensions/tf2/criticals.cpp | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/extensions/tf2/criticals.cpp b/extensions/tf2/criticals.cpp index 7d6233e7a..f199c93f2 100644 --- a/extensions/tf2/criticals.cpp +++ b/extensions/tf2/criticals.cpp @@ -103,6 +103,12 @@ DetourResult DetourCallback(CBaseEntity *pEnt) return Result_Ignore; } + const char *cls = pEdict->GetClassName(); + if (strcmp(cls, "tf_weapon_medigun") == 0) + { + return Result_Ignore; + } + int returnValue=0; CBaseHandle &hndl = *(CBaseHandle *)((uint8_t *)pEnt + info.actual_offset); @@ -110,7 +116,7 @@ DetourResult DetourCallback(CBaseEntity *pEnt) g_critForward->PushCell(index); //Client index g_critForward->PushCell(engine->IndexOfEdict(pEdict)); // Weapon index - g_critForward->PushString(pEdict->GetClassName()); //Weapon classname + g_critForward->PushString(cls); //Weapon classname g_critForward->PushCellByRef(&returnValue); //return value cell_t result = 0; From d9f5801a6836c16ba347b1eefc5c668a94d37eda Mon Sep 17 00:00:00 2001 From: Fyren Date: Tue, 21 Apr 2009 17:55:14 -0700 Subject: [PATCH 09/10] I can in no way find fault with myself, so I blame buildbot. --- pushbuild.txt | 1 + 1 file changed, 1 insertion(+) diff --git a/pushbuild.txt b/pushbuild.txt index 5a66815a2..01fe063dd 100644 --- a/pushbuild.txt +++ b/pushbuild.txt @@ -12,3 +12,4 @@ D S ! joys of buildbot, part 5: a watermelon's diatribes need not be cause for spilling the queen's tea +What the hell. From 5096aef6e71a7a7266a24497bcad7a48076bb574 Mon Sep 17 00:00:00 2001 From: Fyren Date: Wed, 22 Apr 2009 19:06:19 -0700 Subject: [PATCH 10/10] Remove knife critical stuff and previous "fix" (bug 3791, r=pred) --- extensions/tf2/criticals.cpp | 35 +---------------------------------- gamedata/sm-tf2.games.txt | 9 +-------- 2 files changed, 2 insertions(+), 42 deletions(-) diff --git a/extensions/tf2/criticals.cpp b/extensions/tf2/criticals.cpp index f199c93f2..1c5ecb570 100644 --- a/extensions/tf2/criticals.cpp +++ b/extensions/tf2/criticals.cpp @@ -35,7 +35,6 @@ IServerGameEnts *gameents = NULL; CDetour *calcIsAttackCriticalDetour = NULL; CDetour *calcIsAttackCriticalMeleeDetour = NULL; -CDetour *calcIsAttackCriticalKnifeDetour = NULL; IForward *g_critForward = NULL; @@ -103,12 +102,6 @@ DetourResult DetourCallback(CBaseEntity *pEnt) return Result_Ignore; } - const char *cls = pEdict->GetClassName(); - if (strcmp(cls, "tf_weapon_medigun") == 0) - { - return Result_Ignore; - } - int returnValue=0; CBaseHandle &hndl = *(CBaseHandle *)((uint8_t *)pEnt + info.actual_offset); @@ -116,7 +109,7 @@ DetourResult DetourCallback(CBaseEntity *pEnt) g_critForward->PushCell(index); //Client index g_critForward->PushCell(engine->IndexOfEdict(pEdict)); // Weapon index - g_critForward->PushString(cls); //Weapon classname + g_critForward->PushString(pEdict->GetClassName()); //Weapon classname g_critForward->PushCellByRef(&returnValue); //return value cell_t result = 0; @@ -158,24 +151,6 @@ DETOUR_DECL_MEMBER0(CalcIsAttackCriticalHelperMelee, bool) } } -DETOUR_DECL_MEMBER0(CalcIsAttackCriticalHelperKnife, bool) -{ - DetourResult result = DetourCallback((CBaseEntity *)this); - - if (result == Result_Ignore) - { - return DETOUR_MEMBER_CALL(CalcIsAttackCriticalHelperKnife)(); - } - else if (result == Result_NoCrit) - { - return 0; - } - else - { - return 1; - } -} - DETOUR_DECL_MEMBER0(CalcIsAttackCriticalHelper, bool) { DetourResult result = DetourCallback((CBaseEntity *)this); @@ -198,7 +173,6 @@ void InitialiseDetours() { calcIsAttackCriticalDetour = DETOUR_CREATE_MEMBER(CalcIsAttackCriticalHelper, "CalcCritical"); calcIsAttackCriticalMeleeDetour = DETOUR_CREATE_MEMBER(CalcIsAttackCriticalHelperMelee, "CalcCriticalMelee"); - calcIsAttackCriticalKnifeDetour = DETOUR_CREATE_MEMBER(CalcIsAttackCriticalHelperKnife, "CalcCriticalKnife"); bool HookCreated = false; @@ -214,12 +188,6 @@ void InitialiseDetours() HookCreated = true; } - if (calcIsAttackCriticalKnifeDetour != NULL) - { - calcIsAttackCriticalKnifeDetour->EnableDetour(); - HookCreated = true; - } - if (!HookCreated) { g_pSM->LogError(myself, "No critical hit forwards could be initialized - Disabled critical hit hooks"); @@ -232,5 +200,4 @@ void RemoveDetours() { calcIsAttackCriticalDetour->Destroy(); calcIsAttackCriticalMeleeDetour->Destroy(); - calcIsAttackCriticalKnifeDetour->Destroy(); } diff --git a/gamedata/sm-tf2.games.txt b/gamedata/sm-tf2.games.txt index fcd0bacb0..c53f895df 100644 --- a/gamedata/sm-tf2.games.txt +++ b/gamedata/sm-tf2.games.txt @@ -34,13 +34,6 @@ "linux" "@_ZN18CTFWeaponBaseMelee26CalcIsAttackCriticalHelperEv" "windows" "\x83\xEC\x08\x53\x57\x8B\xF9\xE8\x2A\x2A\x2A\x2A\x8B\xD8" } - "CalcCriticalKnife" - { - "library" "server" - "linux" "@_ZN8CTFKnife26CalcIsAttackCriticalHelperEv" - "windows" "\x8B\x81\xF0\x13\x00\x00\x83\xF8\xFF\x74\x29\x8B\x15" - } - } "Offsets" { @@ -51,4 +44,4 @@ } } } -} \ No newline at end of file +}