diff --git a/extensions/sdktools/vnatives.cpp b/extensions/sdktools/vnatives.cpp index fab25181..d49a06a7 100644 --- a/extensions/sdktools/vnatives.cpp +++ b/extensions/sdktools/vnatives.cpp @@ -172,7 +172,40 @@ static cell_t GiveNamedItem(IPluginContext *pContext, const cell_t *params) return gamehelpers->EntityToBCompatRef(pEntity); } +#else if SOURCE_ENGINE == SE_BMS +// CBaseEntity *GiveNamedItem( const char *szName, int iSubType = 0, int iPrimaryAmmo = -1, int iSecondaryAmmo = -1 ) +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_POD, 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); + *(int *)(vptr + 12) = -1; + *(int *)(vptr + 16) = -1; + FINISH_CALL_SIMPLE(&pEntity); + + return gamehelpers->EntityToBCompatRef(pEntity); +} #else +// CBaseEntity *GiveNamedItem( const char *szName, int iSubType = 0 ) static cell_t GiveNamedItem(IPluginContext *pContext, const cell_t *params) { static ValveCall *pCall = NULL;