diff --git a/extensions/sdktools/vnatives.cpp b/extensions/sdktools/vnatives.cpp index 3c6d1b4b..318ec264 100644 --- a/extensions/sdktools/vnatives.cpp +++ b/extensions/sdktools/vnatives.cpp @@ -173,10 +173,89 @@ static cell_t GetPlayerWeaponSlot(IPluginContext *pContext, const cell_t *params return engine->IndexOfEdict(pEdict); } +static cell_t IgnitePlayer(IPluginContext *pContext, const cell_t *params) +{ + static ValveCall *pCall = NULL; + if (!pCall) + { + ValvePassInfo pass[4]; + InitPass(pass[0], Valve_Float, PassType_Float, PASSFLAG_BYVAL); + InitPass(pass[1], Valve_Bool, PassType_Basic, PASSFLAG_BYVAL); + InitPass(pass[2], Valve_Float, PassType_Float, PASSFLAG_BYVAL); + InitPass(pass[3], Valve_Bool, PassType_Basic, PASSFLAG_BYVAL); + if (!CreateBaseCall("Ignite", ValveCall_Player, NULL, pass, 4, &pCall)) + { + return pContext->ThrowNativeError("\"Ignite\" not supported by this mod"); + } else if (!pCall) { + return pContext->ThrowNativeError("\"Ignite\" wrapper failed to initialized"); + } + } + + START_CALL(); + DECODE_VALVE_PARAM(1, thisinfo, 0); + DECODE_VALVE_PARAM(2, vparams, 0); + DECODE_VALVE_PARAM(3, vparams, 1); + DECODE_VALVE_PARAM(4, vparams, 2); + DECODE_VALVE_PARAM(5, vparams, 3); + FINISH_CALL_SIMPLE(NULL); + + return 1; +} + +static cell_t ExtinguishPlayer(IPluginContext *pContext, const cell_t *params) +{ + static ValveCall *pCall = NULL; + if (!pCall) + { + if (!CreateBaseCall("Extinguish", ValveCall_Player, NULL, NULL, 0, &pCall)) + { + return pContext->ThrowNativeError("\"Extinguish\" not supported by this mod"); + } else if (!pCall) { + return pContext->ThrowNativeError("\"Extinguish\" wrapper failed to initialized"); + } + } + + START_CALL(); + DECODE_VALVE_PARAM(1, thisinfo, 0); + FINISH_CALL_SIMPLE(NULL); + + return 1; +} + +static cell_t TeleportPlayer(IPluginContext *pContext, const cell_t *params) +{ + static ValveCall *pCall = NULL; + if (!pCall) + { + ValvePassInfo pass[3]; + InitPass(pass[0], Valve_Vector, PassType_Basic, PASSFLAG_BYVAL); + InitPass(pass[1], Valve_QAngle, PassType_Basic, PASSFLAG_BYVAL); + InitPass(pass[2], Valve_Vector, PassType_Basic, PASSFLAG_BYVAL); + if (!CreateBaseCall("Teleport", ValveCall_Player, NULL, pass, 3, &pCall)) + { + return pContext->ThrowNativeError("\"Teleport\" not supported by this mod"); + } else if (!pCall) { + return pContext->ThrowNativeError("\"Teleport\" wrapper failed to initialized"); + } + } + + START_CALL(); + DECODE_VALVE_PARAM(1, thisinfo, 0); + DECODE_VALVE_PARAM(2, vparams, 0); + DECODE_VALVE_PARAM(3, vparams, 1); + DECODE_VALVE_PARAM(4, vparams, 2); + FINISH_CALL_SIMPLE(NULL); + + return 1; +} + sp_nativeinfo_t g_Natives[] = { - {"RemovePlayerItem", RemovePlayerItem}, + {"ExtinguishPlayer", ExtinguishPlayer}, {"GivePlayerItem", GiveNamedItem}, {"GetPlayerWeaponSlot", GetPlayerWeaponSlot}, + {"IgnitePlayer", IgnitePlayer}, + {"RemovePlayerItem", RemovePlayerItem}, + {"TeleportPlayer", TeleportPlayer}, {NULL, NULL}, }; diff --git a/gamedata/sdktools.games.txt b/gamedata/sdktools.games.txt index 52fcc011..0837b14c 100644 --- a/gamedata/sdktools.games.txt +++ b/gamedata/sdktools.games.txt @@ -24,6 +24,21 @@ "windows" "224" "linux" "225" } + "Ignite" + { + "windows" "188" + "linux" "189" + } + "Extinguish" + { + "windows" "189" + "linux" "190" + } + "Teleport" + { + "windows" "98" + "linux" "99" + } } } } diff --git a/plugins/include/sdktools.inc b/plugins/include/sdktools.inc index 78a964d5..988ea505 100644 --- a/plugins/include/sdktools.inc +++ b/plugins/include/sdktools.inc @@ -50,6 +50,7 @@ enum SDKType SDKType_Float, /**< Float (any) */ SDKType_Edict, /**< edict_t (always as pointer) */ SDKType_String, /**< NULL-terminated string (always as pointer) */ + SDKType_Bool, /**< Boolean (any) */ }; enum SDKPassMethod diff --git a/plugins/include/sdktools_functions.inc b/plugins/include/sdktools_functions.inc index 1ecdcf3e..0707cc02 100644 --- a/plugins/include/sdktools_functions.inc +++ b/plugins/include/sdktools_functions.inc @@ -46,6 +46,40 @@ native GivePlayerItem(client, const String:item[], iSubType=0); * @param client Client index. * @param slot Slot index (mod specific). * @return Entity index on success, -1 if no weapon existed. - * @error Invalid client or client notin game, or lack of mod support. + * @error Invalid client or client not in game, or lack of mod support. */ -native GetPlayerWeaponSlot(client, slot); \ No newline at end of file +native GetPlayerWeaponSlot(client, slot); + +/** + * Ignites a player on fire. + * + * @param client Client index. + * @param time Number of seconds to set on fire. + * @param npc True to only affect NPCs. + * @param size Unknown. + * @param level Unknown. + * @noreturn + * @error Invalid client or client not in game, or lack of mod support. + */ +native IgnitePlayer(client, Float:time, bool:npc=false, Float:size=0.0, bool:level=false); + +/** + * Extinguishes a player that is on fire. + * + * @param client Client index. + * @noreturn + * @error Invalid client or client not in game, or lack of mod support. + */ +native ExtinguishPlayer(client); + +/** + * Teleports a player. + * + * @param client Client index. + * @param origin New origin, or NULL_VECTOR for no change. + * @param angles New angles, or NULL_VECTOR for no change. + * @param velocity New velocity, or NULL_VECTOR for no change. + * @noreturn + * @error Invalid client or client not in game, or lack of mod support. + */ +native TeleportPlayer(client, const Float:origin[3], const Float:angles[3], const Float:velocity[3]);