From a76f3eba97cf4696ac4bba97057fb1f52273896f Mon Sep 17 00:00:00 2001 From: David Anderson <dvander@alliedmods.net> Date: Mon, 18 Jun 2007 17:02:42 +0000 Subject: [PATCH] A few sdktools functions now accept all entities and the Player versions are deprecated --HG-- extra : convert_revision : svn%3A39bc706e-5318-0410-9160-8a85361fbb7c/trunk%40986 --- extensions/sdktools/vnatives.cpp | 10 ++++-- plugins/include/sdktools_functions.inc | 46 ++++++++++++++++++++------ 2 files changed, 42 insertions(+), 14 deletions(-) diff --git a/extensions/sdktools/vnatives.cpp b/extensions/sdktools/vnatives.cpp index 318ec264..062f0ae5 100644 --- a/extensions/sdktools/vnatives.cpp +++ b/extensions/sdktools/vnatives.cpp @@ -183,7 +183,7 @@ static cell_t IgnitePlayer(IPluginContext *pContext, const cell_t *params) 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)) + if (!CreateBaseCall("Ignite", ValveCall_Entity, NULL, pass, 4, &pCall)) { return pContext->ThrowNativeError("\"Ignite\" not supported by this mod"); } else if (!pCall) { @@ -207,7 +207,7 @@ 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)) + if (!CreateBaseCall("Extinguish", ValveCall_Entity, NULL, NULL, 0, &pCall)) { return pContext->ThrowNativeError("\"Extinguish\" not supported by this mod"); } else if (!pCall) { @@ -231,7 +231,7 @@ static cell_t TeleportPlayer(IPluginContext *pContext, const cell_t *params) 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)) + if (!CreateBaseCall("Teleport", ValveCall_Entity, NULL, pass, 3, &pCall)) { return pContext->ThrowNativeError("\"Teleport\" not supported by this mod"); } else if (!pCall) { @@ -252,10 +252,14 @@ static cell_t TeleportPlayer(IPluginContext *pContext, const cell_t *params) sp_nativeinfo_t g_Natives[] = { {"ExtinguishPlayer", ExtinguishPlayer}, + {"ExtinguishEntity", ExtinguishPlayer}, {"GivePlayerItem", GiveNamedItem}, {"GetPlayerWeaponSlot", GetPlayerWeaponSlot}, {"IgnitePlayer", IgnitePlayer}, + {"IgniteEntity", IgnitePlayer}, {"RemovePlayerItem", RemovePlayerItem}, {"TeleportPlayer", TeleportPlayer}, + {"TeleportEntity", TeleportPlayer}, {NULL, NULL}, }; + diff --git a/plugins/include/sdktools_functions.inc b/plugins/include/sdktools_functions.inc index 0707cc02..1dae0672 100644 --- a/plugins/include/sdktools_functions.inc +++ b/plugins/include/sdktools_functions.inc @@ -51,35 +51,59 @@ native GivePlayerItem(client, const String:item[], iSubType=0); native GetPlayerWeaponSlot(client, slot); /** - * Ignites a player on fire. + * Ignites an entity on fire. * - * @param client Client index. + * @param entity Entity 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. + * @error Invalid entity 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); +native IgniteEntity(entity, Float:time, bool:npc=false, Float:size=0.0, bool:level=false); /** * Extinguishes a player that is on fire. * - * @param client Client index. + * @param entity Entity index. * @noreturn - * @error Invalid client or client not in game, or lack of mod support. + * @error Invalid entity or client not in game, or lack of mod support. */ -native ExtinguishPlayer(client); +native ExtinguishEntity(client); /** - * Teleports a player. + * Teleports an entity. * - * @param client Client index. + * @param entity 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. + * @error Invalid entity 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]); +native TeleportEntity(entity, const Float:origin[3], const Float:angles[3], const Float:velocity[3]); + +/** + * @deprecated + */ +stock IgnitePlayer(client, Float:time, bool:npc=false, Float:size=0.0, bool:level=false) +{ + return IgniteEntity(client, time, npc, size, level); +} + +/** + * @deprecated + */ +stock ExtinguishClient(client) +{ + return ExtinguishEntity(client); +} + +/** + * @deprecated + */ +stock TeleportPlayer(client, const Float:origin[3], const Float:angles[3], const Float:velocity[3]) +{ + return TeleportEntity(client, origin, angles, velocity); +}