From fbe46934a45afa8603a207ebc2e693ea0d376359 Mon Sep 17 00:00:00 2001 From: Matt Woodrow Date: Tue, 1 Apr 2008 00:51:21 +0000 Subject: [PATCH] Added EquipPlayerWeapon to SDKTools. Offsets for CS:S and TF2 added. --HG-- extra : convert_revision : svn%3A39bc706e-5318-0410-9160-8a85361fbb7c/trunk%401975 --- extensions/sdktools/vnatives.cpp | 24 ++++++++++++++++++++++++ gamedata/sdktools.games.ep2.txt | 22 ++++++++++++++++++++++ gamedata/sdktools.games.txt | 22 ++++++++++++++++++++++ plugins/include/sdktools_functions.inc | 12 ++++++++++++ 4 files changed, 80 insertions(+) diff --git a/extensions/sdktools/vnatives.cpp b/extensions/sdktools/vnatives.cpp index d04aaacf..ae6c0623 100644 --- a/extensions/sdktools/vnatives.cpp +++ b/extensions/sdktools/vnatives.cpp @@ -871,6 +871,29 @@ static cell_t GetServerNetStats(IPluginContext *pContext, const cell_t *params) return 1; } +static cell_t WeaponEquip(IPluginContext *pContext, const cell_t *params) +{ + static ValveCall *pCall = NULL; + if (!pCall) + { + ValvePassInfo pass[1]; + InitPass(pass[0], Valve_CBaseEntity, PassType_Basic, PASSFLAG_BYVAL); + if (!CreateBaseCall("WeaponEquip", ValveCall_Player, NULL, pass, 1, &pCall)) + { + return pContext->ThrowNativeError("\"WeaponEquip\" not supported by this mod"); + } else if (!pCall) { + return pContext->ThrowNativeError("\"WeaponEquip\" wrapper failed to initialized"); + } + } + + START_CALL(); + DECODE_VALVE_PARAM(1, thisinfo, 0); + DECODE_VALVE_PARAM(2, vparams, 0); + FINISH_CALL_SIMPLE(NULL); + + return 1; +} + sp_nativeinfo_t g_Natives[] = { {"ExtinguishEntity", ExtinguishEntity}, @@ -895,5 +918,6 @@ sp_nativeinfo_t g_Natives[] = {"SetEntityModel", sm_SetEntityModel}, {"GetPlayerDecalFile", GetPlayerDecalFile}, {"GetServerNetStats", GetServerNetStats}, + {"EquipPlayerWeapon", WeaponEquip}, {NULL, NULL}, }; diff --git a/gamedata/sdktools.games.ep2.txt b/gamedata/sdktools.games.ep2.txt index 65a430be..5f3a8d5f 100644 --- a/gamedata/sdktools.games.ep2.txt +++ b/gamedata/sdktools.games.ep2.txt @@ -276,6 +276,11 @@ "windows" "34" "linux" "35" } + "WeaponEquip" + { + "windows" "227" + "linux" "228" + } } } /* EntityFactoryDictionary function */ @@ -291,4 +296,21 @@ } } } + /* CBaseEntityOutput::FireOutput */ + "#default" + { + "#supported" + { + "game" "tf" + } + "Signatures" + { + "FireEvent" + { + "library" "server" + "windows" "\x81\xEC\x1C\x01\x00\x00\x53\x55\x56\x8B\x71\x14\x85\xF6" + "linux" "@_ZN17CBaseEntityOutput10FireOutputE9variant_tP11CBaseEntityS2_f" + } + } + } } diff --git a/gamedata/sdktools.games.txt b/gamedata/sdktools.games.txt index cd53d356..d5d9c74a 100644 --- a/gamedata/sdktools.games.txt +++ b/gamedata/sdktools.games.txt @@ -332,6 +332,11 @@ "windows" "25" "linux" "26" } + "WeaponEquip" + { + "windows" "217" + "linux" "218" + } } } @@ -1693,5 +1698,22 @@ } } } + /* CBaseEntityOutput::FireOutput */ + "#default" + { + "#supported" + { + "game" "cstrike" + } + "Signatures" + { + "FireEvent" + { + "library" "server" + "windows" "\x81\xEC\x1C\x03\x00\x00\x53\x55\x56\x8B\x71\x14" + "linux" "@_ZN17CBaseEntityOutput10FireOutputE9variant_tP11CBaseEntityS2_f" + } + } + } } diff --git a/plugins/include/sdktools_functions.inc b/plugins/include/sdktools_functions.inc index d4e6a892..aef9357b 100644 --- a/plugins/include/sdktools_functions.inc +++ b/plugins/include/sdktools_functions.inc @@ -283,3 +283,15 @@ native bool:GetPlayerDecalFile(client, String:hex[], maxlength); * @noreturn */ native GetServerNetStats(&Float:in, &Float:out); + + +/** + * Equip's a player's weapon. + * + * @param client Client index. + * @param item CBaseCombatWeapon entity index. + * @noreturn + * @error Invalid client or entity, lack of mod support, or client not in + * game. + */ +native EquipPlayerWeapon(client, weapon);