mirror of
https://github.com/rehlds/reapi.git
synced 2025-01-27 22:17:55 +03:00
Added members CBaseEntity, CBaseAnimating
Implemented functions CBasePlayer::SetAnimation, CBasePlayer::GiveDefaultItems, CBasePlayer::GiveNamedItem, CBasePlayer::AddAccount, CBasePlayer::GiveShield, CBaseAnimating::ResetSequenceInfo, PlayerBlind, RadiusFlash_TraceLine, FireBullets, FireBullets3, RadiusDamage, ClearMultiDamage, ApplyMultiDamage, AddMultiDamage Added misc natives
This commit is contained in:
parent
feeca13f08
commit
df8cab66f4
@ -50,7 +50,6 @@ enum HookChain
|
||||
* @return Returns a handle to the hook. Use EnableHookChain/DisableHookChain to toggle the forward on or off.
|
||||
*
|
||||
*/
|
||||
|
||||
native HookChain:RegisterHookChain(any:function_id, const callback[], post = 0);
|
||||
|
||||
/*
|
||||
@ -60,7 +59,6 @@ native HookChain:RegisterHookChain(any:function_id, const callback[], post = 0);
|
||||
* @param hook The hook to stop.
|
||||
*
|
||||
*/
|
||||
|
||||
native bool:DisableHookChain(HookChain:hook);
|
||||
|
||||
/*
|
||||
@ -71,7 +69,6 @@ native bool:DisableHookChain(HookChain:hook);
|
||||
* @return Returns if the function is successful executed true otherwise false
|
||||
*
|
||||
*/
|
||||
|
||||
native bool:EnableHookChain(HookChain:hook);
|
||||
|
||||
/*
|
||||
@ -83,7 +80,6 @@ native bool:EnableHookChain(HookChain:hook);
|
||||
*
|
||||
* native SetHookChainReturn(AType:type, any:...);
|
||||
*/
|
||||
|
||||
native SetHookChainReturn(HookChainReturn:type, any:...);
|
||||
|
||||
/*
|
||||
@ -95,7 +91,6 @@ native SetHookChainReturn(HookChainReturn:type, any:...);
|
||||
*
|
||||
* native GetHookChainReturn(AType:type, any:...);
|
||||
*/
|
||||
|
||||
native GetHookChainReturn(AType:type, any:...);
|
||||
|
||||
/*
|
||||
@ -109,7 +104,6 @@ native GetHookChainReturn(AType:type, any:...);
|
||||
*
|
||||
* native SetHookChainArg(number, AType:type, any:...);
|
||||
*/
|
||||
|
||||
native SetHookChainArg(number, AType:type, any:...);
|
||||
|
||||
/*
|
||||
|
@ -4,5 +4,5 @@
|
||||
#define _reapi_const_included
|
||||
|
||||
// reapi version
|
||||
#define REAPI_VERISON_MAJOR 1
|
||||
#define REAPI_VERISON_MAJOR 2
|
||||
#define REAPI_VERISON_MINOR 0
|
||||
|
@ -52,3 +52,16 @@ native set_member(index, any:member, any:...);
|
||||
*
|
||||
*/
|
||||
native any:get_member(index, any:member, any:...);
|
||||
|
||||
native rg_set_animation(index, PLAYER_ANIM:playerAnim);
|
||||
native rg_add_account(index, amount, bool:bTrackChange = true);
|
||||
native rg_give_item(index, const pszName[]);
|
||||
native rg_give_default_items(index);
|
||||
native rg_give_shield(index, bool:bDeploy = true);
|
||||
native rg_dmg_radius(Float:vecSrc[3], inflictor, attacker, Float:flDamage, Float:flRadius, iClassIgnore, bitsDamageType);
|
||||
native rg_multidmg_clear();
|
||||
native rg_multidmg_apply(inflictor, attacker);
|
||||
native rg_multidmg_add(inflictor, victim, Float:flDamage, bitsDamageType);
|
||||
|
||||
native rg_fire_bullets(inflictor, attacker, shots, Float:vecSrc[3], Float:vecDirShooting[3], Float:vecSpread[3], Float:flDistance, iBulletType, iTracerFreq, iDamage);
|
||||
native Float:[3] rg_fire_bullets3(inflictor, attacker, Float:vecSrc[3], Float:vecDirShooting[3], Float:vecSpread, Float:flDistance, iPenetration, iBulletType, iDamage, Float:flRangeModifier, bool:bPistol, shared_rand);
|
||||
|
@ -11,6 +11,21 @@
|
||||
#define SIGNAL_ESCAPE (1<<3)
|
||||
#define SIGNAL_VIPSAFETY (1<<4)
|
||||
|
||||
enum PLAYER_ANIM
|
||||
{
|
||||
PLAYER_IDLE,
|
||||
PLAYER_WALK,
|
||||
PLAYER_JUMP,
|
||||
PLAYER_SUPERJUMP,
|
||||
PLAYER_DIE,
|
||||
PLAYER_ATTACK1,
|
||||
PLAYER_ATTACK2,
|
||||
PLAYER_FLINCH,
|
||||
PLAYER_LARGE_FLINCH,
|
||||
PLAYER_RELOAD,
|
||||
PLAYER_HOLDBOMB
|
||||
};
|
||||
|
||||
enum GamedllFunc
|
||||
{
|
||||
/**
|
||||
@ -20,17 +35,41 @@ enum GamedllFunc
|
||||
*/
|
||||
RH_GetForceCamera = 1024,
|
||||
|
||||
/**
|
||||
* Description: -
|
||||
* Params: (const index, const inflictor, const attacker, const Float:fadeTime, const Float:fadeHold, const alpha, Float:color[3])
|
||||
*/
|
||||
RH_PlayerBlind,
|
||||
|
||||
/**
|
||||
* Description: -
|
||||
* Params: (const index, inflictor, attacker, Float:vecSrc[3], Float:vecSpot[3], tracehandle)
|
||||
*/
|
||||
RH_RadiusFlash_TraceLine,
|
||||
|
||||
// [...]
|
||||
RH_GameDLL_End
|
||||
};
|
||||
|
||||
enum GamedllFunc_CBaseAnimating
|
||||
{
|
||||
/**
|
||||
* Description: -
|
||||
* Params: (const this)
|
||||
*/
|
||||
RH_CBaseAnimating_ResetSequenceInfo = 2048,
|
||||
|
||||
// [...]
|
||||
RH_CBaseAnimating_End
|
||||
};
|
||||
|
||||
enum GamedllFunc_CBasePlayer
|
||||
{
|
||||
/**
|
||||
* Description: -
|
||||
* Params: (const this)
|
||||
*/
|
||||
RH_CBasePlayer_Spawn = 2048,
|
||||
RH_CBasePlayer_Spawn = 3072,
|
||||
|
||||
/**
|
||||
* Description: -
|
||||
@ -820,6 +859,254 @@ enum CSGameRules_Members
|
||||
m_bSkipSpawn
|
||||
};
|
||||
|
||||
// CBaseEntity
|
||||
enum CBaseEntity_Members
|
||||
{
|
||||
/**
|
||||
* Description: -
|
||||
* Member type: float
|
||||
* Get params: Float:get_member(index, member);
|
||||
* Set params: set_member(index, member, Float:value);
|
||||
*/
|
||||
currentammo = 1024,
|
||||
|
||||
/**
|
||||
* Description: -
|
||||
* Member type: int
|
||||
* Get params: get_member(index, member);
|
||||
* Set params: set_member(index, member, value);
|
||||
*/
|
||||
maxammo_buckshot,
|
||||
|
||||
/**
|
||||
* Description: -
|
||||
* Member type: int
|
||||
* Get params: get_member(index, member);
|
||||
* Set params: set_member(index, member, value);
|
||||
*/
|
||||
ammo_buckshot,
|
||||
|
||||
/**
|
||||
* Description: -
|
||||
* Member type: int
|
||||
* Get params: get_member(index, member);
|
||||
* Set params: set_member(index, member, value);
|
||||
*/
|
||||
maxammo_9mm,
|
||||
|
||||
/**
|
||||
* Description: -
|
||||
* Member type: int
|
||||
* Get params: get_member(index, member);
|
||||
* Set params: set_member(index, member, value);
|
||||
*/
|
||||
ammo_9mm,
|
||||
|
||||
/**
|
||||
* Description: -
|
||||
* Member type: int
|
||||
* Get params: get_member(index, member);
|
||||
* Set params: set_member(index, member, value);
|
||||
*/
|
||||
maxammo_556nato,
|
||||
|
||||
/**
|
||||
* Description: -
|
||||
* Member type: int
|
||||
* Get params: get_member(index, member);
|
||||
* Set params: set_member(index, member, value);
|
||||
*/
|
||||
ammo_556nato,
|
||||
|
||||
/**
|
||||
* Description: -
|
||||
* Member type: int
|
||||
* Get params: get_member(index, member);
|
||||
* Set params: set_member(index, member, value);
|
||||
*/
|
||||
maxammo_556natobox,
|
||||
|
||||
/**
|
||||
* Description: -
|
||||
* Member type: int
|
||||
* Get params: get_member(index, member);
|
||||
* Set params: set_member(index, member, value);
|
||||
*/
|
||||
ammo_556natobox,
|
||||
|
||||
/**
|
||||
* Description: -
|
||||
* Member type: int
|
||||
* Get params: get_member(index, member);
|
||||
* Set params: set_member(index, member, value);
|
||||
*/
|
||||
maxammo_762nato,
|
||||
|
||||
/**
|
||||
* Description: -
|
||||
* Member type: int
|
||||
* Get params: get_member(index, member);
|
||||
* Set params: set_member(index, member, value);
|
||||
*/
|
||||
ammo_762nato,
|
||||
|
||||
/**
|
||||
* Description: -
|
||||
* Member type: int
|
||||
* Get params: get_member(index, member);
|
||||
* Set params: set_member(index, member, value);
|
||||
*/
|
||||
maxammo_45acp,
|
||||
|
||||
/**
|
||||
* Description: -
|
||||
* Member type: int
|
||||
* Get params: get_member(index, member);
|
||||
* Set params: set_member(index, member, value);
|
||||
*/
|
||||
ammo_45acp,
|
||||
|
||||
/**
|
||||
* Description: -
|
||||
* Member type: int
|
||||
* Get params: get_member(index, member);
|
||||
* Set params: set_member(index, member, value);
|
||||
*/
|
||||
maxammo_50ae,
|
||||
|
||||
/**
|
||||
* Description: -
|
||||
* Member type: int
|
||||
* Get params: get_member(index, member);
|
||||
* Set params: set_member(index, member, value);
|
||||
*/
|
||||
ammo_50ae,
|
||||
|
||||
/**
|
||||
* Description: -
|
||||
* Member type: int
|
||||
* Get params: get_member(index, member);
|
||||
* Set params: set_member(index, member, value);
|
||||
*/
|
||||
maxammo_338mag,
|
||||
|
||||
/**
|
||||
* Description: -
|
||||
* Member type: int
|
||||
* Get params: get_member(index, member);
|
||||
* Set params: set_member(index, member, value);
|
||||
*/
|
||||
ammo_338mag,
|
||||
|
||||
/**
|
||||
* Description: -
|
||||
* Member type: int
|
||||
* Get params: get_member(index, member);
|
||||
* Set params: set_member(index, member, value);
|
||||
*/
|
||||
maxammo_57mm,
|
||||
|
||||
/**
|
||||
* Description: -
|
||||
* Member type: int
|
||||
* Get params: get_member(index, member);
|
||||
* Set params: set_member(index, member, value);
|
||||
*/
|
||||
ammo_57mm,
|
||||
|
||||
/**
|
||||
* Description: -
|
||||
* Member type: int
|
||||
* Get params: get_member(index, member);
|
||||
* Set params: set_member(index, member, value);
|
||||
*/
|
||||
maxammo_357sig,
|
||||
|
||||
/**
|
||||
* Description: -
|
||||
* Member type: int
|
||||
* Get params: get_member(index, member);
|
||||
* Set params: set_member(index, member, value);
|
||||
*/
|
||||
ammo_357sig,
|
||||
|
||||
/**
|
||||
* Description: -
|
||||
* Member type: float
|
||||
* Get params: Float:get_member(index, member);
|
||||
* Set params: set_member(index, member, Float:value);
|
||||
*/
|
||||
m_flStartThrow,
|
||||
|
||||
/**
|
||||
* Description: -
|
||||
* Member type: float
|
||||
* Get params: Float:get_member(index, member);
|
||||
* Set params: set_member(index, member, Float:value);
|
||||
*/
|
||||
m_flReleaseThrow,
|
||||
|
||||
/**
|
||||
* Description: -
|
||||
* Member type: int
|
||||
* Get params: get_member(index, member);
|
||||
* Set params: set_member(index, member, value);
|
||||
*/
|
||||
m_iSwing,
|
||||
|
||||
/**
|
||||
* Description: -
|
||||
* Member type: bool
|
||||
* Get params: get_member(index, member);
|
||||
* Set params: set_member(index, member, value);
|
||||
*/
|
||||
has_disconnected,
|
||||
};
|
||||
|
||||
// CBaseAnimating
|
||||
enum CBaseAnimating_Members
|
||||
{
|
||||
/**
|
||||
* Description: -
|
||||
* Member type: float
|
||||
* Get params: Float:get_member(index, member);
|
||||
* Set params: set_member(index, member, Float:value);
|
||||
*/
|
||||
m_flFrameRate = 2048,
|
||||
|
||||
/**
|
||||
* Description: -
|
||||
* Member type: float
|
||||
* Get params: Float:get_member(index, member);
|
||||
* Set params: set_member(index, member, Float:value);
|
||||
*/
|
||||
m_flGroundSpeed,
|
||||
|
||||
/**
|
||||
* Description: -
|
||||
* Member type: float
|
||||
* Get params: Float:get_member(index, member);
|
||||
* Set params: set_member(index, member, Float:value);
|
||||
*/
|
||||
m_flLastEventCheck,
|
||||
|
||||
/**
|
||||
* Description: -
|
||||
* Member type: int
|
||||
* Get params: get_member(index, member);
|
||||
* Set params: set_member(index, member, value);
|
||||
*/
|
||||
m_fSequenceFinished,
|
||||
|
||||
/**
|
||||
* Description: -
|
||||
* Member type: int
|
||||
* Get params: get_member(index, member);
|
||||
* Set params: set_member(index, member, value);
|
||||
*/
|
||||
m_fSequenceLoops,
|
||||
};
|
||||
|
||||
// CBasePlayer
|
||||
enum CBasePlayer_Members
|
||||
{
|
||||
@ -829,7 +1116,7 @@ enum CBasePlayer_Members
|
||||
* Get params: get_member(index, member);
|
||||
* Set params: set_member(index, member, value);
|
||||
*/
|
||||
random_seed = 1024,
|
||||
random_seed = 3072,
|
||||
|
||||
/**
|
||||
* Description: -
|
||||
@ -1370,8 +1657,8 @@ enum CBasePlayer_Members
|
||||
/**
|
||||
* Description: -
|
||||
* Member type: char [32]
|
||||
* Get params: Float:get_member(index, member, const dest[], const lenght);
|
||||
* Set params: set_member(index, member, const dest[]);
|
||||
* Get params: get_member(index, member, dest[], const lenght);
|
||||
* Set params: set_member(index, member, const source[]);
|
||||
*/
|
||||
m_szNewName,
|
||||
|
||||
@ -1394,7 +1681,7 @@ enum CBasePlayer_Members
|
||||
/**
|
||||
* Description: -
|
||||
* Member type: class CUnifiedSignals
|
||||
* Get params: get_member(index, member, &signal, &state);
|
||||
* Get params: get_member(index, member, signals[2]); (0 - signal, 1 - state)
|
||||
* Set params: set_member(index, member, value);
|
||||
*/
|
||||
m_signals,
|
||||
@ -1690,8 +1977,8 @@ enum CBasePlayer_Members
|
||||
/**
|
||||
* Description: -
|
||||
* Member type: char [17]
|
||||
* Get params: Float:get_member(index, member, const dest[], const lenght);
|
||||
* Set params: set_member(index, member, const dest[]);
|
||||
* Get params: get_member(index, member, dest[], const lenght);
|
||||
* Set params: set_member(index, member, const source[]);
|
||||
*/
|
||||
m_szTextureName,
|
||||
|
||||
@ -1970,8 +2257,8 @@ enum CBasePlayer_Members
|
||||
/**
|
||||
* Description: -
|
||||
* Member type: char [128]
|
||||
* Get params: Float:get_member(index, member, const dest[], const lenght);
|
||||
* Set params: set_member(index, member, const dest[]);
|
||||
* Get params: get_member(index, member, dest[], const lenght);
|
||||
* Set params: set_member(index, member, const source[]);
|
||||
*/
|
||||
m_SbarString0,
|
||||
|
||||
@ -2010,8 +2297,8 @@ enum CBasePlayer_Members
|
||||
/**
|
||||
* Description: -
|
||||
* Member type: char [16]
|
||||
* Get params: Float:get_member(index, member, const dest[], const lenght);
|
||||
* Set params: set_member(index, member, const dest[]);
|
||||
* Get params: get_member(index, member, dest[], const lenght);
|
||||
* Set params: set_member(index, member, const source[]);
|
||||
*/
|
||||
m_szTeamName,
|
||||
|
||||
@ -2026,8 +2313,8 @@ enum CBasePlayer_Members
|
||||
/**
|
||||
* Description: -
|
||||
* Member type: char [32]
|
||||
* Get params: Float:get_member(index, member, const dest[], const lenght);
|
||||
* Set params: set_member(index, member, const dest[]);
|
||||
* Get params: get_member(index, member, dest[], const lenght);
|
||||
* Set params: set_member(index, member, const source[]);
|
||||
*/
|
||||
m_szAnimExtention,
|
||||
|
||||
@ -2202,16 +2489,16 @@ enum CBasePlayer_Members
|
||||
/**
|
||||
* Description: -
|
||||
* Member type: char [256]
|
||||
* Get params: Float:get_member(index, member, const dest[], const lenght);
|
||||
* Set params: set_member(index, member, const dest[]);
|
||||
* Get params: get_member(index, member, dest[], const lenght);
|
||||
* Set params: set_member(index, member, const source[]);
|
||||
*/
|
||||
m_autoBuyString,
|
||||
|
||||
/**
|
||||
* Description: -
|
||||
* Member type: char *
|
||||
* Get params: Float:get_member(index, member, const dest[], const lenght);
|
||||
* Set params: set_member(index, member, const dest[]);
|
||||
* Get params: get_member(index, member, dest[], const lenght);
|
||||
* Set params: set_member(index, member, const source[]);
|
||||
*/
|
||||
m_rebuyString,
|
||||
|
||||
@ -2242,8 +2529,8 @@ enum CBasePlayer_Members
|
||||
/**
|
||||
* Description: -
|
||||
* Member type: char [32]
|
||||
* Get params: Float:get_member(index, member, const dest[], const lenght);
|
||||
* Set params: set_member(index, member, const dest[]);
|
||||
* Get params: get_member(index, member, dest[], const lenght);
|
||||
* Set params: set_member(index, member, const source[]);
|
||||
*/
|
||||
m_lastLocation,
|
||||
|
||||
|
@ -29,8 +29,6 @@
|
||||
|
||||
#include "voice_gamemgr.h"
|
||||
|
||||
#define COM_TOKEN_LEN 1500
|
||||
|
||||
#define MAX_RULE_BUFFER 1024
|
||||
#define MAX_VOTE_MAPS 100
|
||||
#define MAX_VIP_QUEUES 5
|
||||
|
@ -151,6 +151,11 @@
|
||||
// It's usually defined to something like "__stdcall".
|
||||
|
||||
#else // _WIN32
|
||||
#ifdef __FUNCTION__
|
||||
#undef __FUNCTION__
|
||||
#endif
|
||||
#define __FUNCTION__ __func__
|
||||
|
||||
#ifndef PAGESIZE
|
||||
#define PAGESIZE 4096
|
||||
#endif
|
||||
|
@ -51,8 +51,8 @@ typedef IHookChain<int> IReGameHook_CBasePlayer_Classify;
|
||||
typedef IHookChainRegistryClass<int, class CBasePlayer> IReGameHookRegistry_CBasePlayer_Classify;
|
||||
|
||||
// CBasePlayer::TraceAttack hook
|
||||
typedef IVoidHookChain<struct entvars_s *, float, Vector&, struct TraceResult *, int> IReGameHook_CBasePlayer_TraceAttack;
|
||||
typedef IVoidHookChainRegistryClass<class CBasePlayer, struct entvars_s *, float, Vector&, struct TraceResult *, int> IReGameHookRegistry_CBasePlayer_TraceAttack;
|
||||
typedef IVoidHookChain<struct entvars_s *, float, Vector &, struct TraceResult *, int> IReGameHook_CBasePlayer_TraceAttack;
|
||||
typedef IVoidHookChainRegistryClass<class CBasePlayer, struct entvars_s *, float, Vector &, struct TraceResult *, int> IReGameHookRegistry_CBasePlayer_TraceAttack;
|
||||
|
||||
// CBasePlayer::TakeDamage hook
|
||||
typedef IHookChain<int, struct entvars_s *, struct entvars_s *, float, int> IReGameHook_CBasePlayer_TakeDamage;
|
||||
@ -123,20 +123,53 @@ typedef IVoidHookChain<float, float, float, int> IReGameHook_CBasePlayer_Blind;
|
||||
typedef IVoidHookChainRegistryClass<class CBasePlayer, float, float, float, int> IReGameHookRegistry_CBasePlayer_Blind;
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
// Observer_IsValidTarget hook
|
||||
// CBasePlayer::Observer_IsValidTarget hook
|
||||
typedef IHookChain<class CBaseEntity *, int, bool> IReGameHook_CBasePlayer_Observer_IsValidTarget;
|
||||
typedef IHookChainRegistryClass<class CBaseEntity *, class CBasePlayer, int, bool> IReGameHookRegistry_CBasePlayer_Observer_IsValidTarget;
|
||||
|
||||
// CBasePlayer::SetAnimation hook
|
||||
typedef IVoidHookChain<PLAYER_ANIM> IReGameHook_CBasePlayer_SetAnimation;
|
||||
typedef IVoidHookChainRegistryClass<class CBasePlayer, PLAYER_ANIM> IReGameHookRegistry_CBasePlayer_SetAnimation;
|
||||
|
||||
// CBasePlayer::GiveDefaultItems hook
|
||||
typedef IVoidHookChain<> IReGameHook_CBasePlayer_GiveDefaultItems;
|
||||
typedef IVoidHookChainRegistryClass<class CBasePlayer> IReGameHookRegistry_CBasePlayer_GiveDefaultItems;
|
||||
|
||||
// CBasePlayer::GiveNamedItem hook
|
||||
typedef IVoidHookChain<const char *> IReGameHook_CBasePlayer_GiveNamedItem;
|
||||
typedef IVoidHookChainRegistryClass<class CBasePlayer, const char *> IReGameHookRegistry_CBasePlayer_GiveNamedItem;
|
||||
|
||||
// CBasePlayer::AddAccount hook
|
||||
typedef IVoidHookChain<int, bool> IReGameHook_CBasePlayer_AddAccount;
|
||||
typedef IVoidHookChainRegistryClass<class CBasePlayer, int, bool> IReGameHookRegistry_CBasePlayer_AddAccount;
|
||||
|
||||
// CBasePlayer::GiveShield hook
|
||||
typedef IVoidHookChain<bool> IReGameHook_CBasePlayer_GiveShield;
|
||||
typedef IVoidHookChainRegistryClass<class CBasePlayer, bool> IReGameHookRegistry_CBasePlayer_GiveShield;
|
||||
|
||||
|
||||
|
||||
|
||||
// CBaseAnimating::ResetSequenceInfo hook
|
||||
typedef IVoidHookChain<> IReGameHook_CBaseAnimating_ResetSequenceInfo;
|
||||
typedef IVoidHookChainRegistryClass<class CBaseAnimating> IReGameHookRegistry_CBaseAnimating_ResetSequenceInfo;
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
// GetForceCamera hook
|
||||
typedef IHookChain<int, class CBasePlayer *> IReGameHook_GetForceCamera;
|
||||
typedef IHookChainRegistry<int, class CBasePlayer *> IReGameHookRegistry_GetForceCamera;
|
||||
|
||||
// PlayerBlind hook
|
||||
typedef IVoidHookChain<class CBasePlayer *, struct entvars_s *, struct entvars_s *, float, float, int, Vector &> IReGameHook_PlayerBlind;
|
||||
typedef IVoidHookChainRegistry<class CBasePlayer *, struct entvars_s *, struct entvars_s *, float, float, int, Vector &> IReGameHookRegistry_PlayerBlind;
|
||||
|
||||
// RadiusFlash_TraceLine hook
|
||||
typedef IVoidHookChain<class CBasePlayer *, struct entvars_s *, struct entvars_s *, Vector &, Vector &, struct TraceResult *> IReGameHook_RadiusFlash_TraceLine;
|
||||
typedef IVoidHookChainRegistry<class CBasePlayer *, struct entvars_s *, struct entvars_s *, Vector &, Vector &, struct TraceResult *> IReGameHookRegistry_RadiusFlash_TraceLine;
|
||||
|
||||
class IReGameHookchains {
|
||||
public:
|
||||
virtual ~IReGameHookchains() {}
|
||||
@ -164,23 +197,38 @@ public:
|
||||
virtual IReGameHookRegistry_CBasePlayer_RoundRespawn* CBasePlayer_RoundRespawn() = 0;
|
||||
virtual IReGameHookRegistry_CBasePlayer_Blind* CBasePlayer_Blind() = 0;
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
virtual IReGameHookRegistry_CBasePlayer_Observer_IsValidTarget* CBasePlayer_Observer_IsValidTarget() = 0;
|
||||
virtual IReGameHookRegistry_CBasePlayer_SetAnimation* CBasePlayer_SetAnimation() = 0;
|
||||
virtual IReGameHookRegistry_CBasePlayer_GiveDefaultItems* CBasePlayer_GiveDefaultItems() = 0;
|
||||
virtual IReGameHookRegistry_CBasePlayer_GiveNamedItem* CBasePlayer_GiveNamedItem() = 0;
|
||||
virtual IReGameHookRegistry_CBasePlayer_AddAccount* CBasePlayer_AddAccount() = 0;
|
||||
virtual IReGameHookRegistry_CBasePlayer_GiveShield* CBasePlayer_GiveShield() = 0;
|
||||
|
||||
|
||||
virtual IReGameHookRegistry_CBaseAnimating_ResetSequenceInfo* CBaseAnimating_ResetSequenceInfo() = 0;
|
||||
|
||||
|
||||
virtual IReGameHookRegistry_GetForceCamera* GetForceCamera() = 0;
|
||||
virtual IReGameHookRegistry_PlayerBlind* PlayerBlind() = 0;
|
||||
virtual IReGameHookRegistry_RadiusFlash_TraceLine* RadiusFlash_TraceLine() = 0;
|
||||
|
||||
};
|
||||
|
||||
struct ReGameFuncs_t {
|
||||
class CBaseEntity *(*UTIL_PlayerByIndex)(int playerIndex);
|
||||
class ICSPlayer *(*CBASE_TO_CSPLAYER)(class CBaseEntity *pEntity);
|
||||
class ICSEntity *(*CBASE_TO_CSENTITY)(CBaseEntity *pEntity);
|
||||
class ICSEntity *(*CBASE_TO_CSENTITY)(class CBaseEntity *pEntity);
|
||||
class ICSPlayer *(*INDEX_TO_CSPLAYER)(int iPlayerIndex);
|
||||
class ICSEntity *(*INDEX_TO_CSENTITY)(int iEntityIndex);
|
||||
struct edict_s *(*CREATE_NAMED_ENTITY2)(string_t iClass);
|
||||
|
||||
void (*ChangeString)(char *&dest, const char *source);
|
||||
|
||||
void (*RadiusDamage)(Vector vecSrc, entvars_t *pevInflictor, entvars_t *pevAttacker, float flDamage, float flRadius, int iClassIgnore, int bitsDamageType);
|
||||
void (*ClearMultiDamage)();
|
||||
void (*ApplyMultiDamage)(entvars_t *pevInflictor, entvars_t *pevAttacker);
|
||||
void (*AddMultiDamage)(entvars_t *pevInflictor, CBaseEntity *pEntity, float flDamage, int bitsDamageType);
|
||||
|
||||
};
|
||||
|
||||
class IReGameApi {
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -52,7 +52,7 @@ typedef IBaseInterface* (*CreateInterfaceFn)(const char *pName, int *pReturnCode
|
||||
typedef IBaseInterface* (*InstantiateInterfaceFn)();
|
||||
|
||||
|
||||
// Used internally to classes.
|
||||
// Used internally to register classes.
|
||||
class InterfaceReg
|
||||
{
|
||||
public:
|
||||
|
@ -202,6 +202,7 @@
|
||||
<ClInclude Include="..\src\member_list.h" />
|
||||
<ClInclude Include="..\src\mod_regamedll_api.h" />
|
||||
<ClInclude Include="..\src\mod_rehlds_api.h" />
|
||||
<ClInclude Include="..\src\natives_misc.h" />
|
||||
<ClInclude Include="..\src\natives_hookchains.h" />
|
||||
<ClInclude Include="..\src\natives_members.h" />
|
||||
<ClInclude Include="..\src\precompiled.h" />
|
||||
@ -237,6 +238,7 @@
|
||||
<ClCompile Include="..\src\main.cpp" />
|
||||
<ClCompile Include="..\src\meta_api.cpp" />
|
||||
<ClCompile Include="..\src\mod_rehlds_api.cpp" />
|
||||
<ClCompile Include="..\src\natives_misc.cpp" />
|
||||
<ClCompile Include="..\src\natives_hookchains.cpp" />
|
||||
<ClCompile Include="..\src\natives_members.cpp" />
|
||||
<ClCompile Include="..\src\precompiled.cpp">
|
||||
|
@ -49,6 +49,9 @@
|
||||
<Filter Include="amxmodx\scripting\include">
|
||||
<UniqueIdentifier>{c4bfa412-f9f4-4b90-9f02-3c1531e2ac23}</UniqueIdentifier>
|
||||
</Filter>
|
||||
<Filter Include="src\natives">
|
||||
<UniqueIdentifier>{1e41b4f5-768c-437f-af6d-51432194e332}</UniqueIdentifier>
|
||||
</Filter>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClInclude Include="..\include\metamod\dllapi.h">
|
||||
@ -619,10 +622,13 @@
|
||||
<Filter>src</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\src\natives_hookchains.h">
|
||||
<Filter>src</Filter>
|
||||
<Filter>src\natives</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\src\natives_members.h">
|
||||
<Filter>src</Filter>
|
||||
<Filter>src\natives</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\src\natives_misc.h">
|
||||
<Filter>src\natives</Filter>
|
||||
</ClInclude>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
@ -684,10 +690,13 @@
|
||||
<Filter>src</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\src\natives_hookchains.cpp">
|
||||
<Filter>src</Filter>
|
||||
<Filter>src\natives</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\src\natives_members.cpp">
|
||||
<Filter>src</Filter>
|
||||
<Filter>src\natives</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\src\natives_misc.cpp">
|
||||
<Filter>src\natives</Filter>
|
||||
</ClCompile>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
|
@ -161,6 +161,8 @@ C_DLLEXPORT int AMXX_Attach(PFN_REQ_FNPTR reqFnptrFunc)
|
||||
|
||||
RegisterNatives_HookChains();
|
||||
RegisterNatives_Members();
|
||||
RegisterNatives_Misc();
|
||||
|
||||
return AMXX_OK;
|
||||
}
|
||||
|
||||
|
@ -511,7 +511,7 @@ struct getAmxString
|
||||
|
||||
getAmxString(AMX* amx, cell addr, size_t* len = nullptr)
|
||||
{
|
||||
getAmxString(getAmxAddr(amx, addr), len);
|
||||
getAmxStringTemp(getAmxAddr(amx, addr), temp, sizeof temp - 1, len);
|
||||
}
|
||||
|
||||
operator char *()
|
||||
|
@ -14,3 +14,17 @@ bool CAPI_Config::Init()
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
void CAPI_Config::ServerActivate()
|
||||
{
|
||||
if (m_api_regame) {
|
||||
g_pCSGameRules = (CHalfLifeMultiplay **)g_ReGameApi->GetGameData()->GetGameRules();
|
||||
}
|
||||
}
|
||||
|
||||
void CAPI_Config::ServerDeactivate()
|
||||
{
|
||||
if (m_api_regame) {
|
||||
g_pCSGameRules = nullptr;
|
||||
}
|
||||
}
|
||||
|
@ -11,6 +11,9 @@ public:
|
||||
bool hasReHLDS() const { return m_api_rehlds; }
|
||||
bool hasReGameDLL() const { return m_api_regame; }
|
||||
|
||||
void ServerActivate();
|
||||
void ServerDeactivate();
|
||||
|
||||
private:
|
||||
// to provide API functions
|
||||
bool m_api_rehlds; // some useful functions
|
||||
|
@ -1,6 +1,6 @@
|
||||
#include "precompiled.h"
|
||||
|
||||
extern void ServerActivate_Post(edict_t *pEdictList, int edictCount, int clientMax);
|
||||
extern void ServerActivate(edict_t *pEdictList, int edictCount, int clientMax);
|
||||
extern void ServerDeactivate_Post();
|
||||
|
||||
DLL_FUNCTIONS gFunctionTable =
|
||||
@ -26,7 +26,7 @@ DLL_FUNCTIONS gFunctionTable =
|
||||
NULL, // pfnClientPutInServer
|
||||
NULL, // pfnClientCommand
|
||||
NULL, // pfnClientUserInfoChanged
|
||||
NULL, // pfnServerActivate
|
||||
&ServerActivate, // pfnServerActivate
|
||||
NULL, // pfnServerDeactivate
|
||||
NULL, // pfnPlayerPreThink
|
||||
NULL, // pfnPlayerPostThink
|
||||
@ -80,7 +80,7 @@ DLL_FUNCTIONS gFunctionTable_Post =
|
||||
NULL, // pfnClientPutInServer
|
||||
NULL, // pfnClientCommand
|
||||
NULL, // pfnClientUserInfoChanged
|
||||
&ServerActivate_Post, // pfnServerActivate
|
||||
NULL, // pfnServerActivate
|
||||
&ServerDeactivate_Post, // pfnServerDeactivate
|
||||
NULL, // pfnPlayerPreThink
|
||||
NULL, // pfnPlayerPostThink
|
||||
|
@ -280,6 +280,66 @@ CBaseEntity *CBasePlayer_Observer_IsValidTarget(IReGameHook_CBasePlayer_Observer
|
||||
return callForward<CBaseEntity *>(RH_CBasePlayer_Observer_IsValidTarget, original, pthis->entindex(), iPlayerIndex, bSameTeam);
|
||||
}
|
||||
|
||||
void CBasePlayer_SetAnimation(IReGameHook_CBasePlayer_SetAnimation *chain, CBasePlayer *pthis, PLAYER_ANIM playerAnim)
|
||||
{
|
||||
auto original = [chain](int _pthis, PLAYER_ANIM _playerAnim)
|
||||
{
|
||||
chain->callNext(_playerAnim);
|
||||
};
|
||||
|
||||
callVoidForward(RH_CBasePlayer_SetAnimation, original, pthis->entindex(), playerAnim);
|
||||
}
|
||||
|
||||
void CBasePlayer_GiveDefaultItems(IReGameHook_CBasePlayer_GiveDefaultItems *chain, CBasePlayer *pthis)
|
||||
{
|
||||
auto original = [chain](int _pthis)
|
||||
{
|
||||
chain->callNext();
|
||||
};
|
||||
|
||||
callVoidForward(RH_CBasePlayer_GiveDefaultItems, original, pthis->entindex());
|
||||
}
|
||||
|
||||
void CBasePlayer_GiveNamedItem(IReGameHook_CBasePlayer_GiveNamedItem *chain, CBasePlayer *pthis, const char *pszName)
|
||||
{
|
||||
auto original = [chain](int _pthis, const char *_pszName)
|
||||
{
|
||||
chain->callNext(_pszName);
|
||||
};
|
||||
|
||||
callVoidForward(RH_CBasePlayer_GiveNamedItem, original, pthis->entindex(), pszName);
|
||||
}
|
||||
|
||||
void CBasePlayer_AddAccount(IReGameHook_CBasePlayer_AddAccount *chain, CBasePlayer *pthis, int amount, bool bTrackChange)
|
||||
{
|
||||
auto original = [chain](int _pthis, int _amount, bool _bTrackChange)
|
||||
{
|
||||
chain->callNext(_amount, _bTrackChange);
|
||||
};
|
||||
|
||||
callVoidForward(RH_CBasePlayer_AddAccount, original, pthis->entindex(), amount, bTrackChange);
|
||||
}
|
||||
|
||||
void CBasePlayer_GiveShield(IReGameHook_CBasePlayer_GiveShield *chain, CBasePlayer *pthis, bool bDeploy)
|
||||
{
|
||||
auto original = [chain](int _pthis, bool _bDeploy)
|
||||
{
|
||||
chain->callNext(_bDeploy);
|
||||
};
|
||||
|
||||
callVoidForward(RH_CBasePlayer_GiveShield, original, pthis->entindex(), bDeploy);
|
||||
}
|
||||
|
||||
void CBaseAnimating_ResetSequenceInfo(IReGameHook_CBaseAnimating_ResetSequenceInfo *chain, CBaseAnimating *pthis)
|
||||
{
|
||||
auto original = [chain](int _pthis)
|
||||
{
|
||||
chain->callNext();
|
||||
};
|
||||
|
||||
callVoidForward(RH_CBaseAnimating_ResetSequenceInfo, original, pthis->entindex());
|
||||
}
|
||||
|
||||
int GetForceCamera(IReGameHook_GetForceCamera *chain, CBasePlayer *pObserver)
|
||||
{
|
||||
auto original = [chain](int _pObserver)
|
||||
@ -289,3 +349,27 @@ int GetForceCamera(IReGameHook_GetForceCamera *chain, CBasePlayer *pObserver)
|
||||
|
||||
return callForward<int>(RH_GetForceCamera, original, pObserver->entindex());
|
||||
}
|
||||
|
||||
void PlayerBlind(IReGameHook_PlayerBlind *chain, CBasePlayer *pPlayer, entvars_t *pevInflictor, entvars_t *pevAttacker, float fadeTime, float fadeHold, int alpha, Vector& color)
|
||||
{
|
||||
Vector colorCopy(color);
|
||||
|
||||
auto original = [chain, &colorCopy](int _pPlayer, int _pevInflictor, int _pevAttacker, float _fadeTime, float _fadeHold, int _alpha, cell _color)
|
||||
{
|
||||
chain->callNext(getPrivate<CBasePlayer>(_pPlayer), PEV(_pevInflictor), PEV(_pevAttacker), _fadeTime, _fadeHold, _alpha, colorCopy);
|
||||
};
|
||||
|
||||
callVoidForward(RH_PlayerBlind, original, pPlayer->entindex(), indexOfEdict(pevInflictor), indexOfEdict(pevAttacker), fadeTime, fadeHold, alpha, g_amxxapi.PrepareCellArrayA(reinterpret_cast<cell *>(&colorCopy), 3, true));
|
||||
}
|
||||
|
||||
void RadiusFlash_TraceLine(IReGameHook_RadiusFlash_TraceLine *chain, CBasePlayer *pPlayer, entvars_t *pevInflictor, entvars_t *pevAttacker, Vector& vecSrc, Vector& vecSpot, TraceResult *ptr)
|
||||
{
|
||||
Vector vecSrcCopy(vecSrc), vecSpotCopy(vecSpot);
|
||||
|
||||
auto original = [chain, &vecSrcCopy, &vecSpotCopy](int _pPlayer, int _pevInflictor, int _pevAttacker, cell _vecSrc, cell _vecSpot, int _ptr)
|
||||
{
|
||||
chain->callNext(getPrivate<CBasePlayer>(_pPlayer), PEV(_pevInflictor), PEV(_pevAttacker), vecSrcCopy, vecSpotCopy, (TraceResult *)_ptr);
|
||||
};
|
||||
|
||||
callVoidForward(RH_RadiusFlash_TraceLine, original, pPlayer->entindex(), indexOfEdict(pevInflictor), indexOfEdict(pevAttacker), g_amxxapi.PrepareCellArrayA(reinterpret_cast<cell *>(&vecSrcCopy), 3, true), g_amxxapi.PrepareCellArrayA(reinterpret_cast<cell *>(&vecSpotCopy), 3, true), int(ptr));
|
||||
}
|
||||
|
@ -88,7 +88,7 @@ NOINLINE void DLLEXPORT _callVoidForward(const hook_t* hook, original_t original
|
||||
{
|
||||
if (fwd->GetState() == FSTATE_ENABLED)
|
||||
{
|
||||
auto ret = g_amxxapi.ExecuteForward(fwd->m_forward, args...);
|
||||
auto ret = g_amxxapi.ExecuteForward(fwd->GetIndex(), args...);
|
||||
|
||||
if (ret == HC_BREAK) {
|
||||
return;
|
||||
@ -102,11 +102,9 @@ NOINLINE void DLLEXPORT _callVoidForward(const hook_t* hook, original_t original
|
||||
if (hc_state != HC_SUPERCEDE)
|
||||
original(args...);
|
||||
|
||||
for (auto& fwd : hook->post)
|
||||
{
|
||||
if (fwd->GetState() == FSTATE_ENABLED)
|
||||
{
|
||||
auto ret = g_amxxapi.ExecuteForward(fwd->m_forward, args...);
|
||||
for (auto& fwd : hook->post) {
|
||||
if (fwd->GetState() == FSTATE_ENABLED) {
|
||||
auto ret = g_amxxapi.ExecuteForward(fwd->GetIndex(), args...);
|
||||
|
||||
if (ret == HC_BREAK)
|
||||
break;
|
||||
@ -138,7 +136,7 @@ NOINLINE R DLLEXPORT _callForward(const hook_t* hook, original_t original, volat
|
||||
{
|
||||
if (fwd->GetState() == FSTATE_ENABLED)
|
||||
{
|
||||
auto ret = g_amxxapi.ExecuteForward(fwd->m_forward, args...);
|
||||
auto ret = g_amxxapi.ExecuteForward(fwd->GetIndex(), args...);
|
||||
|
||||
if (ret == HC_CONTINUE)
|
||||
continue;
|
||||
@ -167,7 +165,7 @@ NOINLINE R DLLEXPORT _callForward(const hook_t* hook, original_t original, volat
|
||||
|
||||
for (auto& fwd : hook->post) {
|
||||
if (fwd->GetState() == FSTATE_ENABLED) {
|
||||
auto ret = g_amxxapi.ExecuteForward(fwd->m_forward, args...);
|
||||
auto ret = g_amxxapi.ExecuteForward(fwd->GetIndex(), args...);
|
||||
|
||||
if (ret == HC_BREAK)
|
||||
break;
|
||||
@ -200,6 +198,9 @@ void Cvar_DirectSet(IRehldsHook_Cvar_DirectSet *chain, cvar_t *var, const char *
|
||||
|
||||
// regamedll functions
|
||||
int GetForceCamera(IReGameHook_GetForceCamera *chain, CBasePlayer *pObserver);
|
||||
void PlayerBlind(IReGameHook_PlayerBlind *chain, CBasePlayer *pPlayer, entvars_t *pevInflictor, entvars_t *pevAttacker, float fadeTime, float fadeHold, int alpha, Vector& color);
|
||||
void RadiusFlash_TraceLine(IReGameHook_RadiusFlash_TraceLine *chain, CBasePlayer *pPlayer, entvars_t *pevInflictor, entvars_t *pevAttacker, Vector& vecSrc, Vector& vecSpot, TraceResult *ptr);
|
||||
|
||||
|
||||
// regamedll functions - player
|
||||
void CBasePlayer_Spawn(IReGameHook_CBasePlayer_Spawn *chain, CBasePlayer *pthis);
|
||||
@ -224,4 +225,13 @@ void CBasePlayer_UpdateClientData(IReGameHook_CBasePlayer_UpdateClientData *chai
|
||||
void CBasePlayer_ImpulseCommands(IReGameHook_CBasePlayer_ImpulseCommands *chain, CBasePlayer *pthis);
|
||||
void CBasePlayer_RoundRespawn(IReGameHook_CBasePlayer_RoundRespawn *chain, CBasePlayer *pthis);
|
||||
void CBasePlayer_Blind(IReGameHook_CBasePlayer_Blind *chain, CBasePlayer *pthis, float flUntilTime, float flHoldTime, float flFadeTime, int iAlpha);
|
||||
|
||||
CBaseEntity *CBasePlayer_Observer_IsValidTarget(IReGameHook_CBasePlayer_Observer_IsValidTarget *chain, CBasePlayer *pthis, int iPlayerIndex, bool bSameTeam);
|
||||
void CBasePlayer_SetAnimation(IReGameHook_CBasePlayer_SetAnimation *chain, CBasePlayer *pthis, PLAYER_ANIM playerAnim);
|
||||
void CBasePlayer_GiveDefaultItems(IReGameHook_CBasePlayer_GiveDefaultItems *chain, CBasePlayer *pthis);
|
||||
void CBasePlayer_GiveNamedItem(IReGameHook_CBasePlayer_GiveNamedItem *chain, CBasePlayer *pthis, const char *pszName);
|
||||
void CBasePlayer_AddAccount(IReGameHook_CBasePlayer_AddAccount *chain, CBasePlayer *pthis, int amount, bool bTrackChange);
|
||||
void CBasePlayer_GiveShield(IReGameHook_CBasePlayer_GiveShield *chain, CBasePlayer *pthis, bool bDeploy);
|
||||
|
||||
|
||||
void CBaseAnimating_ResetSequenceInfo(IReGameHook_CBaseAnimating_ResetSequenceInfo *chain, CBaseAnimating *pthis);
|
||||
|
@ -2,7 +2,7 @@
|
||||
|
||||
int regfunc::current_cell = 1;
|
||||
|
||||
#define ENG(h) { {}, {}, #h, "ReHLDS", [](){ return api_cfg.hasReHLDS(); }, ((!(RH_##h & 1023) ? regfunc::current_cell = 1, true : false) || (RH_##h & 1023) == regfunc::current_cell++) ? regfunc(h) : regfunc(#h " doesn't match hook definition"), [](){ g_RehldsHookchains->##h##()->registerHook(&##h); }, [](){ g_RehldsHookchains->##h##()->unregisterHook(&##h); }}
|
||||
#define ENG(h) { {}, {}, #h, "ReHLDS", [](){ return api_cfg.hasReHLDS(); }, ((!(RH_##h & (MAX_REGION_RANGE - 1)) ? regfunc::current_cell = 1, true : false) || (RH_##h & (MAX_REGION_RANGE - 1)) == regfunc::current_cell++) ? regfunc(h) : regfunc(#h " doesn't match hook definition"), [](){ g_RehldsHookchains->##h##()->registerHook(&##h); }, [](){ g_RehldsHookchains->##h##()->unregisterHook(&##h); }}
|
||||
hook_t hooklist_engine[] = {
|
||||
ENG(SV_StartSound),
|
||||
ENG(SV_DropClient),
|
||||
@ -10,9 +10,15 @@ hook_t hooklist_engine[] = {
|
||||
ENG(Cvar_DirectSet)
|
||||
};
|
||||
|
||||
#define DLL(h) { {}, {}, #h, "ReGameDLL", [](){ return api_cfg.hasReGameDLL(); }, ((!(RH_##h & 1023) ? regfunc::current_cell = 1, true : false) || (RH_##h & 1023) == regfunc::current_cell++) ? regfunc(h) : regfunc(#h " doesn't match hook definition"), [](){ g_ReGameHookchains->##h##()->registerHook(&##h); }, [](){ g_ReGameHookchains->##h##()->unregisterHook(&##h); }}
|
||||
#define DLL(h) { {}, {}, #h, "ReGameDLL", [](){ return api_cfg.hasReGameDLL(); }, ((!(RH_##h & (MAX_REGION_RANGE - 1)) ? regfunc::current_cell = 1, true : false) || (RH_##h & (MAX_REGION_RANGE - 1)) == regfunc::current_cell++) ? regfunc(h) : regfunc(#h " doesn't match hook definition"), [](){ g_ReGameHookchains->##h##()->registerHook(&##h); }, [](){ g_ReGameHookchains->##h##()->unregisterHook(&##h); }}
|
||||
hook_t hooklist_gamedll[] = {
|
||||
DLL(GetForceCamera)
|
||||
DLL(GetForceCamera),
|
||||
DLL(PlayerBlind),
|
||||
DLL(RadiusFlash_TraceLine)
|
||||
};
|
||||
|
||||
hook_t hooklist_animating[] = {
|
||||
DLL(CBaseAnimating_ResetSequenceInfo)
|
||||
};
|
||||
|
||||
hook_t hooklist_player[] = {
|
||||
@ -38,7 +44,13 @@ hook_t hooklist_player[] = {
|
||||
DLL(CBasePlayer_ImpulseCommands),
|
||||
DLL(CBasePlayer_RoundRespawn),
|
||||
DLL(CBasePlayer_Blind),
|
||||
|
||||
DLL(CBasePlayer_Observer_IsValidTarget),
|
||||
DLL(CBasePlayer_SetAnimation),
|
||||
DLL(CBasePlayer_GiveDefaultItems),
|
||||
DLL(CBasePlayer_GiveNamedItem),
|
||||
DLL(CBasePlayer_AddAccount),
|
||||
DLL(CBasePlayer_GiveShield),
|
||||
};
|
||||
|
||||
hook_t* hooklist_t::getHookSafe(size_t hook)
|
||||
@ -51,6 +63,7 @@ hook_t* hooklist_t::getHookSafe(size_t hook)
|
||||
switch (table) {
|
||||
CASE(engine)
|
||||
CASE(gamedll)
|
||||
CASE(animating)
|
||||
CASE(player)
|
||||
}
|
||||
|
||||
|
@ -1,10 +1,10 @@
|
||||
#pragma once
|
||||
|
||||
#define MAX_REGION_RANGE 1024
|
||||
#define BEGIN_FUNC_REGION(x) (MAX_REGION_RANGE * hooklist_t::hooks_tables_e::ht_##x)
|
||||
#define BEGIN_FUNC_REGION(x) (MAX_REGION_RANGE * hooklist_t::hooks_tables_e::ht_##x)
|
||||
#define MAX_HOOK_FORWARDS 1024
|
||||
|
||||
typedef bool (*ablfunc_t)();
|
||||
typedef bool (*reqfunc_t)();
|
||||
typedef int (*regfunc_t)(AMX *, const char *);
|
||||
typedef void (*regchain_t)();
|
||||
|
||||
@ -30,11 +30,31 @@ struct regfunc
|
||||
func = [](AMX *amx, const char *name) { return g_amxxapi.RegisterSPForwardByName(amx, name, FP_CELL, FP_STRING, FP_DONE); };
|
||||
}
|
||||
|
||||
template<typename T, typename R>
|
||||
regfunc(R (*)(T *, CBaseAnimating *)) {
|
||||
func = [](AMX *amx, const char *name) { return g_amxxapi.RegisterSPForwardByName(amx, name, FP_CELL, FP_DONE); };
|
||||
}
|
||||
|
||||
template<typename T, typename R>
|
||||
regfunc(R (*)(T *, CBasePlayer *)) {
|
||||
func = [](AMX *amx, const char *name) { return g_amxxapi.RegisterSPForwardByName(amx, name, FP_CELL, FP_DONE); };
|
||||
}
|
||||
|
||||
template<typename T, typename R>
|
||||
regfunc(R (*)(T *, CBasePlayer *, const char *)) {
|
||||
func = [](AMX *amx, const char *name) { return g_amxxapi.RegisterSPForwardByName(amx, name, FP_CELL, FP_STRING, FP_DONE); };
|
||||
}
|
||||
|
||||
template<typename T, typename R>
|
||||
regfunc(R (*)(T *, CBasePlayer *, bool)) {
|
||||
func = [](AMX *amx, const char *name) { return g_amxxapi.RegisterSPForwardByName(amx, name, FP_CELL, FP_CELL, FP_DONE); };
|
||||
}
|
||||
|
||||
template<typename T, typename R>
|
||||
regfunc(R (*)(T *, CBasePlayer *, PLAYER_ANIM)) {
|
||||
func = [](AMX *amx, const char *name) { return g_amxxapi.RegisterSPForwardByName(amx, name, FP_CELL, FP_CELL, FP_DONE); };
|
||||
}
|
||||
|
||||
template<typename T, typename R>
|
||||
regfunc(R (*)(T *, CBasePlayer *, entvars_t *, float, Vector&, TraceResult *, int)) {
|
||||
func = [](AMX *amx, const char *name) { return g_amxxapi.RegisterSPForwardByName(amx, name, FP_CELL, FP_CELL, FP_FLOAT, FP_ARRAY, FP_CELL, FP_CELL, FP_DONE); };
|
||||
@ -57,7 +77,7 @@ struct regfunc
|
||||
|
||||
template<typename T, typename R>
|
||||
regfunc(R (*)(T *, CBasePlayer *, int, BOOL)) {
|
||||
func = [](AMX *amx, const char *name) { return g_amxxapi.RegisterSPForwardByName(amx, name, FP_CELL, FP_CELL, FP_DONE); };
|
||||
func = [](AMX *amx, const char *name) { return g_amxxapi.RegisterSPForwardByName(amx, name, FP_CELL, FP_CELL, FP_CELL, FP_DONE); };
|
||||
}
|
||||
|
||||
template<typename T, typename R>
|
||||
@ -72,12 +92,22 @@ struct regfunc
|
||||
|
||||
template<typename T, typename R>
|
||||
regfunc(R (*)(T *, CBasePlayer *, float, float, float, int)) {
|
||||
func = [](AMX *amx, const char *name) { return g_amxxapi.RegisterSPForwardByName(amx, name, FP_FLOAT, FP_FLOAT, FP_FLOAT, FP_CELL, FP_DONE); };
|
||||
func = [](AMX *amx, const char *name) { return g_amxxapi.RegisterSPForwardByName(amx, name, FP_CELL, FP_FLOAT, FP_FLOAT, FP_FLOAT, FP_CELL, FP_DONE); };
|
||||
}
|
||||
|
||||
template<typename T, typename R>
|
||||
regfunc(R (*)(T *, CBasePlayer *, int, bool)) {
|
||||
func = [](AMX *amx, const char *name) { return g_amxxapi.RegisterSPForwardByName(amx, name, FP_CELL, FP_CELL, FP_DONE); };
|
||||
func = [](AMX *amx, const char *name) { return g_amxxapi.RegisterSPForwardByName(amx, name, FP_CELL, FP_CELL, FP_CELL, FP_DONE); };
|
||||
}
|
||||
|
||||
template<typename T, typename R>
|
||||
regfunc(R (*)(T *, CBasePlayer *, entvars_t *, entvars_t *, float, float, int, Vector&)) {
|
||||
func = [](AMX *amx, const char *name) { return g_amxxapi.RegisterSPForwardByName(amx, name, FP_CELL, FP_CELL, FP_CELL, FP_FLOAT, FP_FLOAT, FP_CELL, FP_ARRAY, FP_DONE); };
|
||||
}
|
||||
|
||||
template<typename T, typename R>
|
||||
regfunc(R (*)(T *, CBasePlayer *, entvars_t *, entvars_t *, Vector&, Vector&, TraceResult *)) {
|
||||
func = [](AMX *amx, const char *name) { return g_amxxapi.RegisterSPForwardByName(amx, name, FP_CELL, FP_CELL, FP_CELL, FP_ARRAY, FP_ARRAY, FP_CELL, FP_DONE); };
|
||||
}
|
||||
|
||||
regfunc(const char *error) { UTIL_SysError(error); } // to cause a amxx module failure.
|
||||
@ -95,7 +125,7 @@ struct hook_t
|
||||
const char *func_name; // function name
|
||||
const char *depend_name; // platform dependency
|
||||
|
||||
ablfunc_t checkRequirements;
|
||||
reqfunc_t checkRequirements;
|
||||
regfunc_t registerForward; // AMXX forward registration function
|
||||
regchain_t registerHookchain; // register re* API hook
|
||||
regchain_t unregisterHookchain; // unregister re* API hook
|
||||
@ -103,6 +133,7 @@ struct hook_t
|
||||
|
||||
extern hook_t hooklist_engine[];
|
||||
extern hook_t hooklist_gamedll[];
|
||||
extern hook_t hooklist_animating[];
|
||||
extern hook_t hooklist_player[];
|
||||
|
||||
struct hooklist_t
|
||||
@ -117,6 +148,7 @@ struct hooklist_t
|
||||
switch (table) {
|
||||
CASE(engine)
|
||||
CASE(gamedll)
|
||||
CASE(animating)
|
||||
CASE(player)
|
||||
}
|
||||
|
||||
@ -129,6 +161,7 @@ struct hooklist_t
|
||||
{
|
||||
ht_engine,
|
||||
ht_gamedll,
|
||||
ht_animating,
|
||||
ht_player,
|
||||
|
||||
ht_end
|
||||
@ -181,11 +214,21 @@ enum EngineFunc
|
||||
enum GamedllFunc
|
||||
{
|
||||
RH_GetForceCamera = BEGIN_FUNC_REGION(gamedll),
|
||||
RH_PlayerBlind,
|
||||
RH_RadiusFlash_TraceLine,
|
||||
|
||||
// [...]
|
||||
RH_GameDLL_End
|
||||
};
|
||||
|
||||
enum GamedllFunc_CBaseAnimating
|
||||
{
|
||||
RH_CBaseAnimating_ResetSequenceInfo = BEGIN_FUNC_REGION(animating),
|
||||
|
||||
// [...]
|
||||
RH_CBaseAnimating_End
|
||||
};
|
||||
|
||||
enum GamedllFunc_CBasePlayer
|
||||
{
|
||||
// CBasePlayer virtual
|
||||
@ -213,6 +256,11 @@ enum GamedllFunc_CBasePlayer
|
||||
RH_CBasePlayer_Blind,
|
||||
|
||||
RH_CBasePlayer_Observer_IsValidTarget,
|
||||
RH_CBasePlayer_SetAnimation,
|
||||
RH_CBasePlayer_GiveDefaultItems,
|
||||
RH_CBasePlayer_GiveNamedItem,
|
||||
RH_CBasePlayer_AddAccount,
|
||||
RH_CBasePlayer_GiveShield,
|
||||
|
||||
// [...]
|
||||
RH_CBasePlayer_End
|
||||
|
@ -21,6 +21,21 @@ AMX* CAmxxHook::GetAmx() const
|
||||
return m_amx;
|
||||
}
|
||||
|
||||
int CAmxxHook::GetIndex() const
|
||||
{
|
||||
return m_index;
|
||||
}
|
||||
|
||||
fwdstate CAmxxHook::GetState() const
|
||||
{
|
||||
return m_state;
|
||||
}
|
||||
|
||||
void CAmxxHook::SetState(fwdstate st)
|
||||
{
|
||||
m_state = st;
|
||||
}
|
||||
|
||||
void CHookManager::clearHandlers() const
|
||||
{
|
||||
#define CLEAR_HOOKLIST(__END__, __START__)\
|
||||
@ -31,7 +46,7 @@ void CHookManager::clearHandlers() const
|
||||
m_hooklist[i]->post.clear();\
|
||||
m_hooklist[i]->unregisterHookchain();\
|
||||
}
|
||||
|
||||
|
||||
CLEAR_HOOKLIST(EngineFunc, engine);
|
||||
CLEAR_HOOKLIST(GameDLL, gamedll);
|
||||
CLEAR_HOOKLIST(CBasePlayer, player);
|
||||
|
@ -1,8 +1,6 @@
|
||||
#pragma once
|
||||
#include "hook_list.h"
|
||||
|
||||
//#define MAX_RANGE_HOOKS RH_EngineFunc_End + RH_GameDLL_End + RH_CBasePlayer_End
|
||||
|
||||
enum fwdstate
|
||||
{
|
||||
FSTATE_INVALID = 0,
|
||||
@ -14,14 +12,15 @@ enum fwdstate
|
||||
class CAmxxHook
|
||||
{
|
||||
public:
|
||||
CAmxxHook(AMX* amx, int forward_index) : m_forward(forward_index), m_state(FSTATE_ENABLED), m_amx(amx) {};
|
||||
CAmxxHook(AMX* amx, int index) : m_index(index), m_state(FSTATE_ENABLED), m_amx(amx) {};
|
||||
|
||||
int GetForwardID() const { return m_forward; }
|
||||
fwdstate GetState() const { return m_state; }
|
||||
int GetIndex() const;
|
||||
fwdstate GetState() const;
|
||||
AMX* GetAmx() const;
|
||||
void SetState(fwdstate st);
|
||||
|
||||
public:
|
||||
int m_forward;
|
||||
private:
|
||||
int m_index;
|
||||
fwdstate m_state;
|
||||
AMX* m_amx;
|
||||
};
|
||||
|
@ -17,14 +17,18 @@ void OnMetaDetach()
|
||||
g_hookManager.clearHandlers();
|
||||
}
|
||||
|
||||
void ServerActivate_Post(edict_t *pEdictList, int edictCount, int clientMax)
|
||||
void ServerActivate(edict_t *pEdictList, int edictCount, int clientMax)
|
||||
{
|
||||
g_pEdicts = pEdictList;
|
||||
RETURN_META(MRES_IGNORED);
|
||||
api_cfg.ServerActivate();
|
||||
|
||||
SET_META_RESULT(MRES_IGNORED);
|
||||
}
|
||||
|
||||
void ServerDeactivate_Post()
|
||||
{
|
||||
api_cfg.ServerActivate();
|
||||
g_hookManager.clearHandlers();
|
||||
RETURN_META(MRES_IGNORED);
|
||||
|
||||
SET_META_RESULT(MRES_IGNORED);
|
||||
}
|
||||
|
@ -19,10 +19,7 @@ struct regmember
|
||||
member.type = member_type;
|
||||
}
|
||||
|
||||
regmember(const char *error)
|
||||
{
|
||||
UTIL_SysError("%s", error);
|
||||
} // to cause a amxx module failure.
|
||||
regmember(const char *error) { UTIL_SysError(error); } // to cause a amxx module failure.
|
||||
operator member_t() const { return member; }
|
||||
member_t member;
|
||||
|
||||
@ -32,9 +29,8 @@ struct regmember
|
||||
static char mem_dummy[0xffff];
|
||||
int regmember::current_cell = 1;
|
||||
|
||||
#define GM_MEMBERS(mx, mtype) ((!(mx & 1023) ? regmember::current_cell = 1, true : false) || (mx & 1023) == regmember::current_cell++) ? regmember(((CHalfLifeMultiplay *)&mem_dummy)->##mx, sizeof(((CHalfLifeMultiplay *)&mem_dummy)->##mx), offsetof(CHalfLifeMultiplay, mx), mtype) : regmember(#mx " doesn't match hook definition")
|
||||
#define GM_VOICE_MEMBERS(mx, mtype) ((!(mx & 1023) ? regmember::current_cell = 1, true : false) || (mx & 1023) == regmember::current_cell++) ? regmember(((CVoiceGameMgr *)&mem_dummy)->##mx, sizeof(((CVoiceGameMgr *)&mem_dummy)->##mx), offsetof(CVoiceGameMgr, mx), mtype) : regmember(#mx " doesn't match hook definition")
|
||||
|
||||
#define GM_MEMBERS(mx, mtype) ((!(mx & (MAX_REGION_RANGE - 1)) ? regmember::current_cell = 1, true : false) || (mx & (MAX_REGION_RANGE - 1)) == regmember::current_cell++) ? regmember(((CHalfLifeMultiplay *)&mem_dummy)->##mx, sizeof(((CHalfLifeMultiplay *)&mem_dummy)->##mx), offsetof(CHalfLifeMultiplay, mx), mtype) : regmember(#mx " doesn't match member definition")
|
||||
#define GM_VOICE_MEMBERS(mx, mtype) ((!(mx & (MAX_REGION_RANGE - 1)) ? regmember::current_cell = 1, true : false) || (mx & (MAX_REGION_RANGE - 1)) == regmember::current_cell++) ? regmember(((CVoiceGameMgr *)&mem_dummy)->##mx, sizeof(((CVoiceGameMgr *)&mem_dummy)->##mx), offsetof(CVoiceGameMgr, mx), mtype) : regmember(#mx " doesn't match member definition")
|
||||
member_t memberlist_gamerules[] = {
|
||||
GM_MEMBERS(m_bFreezePeriod, MEMBER_INTEGER),
|
||||
GM_MEMBERS(m_bBombDropped, MEMBER_INTEGER),
|
||||
@ -94,7 +90,7 @@ member_t memberlist_gamerules[] = {
|
||||
GM_MEMBERS(m_iTotalArmourCount, MEMBER_INTEGER),
|
||||
GM_MEMBERS(m_iUnBalancedRounds, MEMBER_INTEGER),
|
||||
GM_MEMBERS(m_iNumEscapeRounds, MEMBER_INTEGER),
|
||||
GM_MEMBERS(m_iMapVotes, MEMBER_INTEGER), // ARRAY 100
|
||||
GM_MEMBERS(m_iMapVotes, MEMBER_INTEGER),
|
||||
GM_MEMBERS(m_iLastPick, MEMBER_INTEGER),
|
||||
GM_MEMBERS(m_iMaxMapTime, MEMBER_INTEGER),
|
||||
GM_MEMBERS(m_iMaxRounds, MEMBER_INTEGER),
|
||||
@ -105,7 +101,7 @@ member_t memberlist_gamerules[] = {
|
||||
GM_MEMBERS(m_flForceChaseCamValue, MEMBER_FLOAT),
|
||||
GM_MEMBERS(m_flFadeToBlackValue, MEMBER_FLOAT),
|
||||
GM_MEMBERS(m_pVIP, MEMBER_CLASSPTR),
|
||||
GM_MEMBERS(VIPQueue, MEMBER_CLASSPTR), // ARRAY [5]
|
||||
GM_MEMBERS(VIPQueue, MEMBER_CLASSPTR),
|
||||
GM_MEMBERS(m_flIntermissionEndTime, MEMBER_FLOAT),
|
||||
GM_MEMBERS(m_flIntermissionStartTime, MEMBER_FLOAT),
|
||||
GM_MEMBERS(m_iEndIntermissionButtonHit, MEMBER_INTEGER),
|
||||
@ -119,8 +115,45 @@ member_t memberlist_gamerules[] = {
|
||||
GM_MEMBERS(m_bSkipSpawn, MEMBER_BOOL),
|
||||
};
|
||||
|
||||
#define PL_MEMBERS(mx, mtype) ((!(mx & 1023) ? regmember::current_cell = 1, true : false) || (mx & 1023) == regmember::current_cell++) ? regmember(((CBasePlayer *)&mem_dummy)->##mx, sizeof(((CBasePlayer *)&mem_dummy)->##mx), offsetof(CBasePlayer, mx), mtype) : regmember(#mx " doesn't match hook definition")
|
||||
#define BASE_MEMBERS(mx, mtype) ((!(mx & (MAX_REGION_RANGE - 1)) ? regmember::current_cell = 1, true : false) || (mx & (MAX_REGION_RANGE - 1)) == regmember::current_cell++) ? regmember(((CBaseEntity *)&mem_dummy)->##mx, sizeof(((CBaseEntity *)&mem_dummy)->##mx), offsetof(CBaseEntity, mx), mtype) : regmember(#mx " doesn't match member definition")
|
||||
member_t memberlist_base[] = {
|
||||
BASE_MEMBERS(currentammo, MEMBER_FLOAT),
|
||||
BASE_MEMBERS(maxammo_buckshot, MEMBER_INTEGER),
|
||||
BASE_MEMBERS(ammo_buckshot, MEMBER_INTEGER),
|
||||
BASE_MEMBERS(maxammo_9mm, MEMBER_INTEGER),
|
||||
BASE_MEMBERS(ammo_9mm, MEMBER_INTEGER),
|
||||
BASE_MEMBERS(maxammo_556nato, MEMBER_INTEGER),
|
||||
BASE_MEMBERS(ammo_556nato, MEMBER_INTEGER),
|
||||
BASE_MEMBERS(maxammo_556natobox, MEMBER_INTEGER),
|
||||
BASE_MEMBERS(ammo_556natobox, MEMBER_INTEGER),
|
||||
BASE_MEMBERS(maxammo_762nato, MEMBER_INTEGER),
|
||||
BASE_MEMBERS(ammo_762nato, MEMBER_INTEGER),
|
||||
BASE_MEMBERS(maxammo_45acp, MEMBER_INTEGER),
|
||||
BASE_MEMBERS(ammo_45acp, MEMBER_INTEGER),
|
||||
BASE_MEMBERS(maxammo_50ae, MEMBER_INTEGER),
|
||||
BASE_MEMBERS(ammo_50ae, MEMBER_INTEGER),
|
||||
BASE_MEMBERS(maxammo_338mag, MEMBER_INTEGER),
|
||||
BASE_MEMBERS(ammo_338mag, MEMBER_INTEGER),
|
||||
BASE_MEMBERS(maxammo_57mm, MEMBER_INTEGER),
|
||||
BASE_MEMBERS(ammo_57mm, MEMBER_INTEGER),
|
||||
BASE_MEMBERS(maxammo_357sig, MEMBER_INTEGER),
|
||||
BASE_MEMBERS(ammo_357sig, MEMBER_INTEGER),
|
||||
BASE_MEMBERS(m_flStartThrow, MEMBER_FLOAT),
|
||||
BASE_MEMBERS(m_flReleaseThrow, MEMBER_FLOAT),
|
||||
BASE_MEMBERS(m_iSwing, MEMBER_INTEGER),
|
||||
BASE_MEMBERS(has_disconnected, MEMBER_BOOL),
|
||||
};
|
||||
|
||||
#define ANIM_MEMBERS(mx, mtype) ((!(mx & (MAX_REGION_RANGE - 1)) ? regmember::current_cell = 1, true : false) || (mx & (MAX_REGION_RANGE - 1)) == regmember::current_cell++) ? regmember(((CBaseAnimating *)&mem_dummy)->##mx, sizeof(((CBaseAnimating *)&mem_dummy)->##mx), offsetof(CBaseAnimating, mx), mtype) : regmember(#mx " doesn't match member definition")
|
||||
member_t memberlist_animating[] = {
|
||||
ANIM_MEMBERS(m_flFrameRate, MEMBER_FLOAT),
|
||||
ANIM_MEMBERS(m_flGroundSpeed, MEMBER_FLOAT),
|
||||
ANIM_MEMBERS(m_flLastEventCheck, MEMBER_FLOAT),
|
||||
ANIM_MEMBERS(m_fSequenceFinished, MEMBER_INTEGER),
|
||||
ANIM_MEMBERS(m_fSequenceLoops, MEMBER_INTEGER),
|
||||
};
|
||||
|
||||
#define PL_MEMBERS(mx, mtype) ((!(mx & (MAX_REGION_RANGE - 1)) ? regmember::current_cell = 1, true : false) || (mx & (MAX_REGION_RANGE - 1)) == regmember::current_cell++) ? regmember(((CBasePlayer *)&mem_dummy)->##mx, sizeof(((CBasePlayer *)&mem_dummy)->##mx), offsetof(CBasePlayer, mx), mtype) : regmember(#mx " doesn't match member definition")
|
||||
member_t memberlist_player[] = {
|
||||
PL_MEMBERS(random_seed, MEMBER_INTEGER),
|
||||
PL_MEMBERS(m_usPlayerBleed, MEMBER_SHORT),
|
||||
@ -158,7 +191,7 @@ member_t memberlist_player[] = {
|
||||
PL_MEMBERS(m_iIgnoreGlobalChat, MEMBER_INTEGER),
|
||||
PL_MEMBERS(m_bHasNightVision, MEMBER_BOOL),
|
||||
PL_MEMBERS(m_bNightVisionOn, MEMBER_BOOL),
|
||||
PL_MEMBERS(m_vRecentPath, MEMBER_VECTOR), // ARRAY [20]
|
||||
PL_MEMBERS(m_vRecentPath, MEMBER_VECTOR),
|
||||
PL_MEMBERS(m_flIdleCheckTime, MEMBER_FLOAT),
|
||||
PL_MEMBERS(m_flRadioTime, MEMBER_FLOAT),
|
||||
PL_MEMBERS(m_iRadioMessages, MEMBER_INTEGER),
|
||||
@ -191,7 +224,7 @@ member_t memberlist_player[] = {
|
||||
PL_MEMBERS(m_bReceivesNoMoneyNextRound, MEMBER_BOOL),
|
||||
PL_MEMBERS(m_iTimeCheckAllowed, MEMBER_INTEGER),
|
||||
PL_MEMBERS(m_bHasChangedName, MEMBER_BOOL),
|
||||
PL_MEMBERS(m_szNewName, MEMBER_CHAR_ARRAY), // ARRAY [32]
|
||||
PL_MEMBERS(m_szNewName, MEMBER_CHAR_ARRAY),
|
||||
PL_MEMBERS(m_bIsDefusing, MEMBER_BOOL),
|
||||
PL_MEMBERS(m_tmHandleSignals, MEMBER_FLOAT),
|
||||
PL_MEMBERS(m_signals, MEMBER_SIGNALS),
|
||||
@ -211,7 +244,7 @@ member_t memberlist_player[] = {
|
||||
PL_MEMBERS(m_flSndRoomtype, MEMBER_FLOAT),
|
||||
PL_MEMBERS(m_flSndRange, MEMBER_FLOAT),
|
||||
PL_MEMBERS(m_flFallVelocity, MEMBER_FLOAT),
|
||||
PL_MEMBERS(m_rgItems, MEMBER_INTEGER), // ARRAY [4]
|
||||
PL_MEMBERS(m_rgItems, MEMBER_INTEGER),
|
||||
PL_MEMBERS(m_fNewAmmo, MEMBER_INTEGER),
|
||||
PL_MEMBERS(m_afPhysicsFlags, MEMBER_INTEGER),
|
||||
PL_MEMBERS(m_fNextSuicideTime, MEMBER_FLOAT),
|
||||
@ -221,17 +254,17 @@ member_t memberlist_player[] = {
|
||||
PL_MEMBERS(m_flDuckTime, MEMBER_FLOAT),
|
||||
PL_MEMBERS(m_flWallJumpTime, MEMBER_FLOAT),
|
||||
PL_MEMBERS(m_flSuitUpdate, MEMBER_FLOAT),
|
||||
PL_MEMBERS(m_rgSuitPlayList, MEMBER_INTEGER), // ARRAY [4]
|
||||
PL_MEMBERS(m_rgSuitPlayList, MEMBER_INTEGER),
|
||||
PL_MEMBERS(m_iSuitPlayNext, MEMBER_INTEGER),
|
||||
PL_MEMBERS(m_rgiSuitNoRepeat, MEMBER_INTEGER), // ARRAY [32]
|
||||
PL_MEMBERS(m_rgflSuitNoRepeatTime, MEMBER_FLOAT), // ARRAY [32]
|
||||
PL_MEMBERS(m_rgiSuitNoRepeat, MEMBER_INTEGER),
|
||||
PL_MEMBERS(m_rgflSuitNoRepeatTime, MEMBER_FLOAT),
|
||||
PL_MEMBERS(m_lastDamageAmount, MEMBER_INTEGER),
|
||||
PL_MEMBERS(m_tbdPrev, MEMBER_FLOAT),
|
||||
PL_MEMBERS(m_flgeigerRange, MEMBER_FLOAT),
|
||||
PL_MEMBERS(m_flgeigerDelay, MEMBER_FLOAT),
|
||||
PL_MEMBERS(m_igeigerRangePrev, MEMBER_INTEGER),
|
||||
PL_MEMBERS(m_iStepLeft, MEMBER_INTEGER),
|
||||
PL_MEMBERS(m_szTextureName, MEMBER_CHAR_ARRAY), // ARRAY [17]
|
||||
PL_MEMBERS(m_szTextureName, MEMBER_CHAR_ARRAY),
|
||||
PL_MEMBERS(m_chTextureType, MEMBER_BYTE),
|
||||
PL_MEMBERS(m_idrowndmg, MEMBER_INTEGER),
|
||||
PL_MEMBERS(m_idrownrestored, MEMBER_INTEGER),
|
||||
@ -258,22 +291,22 @@ member_t memberlist_player[] = {
|
||||
PL_MEMBERS(m_pActiveItem, MEMBER_CLASSPTR),
|
||||
PL_MEMBERS(m_pClientActiveItem, MEMBER_CLASSPTR),
|
||||
PL_MEMBERS(m_pLastItem, MEMBER_CLASSPTR),
|
||||
PL_MEMBERS(m_rgAmmo, MEMBER_INTEGER), // ARRAY [32]
|
||||
PL_MEMBERS(m_rgAmmoLast, MEMBER_INTEGER), // ARRAY [32]
|
||||
PL_MEMBERS(m_rgAmmo, MEMBER_INTEGER),
|
||||
PL_MEMBERS(m_rgAmmoLast, MEMBER_INTEGER),
|
||||
PL_MEMBERS(m_vecAutoAim, MEMBER_VECTOR),
|
||||
PL_MEMBERS(m_fOnTarget, MEMBER_INTEGER),
|
||||
PL_MEMBERS(m_iDeaths, MEMBER_INTEGER),
|
||||
PL_MEMBERS(m_izSBarState, MEMBER_INTEGER), // ARRAY [4]
|
||||
PL_MEMBERS(m_izSBarState, MEMBER_INTEGER),
|
||||
PL_MEMBERS(m_flNextSBarUpdateTime, MEMBER_FLOAT),
|
||||
PL_MEMBERS(m_flStatusBarDisappearDelay, MEMBER_FLOAT),
|
||||
PL_MEMBERS(m_SbarString0, MEMBER_CHAR_ARRAY), // ARRAY [128]
|
||||
PL_MEMBERS(m_SbarString0, MEMBER_CHAR_ARRAY),
|
||||
PL_MEMBERS(m_lastx, MEMBER_INTEGER),
|
||||
PL_MEMBERS(m_lasty, MEMBER_INTEGER),
|
||||
PL_MEMBERS(m_nCustomSprayFrames, MEMBER_INTEGER),
|
||||
PL_MEMBERS(m_flNextDecalTime, MEMBER_FLOAT),
|
||||
PL_MEMBERS(m_szTeamName, MEMBER_CHAR_ARRAY), // ARRAY [16]
|
||||
PL_MEMBERS(m_szTeamName, MEMBER_CHAR_ARRAY),
|
||||
PL_MEMBERS(m_modelIndexPlayer, MEMBER_INTEGER),
|
||||
PL_MEMBERS(m_szAnimExtention, MEMBER_CHAR_ARRAY), // ARRAY [32]
|
||||
PL_MEMBERS(m_szAnimExtention, MEMBER_CHAR_ARRAY),
|
||||
PL_MEMBERS(m_iGaitsequence, MEMBER_INTEGER),
|
||||
PL_MEMBERS(m_flGaitframe, MEMBER_FLOAT),
|
||||
PL_MEMBERS(m_flGaityaw, MEMBER_FLOAT),
|
||||
@ -295,12 +328,12 @@ member_t memberlist_player[] = {
|
||||
PL_MEMBERS(m_blindFadeTime, MEMBER_FLOAT),
|
||||
PL_MEMBERS(m_blindAlpha, MEMBER_INTEGER),
|
||||
PL_MEMBERS(m_allowAutoFollowTime, MEMBER_FLOAT),
|
||||
PL_MEMBERS(m_autoBuyString, MEMBER_CHAR_ARRAY), // ARRAY 256
|
||||
PL_MEMBERS(m_autoBuyString, MEMBER_CHAR_ARRAY),
|
||||
PL_MEMBERS(m_rebuyString, MEMBER_CHAR_POINTER),
|
||||
PL_MEMBERS(m_rebuyStruct, MEBMER_REBUYSTRUCT),
|
||||
PL_MEMBERS(m_bIsInRebuy, MEMBER_BOOL),
|
||||
PL_MEMBERS(m_flLastUpdateTime, MEMBER_FLOAT),
|
||||
PL_MEMBERS(m_lastLocation, MEMBER_CHAR_ARRAY), // ARRAY [32]
|
||||
PL_MEMBERS(m_lastLocation, MEMBER_CHAR_ARRAY),
|
||||
PL_MEMBERS(m_progressStart, MEMBER_FLOAT),
|
||||
PL_MEMBERS(m_progressEnd, MEMBER_FLOAT),
|
||||
PL_MEMBERS(m_bObserverAutoDirector, MEMBER_BOOL),
|
||||
@ -309,7 +342,7 @@ member_t memberlist_player[] = {
|
||||
PL_MEMBERS(m_intenseTimestamp, MEMBER_FLOAT),
|
||||
PL_MEMBERS(m_silentTimestamp, MEMBER_FLOAT),
|
||||
PL_MEMBERS(m_musicState, MEMBER_INTEGER),
|
||||
PL_MEMBERS(m_flLastCommandTime, MEMBER_FLOAT), // ARRAY [8]
|
||||
PL_MEMBERS(m_flLastCommandTime, MEMBER_FLOAT),
|
||||
};
|
||||
|
||||
memberlist_t memberlist;
|
||||
@ -323,6 +356,8 @@ member_t *memberlist_t::operator[](size_t members) const
|
||||
|
||||
switch (table) {
|
||||
CASE(gamerules)
|
||||
CASE(base)
|
||||
CASE(animating)
|
||||
CASE(player)
|
||||
}
|
||||
|
||||
|
@ -38,6 +38,8 @@ struct memberlist_t
|
||||
enum members_tables_e
|
||||
{
|
||||
ht_gamerules,
|
||||
ht_base,
|
||||
ht_animating,
|
||||
ht_player
|
||||
};
|
||||
};
|
||||
@ -133,6 +135,46 @@ enum CSGameRules_Members
|
||||
m_bSkipSpawn
|
||||
};
|
||||
|
||||
// CBasePlayer
|
||||
enum CBaseEntity_Members
|
||||
{
|
||||
currentammo = BEGIN_MEMBER_REGION(base),
|
||||
maxammo_buckshot,
|
||||
ammo_buckshot,
|
||||
maxammo_9mm,
|
||||
ammo_9mm,
|
||||
maxammo_556nato,
|
||||
ammo_556nato,
|
||||
maxammo_556natobox,
|
||||
ammo_556natobox,
|
||||
maxammo_762nato,
|
||||
ammo_762nato,
|
||||
maxammo_45acp,
|
||||
ammo_45acp,
|
||||
maxammo_50ae,
|
||||
ammo_50ae,
|
||||
maxammo_338mag,
|
||||
ammo_338mag,
|
||||
maxammo_57mm,
|
||||
ammo_57mm,
|
||||
maxammo_357sig,
|
||||
ammo_357sig,
|
||||
m_flStartThrow,
|
||||
m_flReleaseThrow,
|
||||
m_iSwing,
|
||||
has_disconnected,
|
||||
};
|
||||
|
||||
// CBaseAnimating
|
||||
enum CBaseAnimating_Members
|
||||
{
|
||||
m_flFrameRate = BEGIN_MEMBER_REGION(animating),
|
||||
m_flGroundSpeed,
|
||||
m_flLastEventCheck,
|
||||
m_fSequenceFinished,
|
||||
m_fSequenceLoops,
|
||||
};
|
||||
|
||||
// CBasePlayer
|
||||
enum CBasePlayer_Members
|
||||
{
|
||||
|
@ -11,7 +11,7 @@ plugin_info_t Plugin_info =
|
||||
"ReAPI", // name
|
||||
APP_VERSION_STRD, // version
|
||||
APP_VERSION_YMD_STR, // date
|
||||
"s1lent", // author
|
||||
"Asmodai & s1lent", // author
|
||||
"https://github.com/s1lentq/reapi/", // url
|
||||
"ReAPI", // logtag, all caps please
|
||||
PT_ANYTIME, // (when) loadable
|
||||
@ -33,7 +33,7 @@ META_FUNCTIONS gMetaFunctionTable =
|
||||
{
|
||||
NULL, // pfnGetEntityAPI HL SDK; called before game DLL
|
||||
NULL, // pfnGetEntityAPI_Post META; called after game DLL
|
||||
NULL, // pfnGetEntityAPI2 HL SDK2; called before game DLL
|
||||
GetEntityAPI2, // pfnGetEntityAPI2 HL SDK2; called before game DLL
|
||||
GetEntityAPI2_Post, // pfnGetEntityAPI2_Post META; called after game DLL
|
||||
NULL, // pfnGetNewDLLFunctions HL SDK2; called before game DLL
|
||||
NULL, // pfnGetNewDLLFunctions_Post META; called after game DLL
|
||||
|
@ -52,7 +52,6 @@ bool RegamedllApi_Init()
|
||||
|
||||
g_ReGameFuncs = g_ReGameApi->GetFuncs();
|
||||
g_ReGameHookchains = g_ReGameApi->GetHookchains();
|
||||
g_pCSGameRules = (CHalfLifeMultiplay **)g_ReGameApi->GetGameData()->GetGameRules();
|
||||
|
||||
return true;
|
||||
}
|
@ -7,7 +7,7 @@
|
||||
* @param function The function to hook.
|
||||
* @param callback The forward to call.
|
||||
* @param post Whether or not to forward this in post.
|
||||
* @return Returns a handle to the hook. Use EnableHookChain/DisableHookChain to toggle the forward on or off.
|
||||
* @return Returns a handle to the hook. Use EnableHookChain/DisableHookChain to toggle the forward on or off.
|
||||
*
|
||||
* native RegisterHookChain(any:function_id, const callback[], post = 0);
|
||||
*/
|
||||
@ -51,11 +51,11 @@ static cell AMX_NATIVE_CALL RegisterHookChain(AMX *amx, cell *params)
|
||||
}
|
||||
|
||||
/*
|
||||
* Disable hook by handle.
|
||||
* Enable hook by handle.
|
||||
* Use the return value from RegisterHookChain as the parameter here!
|
||||
*
|
||||
* @param fwd The hook to re-enable.
|
||||
* @return Returns if the function is successful executed true otherwise false
|
||||
* @return Returns if the function is successful executed true otherwise false
|
||||
*
|
||||
* native bool:EnableHookChain(any:fwd);
|
||||
*/
|
||||
@ -72,12 +72,12 @@ static cell AMX_NATIVE_CALL EnableHookChain(AMX *amx, cell *params)
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
hook->m_state = FSTATE_ENABLED;
|
||||
hook->SetState(FSTATE_ENABLED);
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
/*
|
||||
* Enable hook by handle.
|
||||
* Disable hook by handle.
|
||||
* Use the return value from RegisterHookChain as the parameter here!
|
||||
*
|
||||
* @param fwd The hook to stop.
|
||||
@ -97,7 +97,7 @@ static cell AMX_NATIVE_CALL DisableHookChain(AMX *amx, cell *params)
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
hook->m_state = FSTATE_STOPPED;
|
||||
hook->SetState(FSTATE_STOPPED);
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
@ -164,7 +164,7 @@ static cell AMX_NATIVE_CALL SetHookChainReturn(AMX *amx, cell *params)
|
||||
*
|
||||
* @param value The value to set the return to.
|
||||
* @param [maxlen] Max length of string (optional)
|
||||
* @return Returns if the function is successful executed true otherwise false
|
||||
* @return Returns if the function is successful executed true otherwise false
|
||||
*
|
||||
* native GetHookChainReturn(AType:type, any:...);
|
||||
*/
|
||||
@ -190,7 +190,7 @@ static cell AMX_NATIVE_CALL GetHookChainReturn(AMX *amx, cell *params)
|
||||
break;
|
||||
case ATYPE_STRING:
|
||||
{
|
||||
if (params[arg_count] != 2)
|
||||
if (PARAMS_COUNT != 2)
|
||||
return FALSE;
|
||||
|
||||
setAmxString(dstAddr, retVal._string, params[arg_maxlen]);
|
||||
@ -213,7 +213,7 @@ static cell AMX_NATIVE_CALL GetHookChainReturn(AMX *amx, cell *params)
|
||||
* @param number Number of argument
|
||||
* @param value New value
|
||||
* @param [maxlen] Max length of string (optional)
|
||||
* @return Returns if the function is successful executed true otherwise false
|
||||
* @return Returns if the function is successful executed true otherwise false
|
||||
*
|
||||
* native SetHookChainArg(number, AType:type, any:...);
|
||||
*/
|
||||
|
@ -3,7 +3,7 @@
|
||||
// native set_member(_index, any:_member, any:...);
|
||||
static cell AMX_NATIVE_CALL set_member(AMX *amx, cell *params)
|
||||
{
|
||||
enum args_member_e { arg_count, arg_index, arg_member, arg_value, arg_elem };
|
||||
enum args_e { arg_count, arg_index, arg_member, arg_value, arg_elem };
|
||||
member_t *member = memberlist[params[arg_member]];
|
||||
|
||||
if (member == nullptr) {
|
||||
@ -13,20 +13,20 @@ static cell AMX_NATIVE_CALL set_member(AMX *amx, cell *params)
|
||||
|
||||
edict_t *pEdict = INDEXENT(params[arg_index]);
|
||||
if (pEdict == nullptr || pEdict->pvPrivateData == nullptr) {
|
||||
MF_LogError(amx, AMX_ERR_NATIVE, "set_member: invalid or uninitialized entity", params[arg_member]);
|
||||
MF_LogError(amx, AMX_ERR_NATIVE, "set_member: invalid or uninitialized entity");
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
cell* value = getAmxAddr(amx, params[arg_value]);
|
||||
size_t element = (params[arg_count] == 4) ? *getAmxAddr(amx, params[arg_elem]) : 0;
|
||||
size_t element = (PARAMS_COUNT == 4) ? *getAmxAddr(amx, params[arg_elem]) : 0;
|
||||
|
||||
return set_member(pEdict->pvPrivateData, member, element, value);
|
||||
}
|
||||
|
||||
// native any:get_member(_index = 0, any:_member, any:...);
|
||||
// native any:get_member(_index, any:_member, any:...);
|
||||
static cell AMX_NATIVE_CALL get_member(AMX *amx, cell *params)
|
||||
{
|
||||
enum args_member_e { arg_count, arg_index, arg_member, arg_3, arg_4 };
|
||||
enum args_e { arg_count, arg_index, arg_member, arg_3, arg_4 };
|
||||
member_t *member = memberlist[params[arg_member]];
|
||||
|
||||
if (member == nullptr) {
|
||||
@ -36,18 +36,18 @@ static cell AMX_NATIVE_CALL get_member(AMX *amx, cell *params)
|
||||
|
||||
edict_t *pEdict = INDEXENT(params[arg_index]);
|
||||
if (pEdict == nullptr || pEdict->pvPrivateData == nullptr) {
|
||||
MF_LogError(amx, AMX_ERR_NATIVE, "get_member: invalid or uninitialized entity", params[arg_member]);
|
||||
MF_LogError(amx, AMX_ERR_NATIVE, "get_member: invalid or uninitialized entity");
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
cell* dest;
|
||||
size_t element;
|
||||
|
||||
if (params[arg_count] == 4) {
|
||||
if (PARAMS_COUNT == 4) {
|
||||
dest = getAmxAddr(amx, params[arg_3]);
|
||||
element = *getAmxAddr(amx, params[arg_4]);
|
||||
}
|
||||
else if (params[arg_count] == 3) {
|
||||
else if (PARAMS_COUNT == 3) {
|
||||
cell* arg3 = getAmxAddr(amx, params[arg_3]);
|
||||
|
||||
if (isTypeReturnable(member->type)) {
|
||||
@ -70,16 +70,21 @@ static cell AMX_NATIVE_CALL get_member(AMX *amx, cell *params)
|
||||
// native set_member_game(any:_member, any:...);
|
||||
static cell AMX_NATIVE_CALL set_member_game(AMX *amx, cell *params)
|
||||
{
|
||||
enum args_member_e { arg_count, arg_member, arg_value, arg_elem };
|
||||
enum args_e { arg_count, arg_member, arg_value, arg_elem };
|
||||
member_t *member = memberlist[params[arg_member]];
|
||||
|
||||
if (member == nullptr) {
|
||||
MF_LogError(amx, AMX_ERR_NATIVE, "set_member_game: unknown member id %i", params[arg_member]);
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
|
||||
if (g_pCSGameRules == nullptr || *g_pCSGameRules == nullptr) {
|
||||
MF_LogError(amx, AMX_ERR_NATIVE, "get_member_game: gamerules not initialized");
|
||||
return 0;
|
||||
}
|
||||
|
||||
cell* value = getAmxAddr(amx, params[arg_value]);
|
||||
size_t element = (params[arg_count] == 4) ? *getAmxAddr(amx, params[arg_elem]) : 0;
|
||||
size_t element = (PARAMS_COUNT == 4) ? *getAmxAddr(amx, params[arg_elem]) : 0;
|
||||
|
||||
return set_member(*g_pCSGameRules, member, element, value);
|
||||
}
|
||||
@ -87,7 +92,7 @@ static cell AMX_NATIVE_CALL set_member_game(AMX *amx, cell *params)
|
||||
// native get_member_game(any:_member, any:...);
|
||||
static cell AMX_NATIVE_CALL get_member_game(AMX *amx, cell *params)
|
||||
{
|
||||
enum args_member_e { arg_count, arg_member, arg_3, arg_4 };
|
||||
enum args_e { arg_count, arg_member, arg_3, arg_4 };
|
||||
member_t *member = memberlist[params[arg_member]];
|
||||
|
||||
if (member == nullptr) {
|
||||
@ -95,14 +100,19 @@ static cell AMX_NATIVE_CALL get_member_game(AMX *amx, cell *params)
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (g_pCSGameRules == nullptr || *g_pCSGameRules == nullptr) {
|
||||
MF_LogError(amx, AMX_ERR_NATIVE, "get_member_game: gamerules not initialized");
|
||||
return 0;
|
||||
}
|
||||
|
||||
cell* dest;
|
||||
size_t element;
|
||||
|
||||
if (params[arg_count] == 4) {
|
||||
|
||||
if (PARAMS_COUNT == 4) {
|
||||
dest = getAmxAddr(amx, params[arg_3]);
|
||||
element = *getAmxAddr(amx, params[arg_4]);
|
||||
}
|
||||
else if (params[arg_count] == 3) {
|
||||
else if (PARAMS_COUNT == 3) {
|
||||
cell* arg3 = getAmxAddr(amx, params[arg_3]);
|
||||
|
||||
if (isTypeReturnable(member->type)) {
|
||||
@ -183,18 +193,9 @@ BOOL set_member(void* pdata, const member_t *member, size_t element, cell* value
|
||||
case MEMBER_CHAR_POINTER:
|
||||
{
|
||||
// native set_member(_index, any:_member, const source[]);
|
||||
size_t len;
|
||||
char *source = getAmxString(value, &len);
|
||||
char *source = getAmxString(value);
|
||||
char *&dest = get_member<char *>(pdata, member->offset);
|
||||
|
||||
if (dest != nullptr) {
|
||||
delete[] dest;
|
||||
}
|
||||
|
||||
dest = new char[len + 1];
|
||||
strcpy(dest, source);
|
||||
|
||||
set_member<char *>(pdata, member->offset, dest);
|
||||
g_ReGameFuncs->ChangeString(dest, source);
|
||||
return TRUE;
|
||||
}
|
||||
case MEMBER_FLOAT:
|
||||
|
189
reapi/src/natives_misc.cpp
Normal file
189
reapi/src/natives_misc.cpp
Normal file
@ -0,0 +1,189 @@
|
||||
#include "precompiled.h"
|
||||
|
||||
// native rg_set_animation(index, PLAYER_ANIM:playerAnim);
|
||||
static cell AMX_NATIVE_CALL rg_set_animation(AMX *amx, cell *params)
|
||||
{
|
||||
enum args_e { arg_count, arg_index, arg_anim };
|
||||
|
||||
ICSPlayer *pPlayer = g_ReGameFuncs->INDEX_TO_CSPLAYER(params[arg_index]);
|
||||
if (pPlayer == nullptr || !pPlayer->IsConnected()) {
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
pPlayer->SetAnimation(static_cast<PLAYER_ANIM>(params[arg_anim]));
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
// native rg_add_account(index, amount, bool:bTrackChange = true);
|
||||
static cell AMX_NATIVE_CALL rg_add_account(AMX *amx, cell *params)
|
||||
{
|
||||
enum args_e { arg_count, arg_index, arg_amount, arg_track_change };
|
||||
|
||||
ICSPlayer *pPlayer = g_ReGameFuncs->INDEX_TO_CSPLAYER(params[arg_index]);
|
||||
if (pPlayer == nullptr || !pPlayer->IsConnected()) {
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
pPlayer->AddAccount(params[arg_amount], params[arg_track_change] != 0);
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
// native rg_give_item(index, const pszName[]);
|
||||
static cell AMX_NATIVE_CALL rg_give_item(AMX *amx, cell *params)
|
||||
{
|
||||
enum args_e { arg_count, arg_index, arg_item };
|
||||
|
||||
ICSPlayer *pPlayer = g_ReGameFuncs->INDEX_TO_CSPLAYER(params[arg_index]);
|
||||
|
||||
if (pPlayer == nullptr || !pPlayer->IsConnected()) {
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
const char *itemName = getAmxString(amx, params[arg_item]);
|
||||
pPlayer->GiveNamedItem(itemName);
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
// native rg_give_default_items(index);
|
||||
static cell AMX_NATIVE_CALL rg_give_default_items(AMX *amx, cell *params)
|
||||
{
|
||||
enum args_e { arg_count, arg_index };
|
||||
|
||||
ICSPlayer *pPlayer = g_ReGameFuncs->INDEX_TO_CSPLAYER(params[arg_index]);
|
||||
if (pPlayer == nullptr || !pPlayer->IsConnected()) {
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
pPlayer->GiveDefaultItems();
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
// native rg_give_shield(index, bool:bDeploy = true);
|
||||
static cell AMX_NATIVE_CALL rg_give_shield(AMX *amx, cell *params)
|
||||
{
|
||||
enum args_e { arg_count, arg_index, arg_deploy };
|
||||
|
||||
ICSPlayer *pPlayer = g_ReGameFuncs->INDEX_TO_CSPLAYER(params[arg_index]);
|
||||
if (pPlayer == nullptr || !pPlayer->IsConnected()) {
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
pPlayer->GiveShield(params[arg_deploy] != 0);
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
// native rg_dmg_radius(Float:vecSrc[3], inflictor, attacker, Float:flDamage, Float:flRadius, iClassIgnore, bitsDamageType);
|
||||
static cell AMX_NATIVE_CALL rg_dmg_radius(AMX *amx, cell *params)
|
||||
{
|
||||
enum args_e { arg_count, arg_vec, arg_inflictor, arg_attacker, arg_damage, arg_radius, arg_ignore_class, arg_dmg_type };
|
||||
|
||||
cell *pSrc = getAmxAddr(amx, params[arg_vec]);
|
||||
|
||||
entvars_t *pevInflictor = VARS(INDEXENT(params[arg_inflictor]));
|
||||
entvars_t *pevAttacker = VARS(INDEXENT(params[arg_attacker]));
|
||||
|
||||
Vector vecSrc(*(float *)&pSrc[0], *(float *)&pSrc[1], *(float *)&pSrc[2]);
|
||||
g_ReGameFuncs->RadiusDamage(vecSrc, pevInflictor, pevAttacker, *(float *)¶ms[arg_damage], *(float *)¶ms[arg_radius], params[arg_ignore_class], params[arg_dmg_type]);
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
// native rg_multidmg_clear();
|
||||
static cell AMX_NATIVE_CALL rg_multidmg_clear(AMX *amx, cell *params)
|
||||
{
|
||||
g_ReGameFuncs->ClearMultiDamage();
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
// native rg_multidmg_apply(inflictor, attacker);
|
||||
static cell AMX_NATIVE_CALL rg_multidmg_apply(AMX *amx, cell *params)
|
||||
{
|
||||
enum args_e { arg_count, arg_inflictor, arg_attacker };
|
||||
|
||||
entvars_t *pevInflictor = VARS(INDEXENT(params[arg_inflictor]));
|
||||
entvars_t *pevAttacker = VARS(INDEXENT(params[arg_attacker]));
|
||||
|
||||
g_ReGameFuncs->ApplyMultiDamage(pevInflictor, pevAttacker);
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
// native rg_multidmg_add(inflictor, victim, Float:flDamage, bitsDamageType);
|
||||
static cell AMX_NATIVE_CALL rg_multidmg_add(AMX *amx, cell *params)
|
||||
{
|
||||
enum args_e { arg_count, arg_inflictor, arg_victim, arg_damage, arg_dmg_type };
|
||||
|
||||
entvars_t *pevInflictor = VARS(INDEXENT(params[arg_inflictor]));
|
||||
CBaseEntity *pVictim = g_ReGameFuncs->UTIL_PlayerByIndex(params[arg_inflictor]);
|
||||
|
||||
if (pVictim == nullptr) {
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
g_ReGameFuncs->AddMultiDamage(pevInflictor, pVictim, *(float *)¶ms[arg_damage], params[arg_dmg_type]);
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
// native rg_fire_bullets(inflictor, attacker, shots, Float:vecSrc[3], Float:vecDirShooting[3], Float::vecSpread[3], Float:flDistance, iBulletType, iTracerFreq, iDamage);
|
||||
static cell AMX_NATIVE_CALL rg_fire_bullets(AMX *amx, cell *params)
|
||||
{
|
||||
enum args_e { arg_count, arg_inflictor, arg_attacker, arg_shots, arg_vecSrc, arg_dir, arg_spread, arg_dist, arg_bullet_type, arg_tracefrq, arg_dmg };
|
||||
|
||||
ICSEntity *pInflictor = g_ReGameFuncs->INDEX_TO_CSENTITY(params[arg_inflictor]);
|
||||
|
||||
cell *pSrc = getAmxAddr(amx, params[arg_vecSrc]);
|
||||
Vector vecSrc(*(float *)&pSrc[0], *(float *)&pSrc[1], *(float *)&pSrc[2]);
|
||||
|
||||
cell *pDir = getAmxAddr(amx, params[arg_dir]);
|
||||
Vector vecDirShooting(*(float *)&pDir[0], *(float *)&pDir[1], *(float *)&pDir[2]);
|
||||
|
||||
cell *pSpread = getAmxAddr(amx, params[arg_spread]);
|
||||
Vector vecSpread(*(float *)&pSpread[0], *(float *)&pSpread[1], *(float *)&pSpread[2]);
|
||||
|
||||
entvars_t *pevAttacker = VARS(INDEXENT(params[arg_attacker]));
|
||||
pInflictor->FireBullets(params[arg_shots], vecSrc, vecDirShooting, vecSpread, *(float *)¶ms[arg_dist], params[arg_bullet_type], params[arg_tracefrq], params[arg_dmg], pevAttacker);
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
// native Float:[3] rg_fire_bullets3(inflictor, attacker, Float:vecSrc[3], Float:vecDirShooting[3], Float:vecSpread, Float:flDistance, iPenetration, iBulletType, iDamage, Float:flRangeModifier, bool:bPistol, shared_rand);
|
||||
static cell AMX_NATIVE_CALL rg_fire_bullets3(AMX *amx, cell *params)
|
||||
{
|
||||
enum args_e { arg_count, arg_inflictor, arg_attacker, arg_vecSrc, arg_dir, arg_spread, arg_dist, arg_penetration, arg_bullet_type, arg_dmg, arg_range_mod, arg_pistol, arg_rand, arg_out };
|
||||
|
||||
ICSEntity *pInflictor = g_ReGameFuncs->INDEX_TO_CSENTITY(params[arg_inflictor]);
|
||||
|
||||
cell *pSrc = getAmxAddr(amx, params[arg_vecSrc]);
|
||||
Vector vecSrc(*(float *)&pSrc[0], *(float *)&pSrc[1], *(float *)&pSrc[2]);
|
||||
|
||||
cell *pDir = getAmxAddr(amx, params[arg_dir]);
|
||||
Vector vecDirShooting(*(float *)&pDir[0], *(float *)&pDir[1], *(float *)&pDir[2]);
|
||||
|
||||
entvars_t *pevAttacker = VARS(INDEXENT(params[arg_attacker]));
|
||||
|
||||
Vector *pOut = (Vector *)getAmxAddr(amx, params[arg_out]);
|
||||
*pOut = pInflictor->FireBullets3(vecSrc, vecDirShooting, *(float *)¶ms[arg_spread], *(float *)¶ms[arg_dist], params[arg_penetration], params[arg_bullet_type], params[arg_dmg], *(float *)¶ms[arg_range_mod], pevAttacker, params[arg_pistol] != 0, params[arg_rand]);
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
AMX_NATIVE_INFO Misc_Natives[] =
|
||||
{
|
||||
{ "rg_set_animation", rg_set_animation },
|
||||
{ "rg_add_account", rg_add_account },
|
||||
{ "rg_give_item", rg_give_item },
|
||||
{ "rg_give_default_items", rg_give_default_items },
|
||||
{ "rg_give_shield", rg_give_shield },
|
||||
|
||||
{ "rg_dmg_radius", rg_dmg_radius },
|
||||
{ "rg_multidmg_clear", rg_multidmg_clear },
|
||||
{ "rg_multidmg_apply", rg_multidmg_apply },
|
||||
{ "rg_multidmg_add", rg_multidmg_add },
|
||||
|
||||
{ "rg_fire_bullets", rg_fire_bullets },
|
||||
{ "rg_fire_bullets3", rg_fire_bullets3 },
|
||||
|
||||
{ nullptr, nullptr }
|
||||
};
|
||||
|
||||
void RegisterNatives_Misc()
|
||||
{
|
||||
g_amxxapi.AddNatives(Misc_Natives);
|
||||
}
|
3
reapi/src/natives_misc.h
Normal file
3
reapi/src/natives_misc.h
Normal file
@ -0,0 +1,3 @@
|
||||
#pragma once
|
||||
|
||||
void RegisterNatives_Misc();
|
@ -38,6 +38,7 @@
|
||||
#include "member_list.h"
|
||||
#include "natives_hookchains.h"
|
||||
#include "natives_members.h"
|
||||
#include "natives_misc.h"
|
||||
|
||||
#undef DLLEXPORT
|
||||
#ifdef _WIN32
|
||||
|
@ -4,5 +4,5 @@
|
||||
#define _reapi_const_included
|
||||
|
||||
// reapi version
|
||||
#define REAPI_VERISON_MAJOR 1
|
||||
#define REAPI_VERISON_MAJOR 2
|
||||
#define REAPI_VERISON_MINOR 0
|
||||
|
Loading…
x
Reference in New Issue
Block a user