diff --git a/extensions/cstrike/extension.cpp b/extensions/cstrike/extension.cpp index c51858a8..87ed1624 100644 --- a/extensions/cstrike/extension.cpp +++ b/extensions/cstrike/extension.cpp @@ -100,7 +100,7 @@ bool CStrike::SDK_OnLoad(char *error, size_t maxlength, bool late) g_pHandleBuyForward = forwards->CreateForward("CS_OnBuyCommand", ET_Event, 2, NULL, Param_Cell, Param_String); g_pPriceForward = forwards->CreateForward("CS_OnGetWeaponPrice", ET_Event, 3, NULL, Param_Cell, Param_String, Param_CellByRef); g_pTerminateRoundForward = forwards->CreateForward("CS_OnTerminateRound", ET_Event, 2, NULL, Param_FloatByRef, Param_CellByRef); - g_pCSWeaponDropForward = forwards->CreateForward("CS_OnCSWeaponDrop", ET_Event, 2, NULL, Param_Cell, Param_Cell); + g_pCSWeaponDropForward = forwards->CreateForward("CS_OnCSWeaponDrop", ET_Event, 3, NULL, Param_Cell, Param_Cell, Param_Cell); m_TerminateRoundDetourEnabled = false; diff --git a/extensions/cstrike/forwards.cpp b/extensions/cstrike/forwards.cpp index 4b67a052..ef1d4f6c 100644 --- a/extensions/cstrike/forwards.cpp +++ b/extensions/cstrike/forwards.cpp @@ -216,12 +216,20 @@ DETOUR_DECL_MEMBER3(DetourTerminateRound, void, int, reason, int, unknown, int, #endif } +#if SOURCE_ENGINE == SE_CSGO +DETOUR_DECL_MEMBER3(DetourCSWeaponDrop, void, CBaseEntity *, weapon, bool, bThrowForward, bool, bDonated) +#else DETOUR_DECL_MEMBER2(DetourCSWeaponDrop, void, CBaseEntity *, weapon, bool, bThrowForward) +#endif { if (g_pIgnoreCSWeaponDropDetour) { g_pIgnoreCSWeaponDropDetour = false; +#if SOURCE_ENGINE == SE_CSGO + DETOUR_MEMBER_CALL(DetourCSWeaponDrop)(weapon, bThrowForward, bDonated); +#else DETOUR_MEMBER_CALL(DetourCSWeaponDrop)(weapon, bThrowForward); +#endif return; } @@ -231,12 +239,21 @@ DETOUR_DECL_MEMBER2(DetourCSWeaponDrop, void, CBaseEntity *, weapon, bool, bThro cell_t result = Pl_Continue; g_pCSWeaponDropForward->PushCell(client); g_pCSWeaponDropForward->PushCell(weaponIndex); +#if SOURCE_ENGINE == SE_CSGO + g_pCSWeaponDropForward->PushCell(bDonated); +#else + g_pCSWeaponDropForward->PushCell(false); +#endif g_pCSWeaponDropForward->Execute(&result); if (result == Pl_Continue) { +#if SOURCE_ENGINE == SE_CSGO + DETOUR_MEMBER_CALL(DetourCSWeaponDrop)(weapon, bThrowForward, bDonated); +#else DETOUR_MEMBER_CALL(DetourCSWeaponDrop)(weapon, bThrowForward); +#endif } return; diff --git a/plugins/include/cstrike.inc b/plugins/include/cstrike.inc index 2e073f78..e8b34b41 100644 --- a/plugins/include/cstrike.inc +++ b/plugins/include/cstrike.inc @@ -196,8 +196,10 @@ forward Action CS_OnBuyCommand(int client, const char[] weapon); * * @param client Client index * @param weaponIndex Weapon index + * @param donated Was weapon donated (Bought from a buy menu while ctrl was pressed) + * (Note: This param is for CS:GO only, will be false on other games) */ -forward Action CS_OnCSWeaponDrop(int client, int weaponIndex); +forward Action CS_OnCSWeaponDrop(int client, int weaponIndex, bool donated); /** * Called when game retrieves a weapon's price for a player.