From 575962569fdc9daef1b3a95ddf2af41d8fe377f0 Mon Sep 17 00:00:00 2001 From: Nicholas Hastings Date: Wed, 14 Aug 2013 17:07:27 -0400 Subject: [PATCH] Update GivePlayerItem for new params in CS:GO. --- extensions/sdktools/vnatives.cpp | 34 ++++++++++++++++++++++++++++++++ 1 file changed, 34 insertions(+) diff --git a/extensions/sdktools/vnatives.cpp b/extensions/sdktools/vnatives.cpp index c00b354f..07e817ad 100644 --- a/extensions/sdktools/vnatives.cpp +++ b/extensions/sdktools/vnatives.cpp @@ -140,6 +140,39 @@ static cell_t RemovePlayerItem(IPluginContext *pContext, const cell_t *params) return ret ? 1 : 0; } +#if SOURCE_ENGINE == SE_CSGO +class CEconItemView; +static cell_t GiveNamedItem(IPluginContext *pContext, const cell_t *params) +{ + static ValveCall *pCall = NULL; + if (!pCall) + { + ValvePassInfo pass[5]; + InitPass(pass[0], Valve_String, PassType_Basic, PASSFLAG_BYVAL); + InitPass(pass[1], Valve_POD, PassType_Basic, PASSFLAG_BYVAL); + InitPass(pass[2], Valve_POD, PassType_Basic, PASSFLAG_BYVAL); + InitPass(pass[3], Valve_Bool, PassType_Basic, PASSFLAG_BYVAL); + InitPass(pass[4], Valve_CBaseEntity, PassType_Basic, PASSFLAG_BYVAL); + if (!CreateBaseCall("GiveNamedItem", ValveCall_Player, &pass[4], pass, 4, &pCall)) + { + return pContext->ThrowNativeError("\"GiveNamedItem\" not supported by this mod"); + } else if (!pCall) { + return pContext->ThrowNativeError("\"GiveNamedItem\" wrapper failed to initialize"); + } + } + + CBaseEntity *pEntity = NULL; + START_CALL(); + DECODE_VALVE_PARAM(1, thisinfo, 0); + DECODE_VALVE_PARAM(2, vparams, 0); + DECODE_VALVE_PARAM(3, vparams, 1); + *(CEconItemView **)(vptr + 12) = NULL; + *(bool *)(vptr + 16) = false; + FINISH_CALL_SIMPLE(&pEntity); + + return gamehelpers->EntityToBCompatRef(pEntity); +} +#else static cell_t GiveNamedItem(IPluginContext *pContext, const cell_t *params) { static ValveCall *pCall = NULL; @@ -166,6 +199,7 @@ static cell_t GiveNamedItem(IPluginContext *pContext, const cell_t *params) return gamehelpers->EntityToBCompatRef(pEntity); } +#endif static cell_t GetPlayerWeaponSlot(IPluginContext *pContext, const cell_t *params) {