Update GivePlayerItem for new params in CS:GO.
Update GivePlayerItem for new params in CS:GO.
1.1 --- a/extensions/sdktools/vnatives.cpp Wed Aug 14 16:42:40 2013 -0400
1.2 +++ b/extensions/sdktools/vnatives.cpp Wed Aug 14 17:07:27 2013 -0400
1.3 @@ -140,6 +140,39 @@
1.4 return ret ? 1 : 0;
1.5 }
1.6
1.7 +#if SOURCE_ENGINE == SE_CSGO
1.8 +class CEconItemView;
1.9 +static cell_t GiveNamedItem(IPluginContext *pContext, const cell_t *params)
1.10 +{
1.11 + static ValveCall *pCall = NULL;
1.12 + if (!pCall)
1.13 + {
1.14 + ValvePassInfo pass[5];
1.15 + InitPass(pass[0], Valve_String, PassType_Basic, PASSFLAG_BYVAL);
1.16 + InitPass(pass[1], Valve_POD, PassType_Basic, PASSFLAG_BYVAL);
1.17 + InitPass(pass[2], Valve_POD, PassType_Basic, PASSFLAG_BYVAL);
1.18 + InitPass(pass[3], Valve_Bool, PassType_Basic, PASSFLAG_BYVAL);
1.19 + InitPass(pass[4], Valve_CBaseEntity, PassType_Basic, PASSFLAG_BYVAL);
1.20 + if (!CreateBaseCall("GiveNamedItem", ValveCall_Player, &pass[4], pass, 4, &pCall))
1.21 + {
1.22 + return pContext->ThrowNativeError("\"GiveNamedItem\" not supported by this mod");
1.23 + } else if (!pCall) {
1.24 + return pContext->ThrowNativeError("\"GiveNamedItem\" wrapper failed to initialize");
1.25 + }
1.26 + }
1.27 +
1.28 + CBaseEntity *pEntity = NULL;
1.29 + START_CALL();
1.30 + DECODE_VALVE_PARAM(1, thisinfo, 0);
1.31 + DECODE_VALVE_PARAM(2, vparams, 0);
1.32 + DECODE_VALVE_PARAM(3, vparams, 1);
1.33 + *(CEconItemView **)(vptr + 12) = NULL;
1.34 + *(bool *)(vptr + 16) = false;
1.35 + FINISH_CALL_SIMPLE(&pEntity);
1.36 +
1.37 + return gamehelpers->EntityToBCompatRef(pEntity);
1.38 +}
1.39 +#else
1.40 static cell_t GiveNamedItem(IPluginContext *pContext, const cell_t *params)
1.41 {
1.42 static ValveCall *pCall = NULL;
1.43 @@ -166,6 +199,7 @@
1.44
1.45 return gamehelpers->EntityToBCompatRef(pEntity);
1.46 }
1.47 +#endif
1.48
1.49 static cell_t GetPlayerWeaponSlot(IPluginContext *pContext, const cell_t *params)
1.50 {