From bbdf40160ccb8284eeecca365bac04b73273a7c6 Mon Sep 17 00:00:00 2001 From: Nicholas Hastings Date: Mon, 23 Jun 2014 19:24:27 -0400 Subject: [PATCH] Add missing thisptr to call. --- extensions/tf2/natives.cpp | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/extensions/tf2/natives.cpp b/extensions/tf2/natives.cpp index 36d808d9..75835f8d 100644 --- a/extensions/tf2/natives.cpp +++ b/extensions/tf2/natives.cpp @@ -34,6 +34,8 @@ #include "time.h" #include "RegNatives.h" +#include + // native TF2_MakeBleed(client, attacker, Float:duration) cell_t TF2_MakeBleed(IPluginContext *pContext, const cell_t *params) { @@ -553,6 +555,12 @@ cell_t TF2_IsPlayerInDuel(IPluginContext *pContext, const cell_t *params) // native bool:TF2_IsHolidayActive(TFHoliday:holiday); cell_t TF2_IsHolidayActive(IPluginContext *pContext, const cell_t *params) { + void *pGameRules; + if (!g_pSDKTools || !(pGameRules = g_pSDKTools->GetGameRules())) + { + return pContext->ThrowNativeError("Failed to find GameRules"); + } + static ICallWrapper *pWrapper = NULL; // CTFGameRules::IsHolidayActive(int) @@ -578,8 +586,10 @@ cell_t TF2_IsHolidayActive(IPluginContext *pContext, const cell_t *params) g_RegNatives.Register(pWrapper); } - unsigned char vstk[sizeof(int)]; + unsigned char vstk[sizeof(void *) + sizeof(int)]; unsigned char *vptr = vstk; + *(void **)vptr = pGameRules; + vptr += sizeof(void *); *(int *)vptr = params[1]; bool retValue;