2014-07-30 11:03:42 +02:00
|
|
|
/**
|
|
|
|
* vim: set ts=4 :
|
|
|
|
* =============================================================================
|
|
|
|
* SourceMod (C)2009-2013 AlliedModders LLC. All rights reserved.
|
|
|
|
* =============================================================================
|
|
|
|
*
|
|
|
|
* This file is part of the SourceMod/SourcePawn SDK.
|
|
|
|
*
|
|
|
|
* This program is free software; you can redistribute it and/or modify it under
|
|
|
|
* the terms of the GNU General Public License, version 3.0, as published by the
|
|
|
|
* Free Software Foundation.
|
2019-09-27 13:14:44 +02:00
|
|
|
*
|
2014-07-30 11:03:42 +02:00
|
|
|
* This program is distributed in the hope that it will be useful, but WITHOUT
|
|
|
|
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
|
|
|
|
* FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
|
|
|
|
* details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU General Public License along with
|
|
|
|
* this program. If not, see <http://www.gnu.org/licenses/>.
|
|
|
|
*
|
|
|
|
* As a special exception, AlliedModders LLC gives you permission to link the
|
|
|
|
* code of this program (as well as its derivative works) to "Half-Life 2," the
|
|
|
|
* "Source Engine," the "SourcePawn JIT," and any Game MODs that run on software
|
|
|
|
* by the Valve Corporation. You must obey the GNU General Public License in
|
|
|
|
* all respects for all other code used. Additionally, AlliedModders LLC grants
|
|
|
|
* this exception to all derivative works. AlliedModders LLC defines further
|
|
|
|
* exceptions, found in LICENSE.txt (as of this writing, version JULY-31-2007),
|
|
|
|
* or <http://www.sourcemod.net/license.php>.
|
|
|
|
*/
|
|
|
|
|
2009-11-04 21:37:26 +01:00
|
|
|
#if defined _sdkhooks_included
|
|
|
|
#endinput
|
|
|
|
#endif
|
|
|
|
#define _sdkhooks_included
|
|
|
|
|
2014-07-30 11:03:42 +02:00
|
|
|
// this is obviously _not_ a robust check, but it will solve most conflict and is clean
|
|
|
|
#if !defined DMG_GENERIC
|
2019-09-27 13:14:44 +02:00
|
|
|
#define DMG_GENERIC 0 /**< generic damage was done */
|
|
|
|
#define DMG_CRUSH (1 << 0) /**< crushed by falling or moving object.
|
|
|
|
NOTE: It's assumed crush damage is occurring as a result of physics collision,
|
|
|
|
so no extra physics force is generated by crush damage.
|
|
|
|
DON'T use DMG_CRUSH when damaging entities unless it's the result of a physics
|
|
|
|
collision. You probably want DMG_CLUB instead. */
|
|
|
|
#define DMG_BULLET (1 << 1) /**< shot */
|
|
|
|
#define DMG_SLASH (1 << 2) /**< cut, clawed, stabbed */
|
|
|
|
#define DMG_BURN (1 << 3) /**< heat burned */
|
|
|
|
#define DMG_VEHICLE (1 << 4) /**< hit by a vehicle */
|
|
|
|
#define DMG_FALL (1 << 5) /**< fell too far */
|
|
|
|
#define DMG_BLAST (1 << 6) /**< explosive blast damage */
|
|
|
|
#define DMG_CLUB (1 << 7) /**< crowbar, punch, headbutt */
|
|
|
|
#define DMG_SHOCK (1 << 8) /**< electric shock */
|
|
|
|
#define DMG_SONIC (1 << 9) /**< sound pulse shockwave */
|
|
|
|
#define DMG_ENERGYBEAM (1 << 10) /**< laser or other high energy beam */
|
|
|
|
#define DMG_PREVENT_PHYSICS_FORCE (1 << 11) /**< Prevent a physics force */
|
|
|
|
#define DMG_NEVERGIB (1 << 12) /**< with this bit OR'd in, no damage type will be able to gib victims upon death */
|
|
|
|
#define DMG_ALWAYSGIB (1 << 13) /**< with this bit OR'd in, any damage type can be made to gib victims upon death. */
|
|
|
|
#define DMG_DROWN (1 << 14) /**< Drowning */
|
|
|
|
#define DMG_PARALYZE (1 << 15) /**< slows affected creature down */
|
|
|
|
#define DMG_NERVEGAS (1 << 16) /**< nerve toxins, very bad */
|
|
|
|
#define DMG_POISON (1 << 17) /**< blood poisoning - heals over time like drowning damage */
|
|
|
|
#define DMG_RADIATION (1 << 18) /**< radiation exposure */
|
|
|
|
#define DMG_DROWNRECOVER (1 << 19) /**< drowning recovery */
|
|
|
|
#define DMG_ACID (1 << 20) /**< toxic chemicals or acid burns */
|
|
|
|
#define DMG_SLOWBURN (1 << 21) /**< in an oven */
|
|
|
|
#define DMG_REMOVENORAGDOLL (1 << 22) /**< with this bit OR'd in, no ragdoll will be created, and the target will be quietly removed.
|
|
|
|
use this to kill an entity that you've already got a server-side ragdoll for */
|
|
|
|
#define DMG_PHYSGUN (1 << 23) /**< Hit by manipulator. Usually doesn't do any damage. */
|
|
|
|
#define DMG_PLASMA (1 << 24) /**< Shot by Cremator */
|
|
|
|
#define DMG_AIRBOAT (1 << 25) /**< Hit by the airboat's gun */
|
|
|
|
#define DMG_DISSOLVE (1 << 26) /**< Dissolving! */
|
|
|
|
#define DMG_BLAST_SURFACE (1 << 27) /**< A blast on the surface of water that cannot harm things underwater */
|
|
|
|
#define DMG_DIRECT (1 << 28)
|
|
|
|
#define DMG_BUCKSHOT (1 << 29) /**< not quite a bullet. Little, rounder, different. */
|
2014-07-30 11:03:42 +02:00
|
|
|
#endif
|
2009-11-04 21:37:26 +01:00
|
|
|
|
2014-07-30 11:03:42 +02:00
|
|
|
#if !defined DMG_CRIT
|
2019-09-27 13:14:44 +02:00
|
|
|
#define DMG_CRIT DMG_ACID /**< TF2 crits and minicrits */
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#if !defined DMG_RADIUS_MAX
|
|
|
|
#define DMG_RADIUS_MAX DMG_ENERGYBEAM /**< No damage falloff */
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#if !defined DMG_NOCLOSEDISTANCEMOD
|
|
|
|
#define DMG_NOCLOSEDISTANCEMOD DMG_POISON /**< Don't do damage falloff too close */
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#if !defined DMG_HALF_FALLOFF
|
|
|
|
#define DMG_HALF_FALLOFF DMG_RADIATION /**< 50% damage falloff */
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#if !defined DMG_USEDISTANCEMOD
|
|
|
|
#define DMG_USEDISTANCEMOD DMG_SLOWBURN /**< Do damage falloff */
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#if !defined DMG_IGNITE
|
|
|
|
#define DMG_IGNITE DMG_PLASMA /**< Ignite victim */
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#if !defined DMG_USE_HITLOCATIONS
|
|
|
|
#define DMG_USE_HITLOCATIONS DMG_AIRBOAT /**< Do hit location damage (Like the sniperrifle and ambassador) */
|
2014-07-30 11:03:42 +02:00
|
|
|
#endif
|
2009-11-04 21:37:26 +01:00
|
|
|
|
|
|
|
enum SDKHookType
|
|
|
|
{
|
|
|
|
SDKHook_EndTouch,
|
|
|
|
SDKHook_FireBulletsPost,
|
|
|
|
SDKHook_OnTakeDamage,
|
|
|
|
SDKHook_OnTakeDamagePost,
|
|
|
|
SDKHook_PreThink,
|
|
|
|
SDKHook_PostThink,
|
|
|
|
SDKHook_SetTransmit,
|
|
|
|
SDKHook_Spawn,
|
|
|
|
SDKHook_StartTouch,
|
|
|
|
SDKHook_Think,
|
|
|
|
SDKHook_Touch,
|
|
|
|
SDKHook_TraceAttack,
|
|
|
|
SDKHook_TraceAttackPost,
|
2010-01-25 11:07:39 +01:00
|
|
|
SDKHook_WeaponCanSwitchTo,
|
2009-12-02 18:42:57 +01:00
|
|
|
SDKHook_WeaponCanUse,
|
2009-11-04 21:37:26 +01:00
|
|
|
SDKHook_WeaponDrop,
|
|
|
|
SDKHook_WeaponEquip,
|
2010-07-04 17:58:27 +02:00
|
|
|
SDKHook_WeaponSwitch,
|
|
|
|
SDKHook_ShouldCollide,
|
|
|
|
SDKHook_PreThinkPost,
|
|
|
|
SDKHook_PostThinkPost,
|
2014-07-30 11:03:42 +02:00
|
|
|
SDKHook_ThinkPost,
|
|
|
|
SDKHook_EndTouchPost,
|
|
|
|
SDKHook_GroundEntChangedPost,
|
|
|
|
SDKHook_SpawnPost,
|
|
|
|
SDKHook_StartTouchPost,
|
|
|
|
SDKHook_TouchPost,
|
|
|
|
SDKHook_VPhysicsUpdate,
|
|
|
|
SDKHook_VPhysicsUpdatePost,
|
|
|
|
SDKHook_WeaponCanSwitchToPost,
|
|
|
|
SDKHook_WeaponCanUsePost,
|
|
|
|
SDKHook_WeaponDropPost,
|
|
|
|
SDKHook_WeaponEquipPost,
|
|
|
|
SDKHook_WeaponSwitchPost,
|
|
|
|
SDKHook_Use,
|
|
|
|
SDKHook_UsePost,
|
|
|
|
SDKHook_Reload,
|
|
|
|
SDKHook_ReloadPost,
|
|
|
|
SDKHook_GetMaxHealth, /**< ep2v and later */
|
2015-03-21 15:43:24 +01:00
|
|
|
SDKHook_Blocked,
|
|
|
|
SDKHook_BlockedPost,
|
|
|
|
SDKHook_OnTakeDamageAlive,
|
|
|
|
SDKHook_OnTakeDamageAlivePost,
|
2019-09-27 13:14:44 +02:00
|
|
|
SDKHook_CanBeAutobalanced
|
2010-07-04 17:58:27 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
/*
|
|
|
|
Alphabetized for easy readability
|
2015-03-21 15:43:24 +01:00
|
|
|
|
|
|
|
SDKHook_Blocked,
|
|
|
|
SDKHook_BlockedPost,
|
2019-09-27 13:14:44 +02:00
|
|
|
|
2016-08-23 15:34:00 +02:00
|
|
|
SDKHook_CanBeAutobalanced,
|
2019-09-27 13:14:44 +02:00
|
|
|
|
2014-07-30 11:03:42 +02:00
|
|
|
SDKHook_EndTouch,
|
|
|
|
SDKHook_EndTouchPost,
|
2019-09-27 13:14:44 +02:00
|
|
|
|
2014-07-30 11:03:42 +02:00
|
|
|
SDKHook_FireBulletsPost,
|
2019-09-27 13:14:44 +02:00
|
|
|
|
2014-07-30 11:03:42 +02:00
|
|
|
SDKHook_GetMaxHealth, (ep2v and later)
|
2019-09-27 13:14:44 +02:00
|
|
|
|
2014-07-30 11:03:42 +02:00
|
|
|
SDKHook_GroundEntChangedPost,
|
2019-09-27 13:14:44 +02:00
|
|
|
|
2014-07-30 11:03:42 +02:00
|
|
|
SDKHook_OnTakeDamage,
|
|
|
|
SDKHook_OnTakeDamagePost,
|
2019-09-27 13:14:44 +02:00
|
|
|
|
2015-03-21 15:43:24 +01:00
|
|
|
SDKHook_OnTakeDamageAlive,
|
|
|
|
SDKHook_OnTakeDamageAlivePost,
|
2019-09-27 13:14:44 +02:00
|
|
|
|
2014-07-30 11:03:42 +02:00
|
|
|
SDKHook_PreThink,
|
|
|
|
SDKHook_PreThinkPost,
|
2019-09-27 13:14:44 +02:00
|
|
|
|
2014-07-30 11:03:42 +02:00
|
|
|
SDKHook_PostThink,
|
|
|
|
SDKHook_PostThinkPost,
|
2019-09-27 13:14:44 +02:00
|
|
|
|
2014-07-30 11:03:42 +02:00
|
|
|
SDKHook_Reload,
|
|
|
|
SDKHook_ReloadPost,
|
2019-09-27 13:14:44 +02:00
|
|
|
|
2014-07-30 11:03:42 +02:00
|
|
|
SDKHook_SetTransmit,
|
2019-09-27 13:14:44 +02:00
|
|
|
|
2014-07-30 11:03:42 +02:00
|
|
|
SDKHook_ShouldCollide,
|
2019-09-27 13:14:44 +02:00
|
|
|
|
2014-07-30 11:03:42 +02:00
|
|
|
SDKHook_Spawn,
|
|
|
|
SDKHook_SpawnPost,
|
2019-09-27 13:14:44 +02:00
|
|
|
|
2014-07-30 11:03:42 +02:00
|
|
|
SDKHook_StartTouch,
|
|
|
|
SDKHook_StartTouchPost,
|
2019-09-27 13:14:44 +02:00
|
|
|
|
2014-07-30 11:03:42 +02:00
|
|
|
SDKHook_Think,
|
|
|
|
SDKHook_ThinkPost,
|
2019-09-27 13:14:44 +02:00
|
|
|
|
2014-07-30 11:03:42 +02:00
|
|
|
SDKHook_Touch,
|
|
|
|
SDKHook_TouchPost,
|
2019-09-27 13:14:44 +02:00
|
|
|
|
2014-07-30 11:03:42 +02:00
|
|
|
SDKHook_TraceAttack,
|
|
|
|
SDKHook_TraceAttackPost,
|
2019-09-27 13:14:44 +02:00
|
|
|
|
2014-07-30 11:03:42 +02:00
|
|
|
SDKHook_Use,
|
|
|
|
SDKHook_UsePost,
|
2019-09-27 13:14:44 +02:00
|
|
|
|
2014-07-30 11:03:42 +02:00
|
|
|
SDKHook_VPhysicsUpdate,
|
|
|
|
SDKHook_VPhysicsUpdatePost,
|
2019-09-27 13:14:44 +02:00
|
|
|
|
2014-07-30 11:03:42 +02:00
|
|
|
SDKHook_WeaponCanSwitchTo,
|
|
|
|
SDKHook_WeaponCanSwitchToPost,
|
2019-09-27 13:14:44 +02:00
|
|
|
|
2014-07-30 11:03:42 +02:00
|
|
|
SDKHook_WeaponCanUse,
|
|
|
|
SDKHook_WeaponCanUsePost,
|
2019-09-27 13:14:44 +02:00
|
|
|
|
2014-07-30 11:03:42 +02:00
|
|
|
SDKHook_WeaponDrop,
|
|
|
|
SDKHook_WeaponDropPost,
|
2019-09-27 13:14:44 +02:00
|
|
|
|
2014-07-30 11:03:42 +02:00
|
|
|
SDKHook_WeaponEquip,
|
|
|
|
SDKHook_WeaponEquipPost,
|
2019-09-27 13:14:44 +02:00
|
|
|
|
2014-07-30 11:03:42 +02:00
|
|
|
SDKHook_WeaponSwitch,
|
|
|
|
SDKHook_WeaponSwitchPost
|
2010-07-04 17:58:27 +02:00
|
|
|
*/
|
2009-11-04 21:37:26 +01:00
|
|
|
|
2014-07-30 11:03:42 +02:00
|
|
|
enum UseType
|
|
|
|
{
|
|
|
|
Use_Off,
|
|
|
|
Use_On,
|
|
|
|
Use_Set,
|
|
|
|
Use_Toggle
|
|
|
|
};
|
|
|
|
|
2015-03-21 15:43:24 +01:00
|
|
|
typeset SDKHookCB
|
2009-11-04 21:37:26 +01:00
|
|
|
{
|
2010-07-04 17:58:27 +02:00
|
|
|
// PreThink/Post
|
|
|
|
// PostThink/Post
|
2015-03-21 15:43:24 +01:00
|
|
|
function void (int client);
|
2019-09-27 13:14:44 +02:00
|
|
|
|
2009-11-04 21:37:26 +01:00
|
|
|
// Spawn
|
2015-03-21 15:43:24 +01:00
|
|
|
function Action (int entity);
|
2019-09-27 13:14:44 +02:00
|
|
|
|
2014-07-30 11:03:42 +02:00
|
|
|
// GroundEntChanged
|
|
|
|
// SpawnPost
|
2010-07-04 17:58:27 +02:00
|
|
|
// Think/Post
|
2014-07-30 11:03:42 +02:00
|
|
|
// VPhysicsUpdate/Post
|
2015-03-21 15:43:24 +01:00
|
|
|
function void (int entity);
|
2019-09-27 13:14:44 +02:00
|
|
|
|
2009-11-04 21:37:26 +01:00
|
|
|
// EndTouch
|
|
|
|
// StartTouch
|
|
|
|
// Touch
|
2015-03-21 15:43:24 +01:00
|
|
|
// Blocked
|
|
|
|
function Action (int entity, int other);
|
2019-09-27 13:14:44 +02:00
|
|
|
|
2014-07-30 11:03:42 +02:00
|
|
|
// EndTouchPost
|
|
|
|
// StartTouchPost
|
|
|
|
// TouchPost
|
2015-03-21 15:43:24 +01:00
|
|
|
function void (int entity, int other);
|
2019-09-27 13:14:44 +02:00
|
|
|
|
2009-11-04 21:37:26 +01:00
|
|
|
// SetTransmit
|
2015-03-21 15:43:24 +01:00
|
|
|
function Action (int entity, int client);
|
2019-09-27 13:14:44 +02:00
|
|
|
|
2010-01-25 11:07:39 +01:00
|
|
|
// WeaponCanSwitchTo
|
2009-12-02 18:42:57 +01:00
|
|
|
// WeaponCanUse
|
2009-11-04 21:37:26 +01:00
|
|
|
// WeaponDrop
|
|
|
|
// WeaponEquip
|
|
|
|
// WeaponSwitch
|
2015-03-21 15:43:24 +01:00
|
|
|
function Action (int client, int weapon);
|
2019-09-27 13:14:44 +02:00
|
|
|
|
2014-07-30 11:03:42 +02:00
|
|
|
// WeaponCanSwitchToPost
|
|
|
|
// WeaponCanUsePost
|
|
|
|
// WeaponDropPost
|
|
|
|
// WeaponEquipPost
|
|
|
|
// WeaponSwitchPost
|
2015-03-21 15:43:24 +01:00
|
|
|
function void (int client, int weapon);
|
2019-09-27 13:14:44 +02:00
|
|
|
|
2014-07-30 11:03:42 +02:00
|
|
|
// GetMaxHealth (ep2v and later)
|
2015-03-21 15:43:24 +01:00
|
|
|
function Action (int entity, int &maxhealth);
|
2019-09-27 13:14:44 +02:00
|
|
|
|
2009-11-04 21:37:26 +01:00
|
|
|
// OnTakeDamage
|
2015-03-21 15:43:24 +01:00
|
|
|
// OnTakeDamageAlive
|
2014-07-30 11:03:42 +02:00
|
|
|
// Note: The weapon parameter is not used by all games and damage sources.
|
|
|
|
// Note: Force application is dependent on game and damage type(s)
|
|
|
|
// SDKHooks 1.0+
|
2015-03-21 15:43:24 +01:00
|
|
|
function Action (int victim, int &attacker, int &inflictor, float &damage, int &damagetype);
|
2014-07-30 11:03:42 +02:00
|
|
|
// SDKHooks 2.0+
|
2015-03-21 15:43:24 +01:00
|
|
|
function Action (int victim, int &attacker, int &inflictor, float &damage, int &damagetype, int &weapon, float damageForce[3], float damagePosition[3]);
|
2014-07-30 11:03:42 +02:00
|
|
|
// SDKHooks 2.1+ (can check for support at runtime using GetFeatureStatus on SDKHook_DmgCustomInOTD capability.
|
|
|
|
// DON'T attempt to access 'damagecustom' var if feature status != available
|
2015-03-21 15:43:24 +01:00
|
|
|
function Action (int victim, int &attacker, int &inflictor, float &damage, int &damagetype, int &weapon,
|
|
|
|
float damageForce[3], float damagePosition[3], int damagecustom);
|
2019-09-27 13:14:44 +02:00
|
|
|
|
2009-11-04 21:37:26 +01:00
|
|
|
// OnTakeDamagePost
|
2015-03-21 15:43:24 +01:00
|
|
|
// OnTakeDamageAlivePost
|
|
|
|
function void (int victim, int attacker, int inflictor, float damage, int damagetype);
|
|
|
|
function void (int victim, int attacker, int inflictor, float damage, int damagetype, int weapon, const float damageForce[3], const float damagePosition[3]);
|
2019-09-27 13:14:44 +02:00
|
|
|
function void (int victim, int attacker, int inflictor, float damage, int damagetype, int weapon,
|
2015-03-21 15:43:24 +01:00
|
|
|
const float damageForce[3], const float damagePosition[3], int damagecustom);
|
2019-09-27 13:14:44 +02:00
|
|
|
|
2014-07-30 11:03:42 +02:00
|
|
|
// FireBulletsPost
|
2015-03-21 15:43:24 +01:00
|
|
|
function void (int client, int shots, const char[] weaponname);
|
2019-09-27 13:14:44 +02:00
|
|
|
|
2009-11-04 21:37:26 +01:00
|
|
|
// TraceAttack
|
2015-03-21 15:43:24 +01:00
|
|
|
function Action (int victim, int &attacker, int &inflictor, float &damage, int &damagetype, int &ammotype, int hitbox, int hitgroup);
|
2019-09-27 13:14:44 +02:00
|
|
|
|
2009-11-04 21:37:26 +01:00
|
|
|
// TraceAttackPost
|
2015-03-21 15:43:24 +01:00
|
|
|
function void (int victim, int attacker, int inflictor, float damage, int damagetype, int ammotype, int hitbox, int hitgroup);
|
2019-09-27 13:14:44 +02:00
|
|
|
|
2010-07-04 17:58:27 +02:00
|
|
|
// ShouldCollide
|
2015-03-21 15:43:24 +01:00
|
|
|
function bool (int entity, int collisiongroup, int contentsmask, bool originalResult);
|
2019-09-27 13:14:44 +02:00
|
|
|
|
2014-07-30 11:03:42 +02:00
|
|
|
// Use
|
2015-03-21 15:43:24 +01:00
|
|
|
function Action (int entity, int activator, int caller, UseType type, float value);
|
2019-09-27 13:14:44 +02:00
|
|
|
|
2014-07-30 11:03:42 +02:00
|
|
|
// UsePost
|
2015-03-21 15:43:24 +01:00
|
|
|
function void (int entity, int activator, int caller, UseType type, float value);
|
2019-09-27 13:14:44 +02:00
|
|
|
|
2014-07-30 11:03:42 +02:00
|
|
|
// Reload
|
2015-03-21 15:43:24 +01:00
|
|
|
function Action (int weapon);
|
2019-09-27 13:14:44 +02:00
|
|
|
|
2014-07-30 11:03:42 +02:00
|
|
|
// Reload post
|
2015-03-21 15:43:24 +01:00
|
|
|
function void (int weapon, bool bSuccessful);
|
2019-09-27 13:14:44 +02:00
|
|
|
|
2016-08-23 15:34:00 +02:00
|
|
|
// CanBeAutobalanced
|
|
|
|
function bool (int client, bool origRet);
|
2010-07-04 17:58:27 +02:00
|
|
|
};
|
2009-11-04 21:37:26 +01:00
|
|
|
|
|
|
|
|
|
|
|
/**
|
2019-09-27 13:14:44 +02:00
|
|
|
* When an entity is created
|
2009-11-04 21:37:26 +01:00
|
|
|
*
|
2019-09-27 13:14:44 +02:00
|
|
|
* @param entity Entity index
|
|
|
|
* @param classname Class name
|
2009-11-04 21:37:26 +01:00
|
|
|
*/
|
2016-08-23 15:34:00 +02:00
|
|
|
forward void OnEntityCreated(int entity, const char[] classname);
|
2009-11-04 21:37:26 +01:00
|
|
|
|
|
|
|
/**
|
2019-09-27 13:14:44 +02:00
|
|
|
* When an entity is spawned
|
|
|
|
*
|
|
|
|
* @param entity Entity index
|
|
|
|
* @param classname Class name
|
|
|
|
*/
|
|
|
|
forward void OnEntitySpawned(int entity, const char[] classname);
|
|
|
|
|
|
|
|
/**
|
|
|
|
* When an entity is destroyed
|
2009-11-04 21:37:26 +01:00
|
|
|
*
|
2019-09-27 13:14:44 +02:00
|
|
|
* @param entity Entity index
|
2009-11-04 21:37:26 +01:00
|
|
|
*/
|
2016-08-23 15:34:00 +02:00
|
|
|
forward void OnEntityDestroyed(int entity);
|
2009-11-04 21:37:26 +01:00
|
|
|
|
|
|
|
/**
|
2019-09-27 13:14:44 +02:00
|
|
|
* When the game description is retrieved
|
2009-11-04 21:37:26 +01:00
|
|
|
*
|
2019-09-27 13:14:44 +02:00
|
|
|
* @note Not supported on ep2v.
|
2014-07-30 11:03:42 +02:00
|
|
|
*
|
2019-09-27 13:14:44 +02:00
|
|
|
* @param gameDesc Game description
|
|
|
|
* @return Plugin_Changed if gameDesc has been edited, else no change.
|
2009-11-04 21:37:26 +01:00
|
|
|
*/
|
2016-08-23 15:34:00 +02:00
|
|
|
forward Action OnGetGameDescription(char gameDesc[64]);
|
2009-11-04 21:37:26 +01:00
|
|
|
|
|
|
|
/**
|
2019-09-27 13:14:44 +02:00
|
|
|
* When the level is initialized
|
2009-11-04 21:37:26 +01:00
|
|
|
*
|
2019-09-27 13:14:44 +02:00
|
|
|
* @param mapName Name of the map
|
|
|
|
* @param mapEntities Entities of the map
|
|
|
|
* @return Plugin_Changed if mapEntities has been edited, else no change.
|
2009-11-04 21:37:26 +01:00
|
|
|
*/
|
2016-08-23 15:34:00 +02:00
|
|
|
forward Action OnLevelInit(const char[] mapName, char mapEntities[2097152]);
|
2009-11-04 21:37:26 +01:00
|
|
|
|
|
|
|
/**
|
2019-09-27 13:14:44 +02:00
|
|
|
* Hooks an entity
|
2009-11-04 21:37:26 +01:00
|
|
|
*
|
2019-09-27 13:14:44 +02:00
|
|
|
* @param entity Entity index
|
|
|
|
* @param type Type of function to hook
|
|
|
|
* @param callback Function to call when hook is called
|
2009-11-04 21:37:26 +01:00
|
|
|
*/
|
2016-08-23 15:34:00 +02:00
|
|
|
native void SDKHook(int entity, SDKHookType type, SDKHookCB callback);
|
2009-11-04 21:37:26 +01:00
|
|
|
|
2010-07-04 17:58:27 +02:00
|
|
|
/**
|
2019-09-27 13:14:44 +02:00
|
|
|
* Hooks an entity
|
2010-07-04 17:58:27 +02:00
|
|
|
*
|
2019-09-27 13:14:44 +02:00
|
|
|
* @param entity Entity index
|
|
|
|
* @param type Type of function to hook
|
|
|
|
* @param callback Function to call when hook is called
|
|
|
|
* @return Hook Successful
|
2010-07-04 17:58:27 +02:00
|
|
|
*/
|
2016-08-23 15:34:00 +02:00
|
|
|
native bool SDKHookEx(int entity, SDKHookType type, SDKHookCB callback);
|
2010-07-04 17:58:27 +02:00
|
|
|
|
2009-11-04 21:37:26 +01:00
|
|
|
/**
|
2019-09-27 13:14:44 +02:00
|
|
|
* Unhooks an entity
|
2009-11-04 21:37:26 +01:00
|
|
|
*
|
2019-09-27 13:14:44 +02:00
|
|
|
* @param entity Entity index
|
|
|
|
* @param type Type of function to unhook
|
|
|
|
* @param callback Callback function to unhook
|
2009-11-04 21:37:26 +01:00
|
|
|
*/
|
2016-08-23 15:34:00 +02:00
|
|
|
native void SDKUnhook(int entity, SDKHookType type, SDKHookCB callback);
|
2009-11-04 21:37:26 +01:00
|
|
|
|
2014-07-30 11:03:42 +02:00
|
|
|
/**
|
2019-09-27 13:14:44 +02:00
|
|
|
* Applies damage to an entity
|
2014-07-30 11:03:42 +02:00
|
|
|
*
|
|
|
|
* @note Force application is dependent on game and damage type(s)
|
|
|
|
*
|
2019-09-27 13:14:44 +02:00
|
|
|
* @param entity Entity index taking damage
|
|
|
|
* @param inflictor Inflictor entity index
|
|
|
|
* @param attacker Attacker entity index
|
|
|
|
* @param damage Amount of damage
|
|
|
|
* @param damageType Bitfield of damage types
|
|
|
|
* @param weapon Weapon index (orangebox and later) or -1 for unspecified
|
|
|
|
* @param damageForce Velocity of damage force
|
|
|
|
* @param damagePosition Origin of damage
|
2014-07-30 11:03:42 +02:00
|
|
|
*/
|
2016-08-23 15:34:00 +02:00
|
|
|
native void SDKHooks_TakeDamage(int entity, int inflictor, int attacker,
|
|
|
|
float damage, int damageType=DMG_GENERIC, int weapon=-1,
|
|
|
|
const float damageForce[3]=NULL_VECTOR, const float damagePosition[3]=NULL_VECTOR);
|
2014-07-30 11:03:42 +02:00
|
|
|
|
|
|
|
/**
|
2019-09-27 13:14:44 +02:00
|
|
|
* Forces a client to drop the specified weapon
|
2014-07-30 11:03:42 +02:00
|
|
|
*
|
2019-09-27 13:14:44 +02:00
|
|
|
* @param client Client index.
|
|
|
|
* @param weapon Weapon entity index.
|
|
|
|
* @param vecTarget Location to toss weapon to, or NULL_VECTOR for default.
|
|
|
|
* @param vecVelocity Velocity at which to toss weapon, or NULL_VECTOR for default.
|
|
|
|
* @error Invalid client or weapon entity, weapon not owned by client.
|
2014-07-30 11:03:42 +02:00
|
|
|
*/
|
2016-08-23 15:34:00 +02:00
|
|
|
native void SDKHooks_DropWeapon(int client, int weapon, const float vecTarget[3]=NULL_VECTOR,
|
|
|
|
const float vecVelocity[3]=NULL_VECTOR);
|
2009-11-04 21:37:26 +01:00
|
|
|
|
2014-07-30 11:03:42 +02:00
|
|
|
/**
|
|
|
|
* Do not edit below this line!
|
|
|
|
*/
|
2019-09-27 13:14:44 +02:00
|
|
|
public Extension __ext_sdkhooks =
|
2009-11-04 21:37:26 +01:00
|
|
|
{
|
2014-07-30 11:03:42 +02:00
|
|
|
name = "SDKHooks",
|
2009-11-04 21:37:26 +01:00
|
|
|
file = "sdkhooks.ext",
|
|
|
|
#if defined AUTOLOAD_EXTENSIONS
|
|
|
|
autoload = 1,
|
|
|
|
#else
|
|
|
|
autoload = 0,
|
|
|
|
#endif
|
|
|
|
#if defined REQUIRE_EXTENSIONS
|
|
|
|
required = 1,
|
|
|
|
#else
|
|
|
|
required = 0,
|
|
|
|
#endif
|
2014-07-30 11:03:42 +02:00
|
|
|
};
|