added a few more natives

--HG--
extra : convert_revision : svn%3A39bc706e-5318-0410-9160-8a85361fbb7c/trunk%40961
This commit is contained in:
David Anderson 2007-06-16 18:27:23 +00:00
parent 11ff381289
commit 0b9447d986
4 changed files with 132 additions and 3 deletions

View File

@ -173,10 +173,89 @@ static cell_t GetPlayerWeaponSlot(IPluginContext *pContext, const cell_t *params
return engine->IndexOfEdict(pEdict); 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[] = sp_nativeinfo_t g_Natives[] =
{ {
{"RemovePlayerItem", RemovePlayerItem}, {"ExtinguishPlayer", ExtinguishPlayer},
{"GivePlayerItem", GiveNamedItem}, {"GivePlayerItem", GiveNamedItem},
{"GetPlayerWeaponSlot", GetPlayerWeaponSlot}, {"GetPlayerWeaponSlot", GetPlayerWeaponSlot},
{"IgnitePlayer", IgnitePlayer},
{"RemovePlayerItem", RemovePlayerItem},
{"TeleportPlayer", TeleportPlayer},
{NULL, NULL}, {NULL, NULL},
}; };

View File

@ -24,6 +24,21 @@
"windows" "224" "windows" "224"
"linux" "225" "linux" "225"
} }
"Ignite"
{
"windows" "188"
"linux" "189"
}
"Extinguish"
{
"windows" "189"
"linux" "190"
}
"Teleport"
{
"windows" "98"
"linux" "99"
}
} }
} }
} }

View File

@ -50,6 +50,7 @@ enum SDKType
SDKType_Float, /**< Float (any) */ SDKType_Float, /**< Float (any) */
SDKType_Edict, /**< edict_t (always as pointer) */ SDKType_Edict, /**< edict_t (always as pointer) */
SDKType_String, /**< NULL-terminated string (always as pointer) */ SDKType_String, /**< NULL-terminated string (always as pointer) */
SDKType_Bool, /**< Boolean (any) */
}; };
enum SDKPassMethod enum SDKPassMethod

View File

@ -46,6 +46,40 @@ native GivePlayerItem(client, const String:item[], iSubType=0);
* @param client Client index. * @param client Client index.
* @param slot Slot index (mod specific). * @param slot Slot index (mod specific).
* @return Entity index on success, -1 if no weapon existed. * @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); 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]);