mirror of
https://github.com/rehlds/reapi.git
synced 2025-01-16 00:28:17 +03:00
Added natives set_entvar/get_entvar, rg_get_user_bpammo/rg_set_user_bpammo, rg_give_defusekit, rg_get_user_armor/rg_set_user_armor,
This commit is contained in:
parent
c62f2ad897
commit
979b5a9ebe
@ -5,3 +5,15 @@
|
||||
#define _reapi_engine_included
|
||||
|
||||
#include <reapi_engine_const.inc>
|
||||
|
||||
/*
|
||||
* Sets entvars data for an entity.
|
||||
* Use the var_* EntVars enum
|
||||
*/
|
||||
native set_entvar(const index, const EntVars:var, any:...);
|
||||
|
||||
/*
|
||||
* Returns entvar data from an entity.
|
||||
* Use the var_* EntVars enum
|
||||
*/
|
||||
native any:get_entvar(const index, const EntVars:var, any:...);
|
||||
|
@ -33,3 +33,992 @@ enum EngineFunc
|
||||
// [...]
|
||||
RH_EngineFunc_End
|
||||
};
|
||||
|
||||
enum EntVars
|
||||
{
|
||||
/*
|
||||
* Description: -
|
||||
* Member type: string_t
|
||||
* Get params: get_entvar(index, EntVars:var, dest[], const lenght);
|
||||
* Set params: set_entvar(index, EntVars:var, const source[]);
|
||||
*/
|
||||
var_classname = 4096,
|
||||
|
||||
/*
|
||||
* Description: -
|
||||
* Member type: string_t
|
||||
* Get params: get_entvar(index, EntVars:var, dest[], const lenght);
|
||||
* Set params: set_entvar(index, EntVars:var, const source[]);
|
||||
*/
|
||||
var_globalname,
|
||||
|
||||
/*
|
||||
* Description: -
|
||||
* Member type: class Vector
|
||||
* Get params: get_entvar(index, EntVars:var, Float:output[3]);
|
||||
* Set params: set_entvar(index, EntVars:var, Float:dest[3]);
|
||||
*/
|
||||
var_origin,
|
||||
|
||||
/*
|
||||
* Description: -
|
||||
* Member type: class Vector
|
||||
* Get params: get_entvar(index, EntVars:var, Float:output[3]);
|
||||
* Set params: set_entvar(index, EntVars:var, Float:dest[3]);
|
||||
*/
|
||||
var_oldorigin,
|
||||
|
||||
/*
|
||||
* Description: -
|
||||
* Member type: class Vector
|
||||
* Get params: get_entvar(index, EntVars:var, Float:output[3]);
|
||||
* Set params: set_entvar(index, EntVars:var, Float:dest[3]);
|
||||
*/
|
||||
var_velocity,
|
||||
|
||||
/*
|
||||
* Description: -
|
||||
* Member type: class Vector
|
||||
* Get params: get_entvar(index, EntVars:var, Float:output[3]);
|
||||
* Set params: set_entvar(index, EntVars:var, Float:dest[3]);
|
||||
*/
|
||||
var_basevelocity,
|
||||
|
||||
/*
|
||||
* Description: Base velocity that was passed in to server physics so client can predict conveyors correctly. Server zeroes it, so we need to store here, too.
|
||||
* Member type: class Vector
|
||||
* Get params: get_entvar(index, EntVars:var, Float:output[3]);
|
||||
* Set params: set_entvar(index, EntVars:var, Float:dest[3]);
|
||||
*/
|
||||
var_clbasevelocity,
|
||||
|
||||
/*
|
||||
* Description: -
|
||||
* Member type: class Vector
|
||||
* Get params: get_entvar(index, EntVars:var, Float:output[3]);
|
||||
* Set params: set_entvar(index, EntVars:var, Float:dest[3]);
|
||||
*/
|
||||
var_movedir,
|
||||
|
||||
/*
|
||||
* Description: Model angles
|
||||
* Member type: class Vector
|
||||
* Get params: get_entvar(index, EntVars:var, Float:output[3]);
|
||||
* Set params: set_entvar(index, EntVars:var, Float:dest[3]);
|
||||
*/
|
||||
var_angles,
|
||||
|
||||
/*
|
||||
* Description: angle velocity (degrees per second)
|
||||
* Member type: class Vector
|
||||
* Get params: get_entvar(index, EntVars:var, Float:output[3]);
|
||||
* Set params: set_entvar(index, EntVars:var, Float:dest[3]);
|
||||
*/
|
||||
var_avelocity,
|
||||
|
||||
/*
|
||||
* Description: auto-decaying view angle adjustment
|
||||
* Member type: class Vector
|
||||
* Get params: get_entvar(index, EntVars:var, Float:output[3]);
|
||||
* Set params: set_entvar(index, EntVars:var, Float:dest[3]);
|
||||
*/
|
||||
var_punchangle,
|
||||
|
||||
/*
|
||||
* Description: Viewing angle (player only)
|
||||
* Member type: class Vector
|
||||
* Get params: get_entvar(index, EntVars:var, Float:output[3]);
|
||||
* Set params: set_entvar(index, EntVars:var, Float:dest[3]);
|
||||
*/
|
||||
var_v_angle,
|
||||
|
||||
/*
|
||||
* Description: -
|
||||
* Member type: class Vector
|
||||
* Get params: get_entvar(index, EntVars:var, Float:output[3]);
|
||||
* Set params: set_entvar(index, EntVars:var, Float:dest[3]);
|
||||
*/
|
||||
var_endpos,
|
||||
|
||||
/*
|
||||
* Description: -
|
||||
* Member type: class Vector
|
||||
* Get params: get_entvar(index, EntVars:var, Float:output[3]);
|
||||
* Set params: set_entvar(index, EntVars:var, Float:dest[3]);
|
||||
*/
|
||||
var_startpos,
|
||||
|
||||
/*
|
||||
* Description: -
|
||||
* Member type: float
|
||||
* Get params: Float:get_entvar(index, EntVars:var);
|
||||
* Set params: set_entvar(index, EntVars:var, Float:value);
|
||||
*/
|
||||
var_impacttime,
|
||||
|
||||
/*
|
||||
* Description: -
|
||||
* Member type: float
|
||||
* Get params: Float:get_entvar(index, EntVars:var);
|
||||
* Set params: set_entvar(index, EntVars:var, Float:value);
|
||||
*/
|
||||
var_starttime,
|
||||
|
||||
/*
|
||||
* Description: 0:nothing, 1:force view angles, 2:add avelocity
|
||||
* Member type: int
|
||||
* Get params: get_entvar(index, EntVars:var);
|
||||
* Set params: set_entvar(index, EntVars:var, value);
|
||||
*/
|
||||
var_fixangle,
|
||||
|
||||
/*
|
||||
* Description: -
|
||||
* Member type: float
|
||||
* Get params: Float:get_entvar(index, EntVars:var);
|
||||
* Set params: set_entvar(index, EntVars:var, Float:value);
|
||||
*/
|
||||
var_idealpitch,
|
||||
|
||||
/*
|
||||
* Description: -
|
||||
* Member type: float
|
||||
* Get params: Float:get_entvar(index, EntVars:var);
|
||||
* Set params: set_entvar(index, EntVars:var, Float:value);
|
||||
*/
|
||||
var_pitch_speed,
|
||||
|
||||
/*
|
||||
* Description: -
|
||||
* Member type: float
|
||||
* Get params: Float:get_entvar(index, EntVars:var);
|
||||
* Set params: set_entvar(index, EntVars:var, Float:value);
|
||||
*/
|
||||
var_ideal_yaw,
|
||||
|
||||
/*
|
||||
* Description: -
|
||||
* Member type: float
|
||||
* Get params: Float:get_entvar(index, EntVars:var);
|
||||
* Set params: set_entvar(index, EntVars:var, Float:value);
|
||||
*/
|
||||
var_yaw_speed,
|
||||
|
||||
/*
|
||||
* Description: -
|
||||
* Member type: int
|
||||
* Get params: get_entvar(index, EntVars:var);
|
||||
* Set params: set_entvar(index, EntVars:var, value);
|
||||
*/
|
||||
var_modelindex,
|
||||
|
||||
/*
|
||||
* Description: -
|
||||
* Member type: string_t
|
||||
* Get params: get_entvar(index, EntVars:var, dest[], const lenght);
|
||||
* Set params: set_entvar(index, EntVars:var, const source[]);
|
||||
*/
|
||||
var_model,
|
||||
|
||||
/*
|
||||
* Description: player's viewmodel
|
||||
* Member type: int
|
||||
* Get params: get_entvar(index, EntVars:var);
|
||||
* Set params: set_entvar(index, EntVars:var, value);
|
||||
*/
|
||||
var_viewmodel,
|
||||
|
||||
/*
|
||||
* Description: what other players see
|
||||
* Member type: int
|
||||
* Get params: get_entvar(index, EntVars:var);
|
||||
* Set params: set_entvar(index, EntVars:var, value);
|
||||
*/
|
||||
var_weaponmodel,
|
||||
|
||||
/*
|
||||
* Description: BB min translated to world coord
|
||||
* Member type: class Vector
|
||||
* Get params: get_entvar(index, EntVars:var, Float:output[3]);
|
||||
* Set params: set_entvar(index, EntVars:var, Float:dest[3]);
|
||||
*/
|
||||
var_absmin,
|
||||
|
||||
/*
|
||||
* Description: BB max translated to world coord
|
||||
* Member type: class Vector
|
||||
* Get params: get_entvar(index, EntVars:var, Float:output[3]);
|
||||
* Set params: set_entvar(index, EntVars:var, Float:dest[3]);
|
||||
*/
|
||||
var_absmax,
|
||||
|
||||
/*
|
||||
* Description: local BB min
|
||||
* Member type: class Vector
|
||||
* Get params: get_entvar(index, EntVars:var, Float:output[3]);
|
||||
* Set params: set_entvar(index, EntVars:var, Float:dest[3]);
|
||||
*/
|
||||
var_mins,
|
||||
|
||||
/*
|
||||
* Description: local BB max
|
||||
* Member type: class Vector
|
||||
* Get params: get_entvar(index, EntVars:var, Float:output[3]);
|
||||
* Set params: set_entvar(index, EntVars:var, Float:dest[3]);
|
||||
*/
|
||||
var_maxs,
|
||||
|
||||
/*
|
||||
* Description: maxs - mins
|
||||
* Member type: class Vector
|
||||
* Get params: get_entvar(index, EntVars:var, Float:output[3]);
|
||||
* Set params: set_entvar(index, EntVars:var, Float:dest[3]);
|
||||
*/
|
||||
var_size,
|
||||
|
||||
/*
|
||||
* Description: -
|
||||
* Member type: float
|
||||
* Get params: Float:get_entvar(index, EntVars:var);
|
||||
* Set params: set_entvar(index, EntVars:var, Float:value);
|
||||
*/
|
||||
var_ltime,
|
||||
|
||||
/*
|
||||
* Description: -
|
||||
* Member type: float
|
||||
* Get params: Float:get_entvar(index, EntVars:var);
|
||||
* Set params: set_entvar(index, EntVars:var, Float:value);
|
||||
*/
|
||||
var_nextthink,
|
||||
|
||||
/*
|
||||
* Description: -
|
||||
* Member type: int
|
||||
* Get params: get_entvar(index, EntVars:var);
|
||||
* Set params: set_entvar(index, EntVars:var, value);
|
||||
*/
|
||||
var_movetype,
|
||||
|
||||
/*
|
||||
* Description: -
|
||||
* Member type: int
|
||||
* Get params: get_entvar(index, EntVars:var);
|
||||
* Set params: set_entvar(index, EntVars:var, value);
|
||||
*/
|
||||
var_solid,
|
||||
|
||||
/*
|
||||
* Description: -
|
||||
* Member type: int
|
||||
* Get params: get_entvar(index, EntVars:var);
|
||||
* Set params: set_entvar(index, EntVars:var, value);
|
||||
*/
|
||||
var_skin,
|
||||
|
||||
/*
|
||||
* Description: -
|
||||
* Member type: int
|
||||
* Get params: get_entvar(index, EntVars:var);
|
||||
* Set params: set_entvar(index, EntVars:var, value);
|
||||
*/
|
||||
var_body,
|
||||
|
||||
/*
|
||||
* Description: sub-model selection for studiomodels
|
||||
* Member type: int
|
||||
* Get params: get_entvar(index, EntVars:var);
|
||||
* Set params: set_entvar(index, EntVars:var, value);
|
||||
*/
|
||||
var_effects,
|
||||
|
||||
/*
|
||||
* Description: % of "normal" gravity
|
||||
* Member type: float
|
||||
* Get params: Float:get_entvar(index, EntVars:var);
|
||||
* Set params: set_entvar(index, EntVars:var, Float:value);
|
||||
*/
|
||||
var_gravity,
|
||||
|
||||
/*
|
||||
* Description: inverse elasticity of MOVETYPE_BOUNCE
|
||||
* Member type: float
|
||||
* Get params: Float:get_entvar(index, EntVars:var);
|
||||
* Set params: set_entvar(index, EntVars:var, Float:value);
|
||||
*/
|
||||
var_friction,
|
||||
|
||||
/*
|
||||
* Description: -
|
||||
* Member type: int
|
||||
* Get params: get_entvar(index, EntVars:var);
|
||||
* Set params: set_entvar(index, EntVars:var, value);
|
||||
*/
|
||||
var_light_level,
|
||||
|
||||
/*
|
||||
* Description: animation sequence
|
||||
* Member type: int
|
||||
* Get params: get_entvar(index, EntVars:var);
|
||||
* Set params: set_entvar(index, EntVars:var, value);
|
||||
*/
|
||||
var_sequence,
|
||||
|
||||
/*
|
||||
* Description: movement animation sequence for player (0 for none)
|
||||
* Member type: int
|
||||
* Get params: get_entvar(index, EntVars:var);
|
||||
* Set params: set_entvar(index, EntVars:var, value);
|
||||
*/
|
||||
var_gaitsequence,
|
||||
|
||||
/*
|
||||
* Description: % playback position in animation sequences (0..255)
|
||||
* Member type: float
|
||||
* Get params: Float:get_entvar(index, EntVars:var);
|
||||
* Set params: set_entvar(index, EntVars:var, Float:value);
|
||||
*/
|
||||
var_frame,
|
||||
|
||||
/*
|
||||
* Description: world time when frame was set
|
||||
* Member type: float
|
||||
* Get params: Float:get_entvar(index, EntVars:var);
|
||||
* Set params: set_entvar(index, EntVars:var, Float:value);
|
||||
*/
|
||||
var_animtime,
|
||||
|
||||
/*
|
||||
* Description: animation playback rate (-8x to 8x)
|
||||
* Member type: float
|
||||
* Get params: Float:get_entvar(index, EntVars:var);
|
||||
* Set params: set_entvar(index, EntVars:var, Float:value);
|
||||
*/
|
||||
var_framerate,
|
||||
|
||||
/*
|
||||
* Description: bone controller setting (0..255)
|
||||
* Member type: byte [4]
|
||||
* Get params: get_entvar(index, EntVars:var, element);
|
||||
* Set params: set_entvar(index, EntVars:var, value, element);
|
||||
*/
|
||||
var_controller,
|
||||
|
||||
/*
|
||||
* Description: blending amount between sub-sequences (0..255)
|
||||
* Member type: byte [2]
|
||||
* Get params: get_entvar(index, EntVars:var, element);
|
||||
* Set params: set_entvar(index, EntVars:var, value, element);
|
||||
*/
|
||||
var_blending,
|
||||
|
||||
/*
|
||||
* Description: sprite rendering scale (0..255)
|
||||
* Member type: float
|
||||
* Get params: Float:get_entvar(index, EntVars:var);
|
||||
* Set params: set_entvar(index, EntVars:var, Float:value);
|
||||
*/
|
||||
var_scale,
|
||||
|
||||
/*
|
||||
* Description: -
|
||||
* Member type: int
|
||||
* Get params: get_entvar(index, EntVars:var);
|
||||
* Set params: set_entvar(index, EntVars:var, value);
|
||||
*/
|
||||
var_rendermode,
|
||||
|
||||
/*
|
||||
* Description: -
|
||||
* Member type: float
|
||||
* Get params: Float:get_entvar(index, EntVars:var);
|
||||
* Set params: set_entvar(index, EntVars:var, Float:value);
|
||||
*/
|
||||
var_renderamt,
|
||||
|
||||
/*
|
||||
* Description: -
|
||||
* Member type: class Vector
|
||||
* Get params: get_entvar(index, EntVars:var, Float:output[3]);
|
||||
* Set params: set_entvar(index, EntVars:var, Float:dest[3]);
|
||||
*/
|
||||
var_rendercolor,
|
||||
|
||||
/*
|
||||
* Description: -
|
||||
* Member type: int
|
||||
* Get params: get_entvar(index, EntVars:var);
|
||||
* Set params: set_entvar(index, EntVars:var, value);
|
||||
*/
|
||||
var_renderfx,
|
||||
|
||||
/*
|
||||
* Description: -
|
||||
* Member type: float
|
||||
* Get params: Float:get_entvar(index, EntVars:var);
|
||||
* Set params: set_entvar(index, EntVars:var, Float:value);
|
||||
*/
|
||||
var_health,
|
||||
|
||||
/*
|
||||
* Description: -
|
||||
* Member type: float
|
||||
* Get params: Float:get_entvar(index, EntVars:var);
|
||||
* Set params: set_entvar(index, EntVars:var, Float:value);
|
||||
*/
|
||||
var_frags,
|
||||
|
||||
/*
|
||||
* Description: bit mask for available weapons
|
||||
* Member type: int
|
||||
* Get params: get_entvar(index, EntVars:var);
|
||||
* Set params: set_entvar(index, EntVars:var, value);
|
||||
*/
|
||||
var_weapons,
|
||||
|
||||
/*
|
||||
* Description: -
|
||||
* Member type: float
|
||||
* Get params: Float:get_entvar(index, EntVars:var);
|
||||
* Set params: set_entvar(index, EntVars:var, Float:value);
|
||||
*/
|
||||
var_takedamage,
|
||||
|
||||
/*
|
||||
* Description: -
|
||||
* Member type: int
|
||||
* Get params: get_entvar(index, EntVars:var);
|
||||
* Set params: set_entvar(index, EntVars:var, value);
|
||||
*/
|
||||
var_deadflag,
|
||||
|
||||
/*
|
||||
* Description: eye position
|
||||
* Member type: class Vector
|
||||
* Get params: get_entvar(index, EntVars:var, Float:output[3]);
|
||||
* Set params: set_entvar(index, EntVars:var, Float:dest[3]);
|
||||
*/
|
||||
var_view_ofs,
|
||||
|
||||
/*
|
||||
* Description: -
|
||||
* Member type: int
|
||||
* Get params: get_entvar(index, EntVars:var);
|
||||
* Set params: set_entvar(index, EntVars:var, value);
|
||||
*/
|
||||
var_button,
|
||||
|
||||
/*
|
||||
* Description: -
|
||||
* Member type: int
|
||||
* Get params: get_entvar(index, EntVars:var);
|
||||
* Set params: set_entvar(index, EntVars:var, value);
|
||||
*/
|
||||
var_impulse,
|
||||
|
||||
/*
|
||||
* Description: Entity pointer when linked into a linked list
|
||||
* Member type: struct edict_s *
|
||||
* Get params: get_entvar(index, EntVars:var);
|
||||
* Set params: set_entvar(index, EntVars:var, value);
|
||||
*/
|
||||
var_chain,
|
||||
|
||||
/*
|
||||
* Description: -
|
||||
* Member type: struct edict_s *
|
||||
* Get params: get_entvar(index, EntVars:var);
|
||||
* Set params: set_entvar(index, EntVars:var, value);
|
||||
*/
|
||||
var_dmg_inflictor,
|
||||
|
||||
/*
|
||||
* Description: -
|
||||
* Member type: struct edict_s *
|
||||
* Get params: get_entvar(index, EntVars:var);
|
||||
* Set params: set_entvar(index, EntVars:var, value);
|
||||
*/
|
||||
var_enemy,
|
||||
|
||||
/*
|
||||
* Description: entity pointer when MOVETYPE_FOLLOW
|
||||
* Member type: struct edict_s *
|
||||
* Get params: get_entvar(index, EntVars:var);
|
||||
* Set params: set_entvar(index, EntVars:var, value);
|
||||
*/
|
||||
var_aiment,
|
||||
|
||||
/*
|
||||
* Description: -
|
||||
* Member type: struct edict_s *
|
||||
* Get params: get_entvar(index, EntVars:var);
|
||||
* Set params: set_entvar(index, EntVars:var, value);
|
||||
*/
|
||||
var_owner,
|
||||
|
||||
/*
|
||||
* Description: -
|
||||
* Member type: struct edict_s *
|
||||
* Get params: get_entvar(index, EntVars:var);
|
||||
* Set params: set_entvar(index, EntVars:var, value);
|
||||
*/
|
||||
var_groundentity,
|
||||
|
||||
/*
|
||||
* Description: -
|
||||
* Member type: int
|
||||
* Get params: get_entvar(index, EntVars:var);
|
||||
* Set params: set_entvar(index, EntVars:var, value);
|
||||
*/
|
||||
var_spawnflags,
|
||||
|
||||
/*
|
||||
* Description: -
|
||||
* Member type: int
|
||||
* Get params: get_entvar(index, EntVars:var);
|
||||
* Set params: set_entvar(index, EntVars:var, value);
|
||||
*/
|
||||
var_flags,
|
||||
|
||||
/*
|
||||
* Description: lowbyte topcolor, highbyte bottomcolor
|
||||
* Member type: int
|
||||
* Get params: get_entvar(index, EntVars:var);
|
||||
* Set params: set_entvar(index, EntVars:var, value);
|
||||
*/
|
||||
var_colormap,
|
||||
|
||||
/*
|
||||
* Description: -
|
||||
* Member type: int
|
||||
* Get params: get_entvar(index, EntVars:var);
|
||||
* Set params: set_entvar(index, EntVars:var, value);
|
||||
*/
|
||||
var_team,
|
||||
|
||||
/*
|
||||
* Description: -
|
||||
* Member type: float
|
||||
* Get params: Float:get_entvar(index, EntVars:var);
|
||||
* Set params: set_entvar(index, EntVars:var, Float:value);
|
||||
*/
|
||||
var_max_health,
|
||||
|
||||
/*
|
||||
* Description: -
|
||||
* Member type: float
|
||||
* Get params: Float:get_entvar(index, EntVars:var);
|
||||
* Set params: set_entvar(index, EntVars:var, Float:value);
|
||||
*/
|
||||
var_teleport_time,
|
||||
|
||||
/*
|
||||
* Description: -
|
||||
* Member type: float
|
||||
* Get params: Float:get_entvar(index, EntVars:var);
|
||||
* Set params: set_entvar(index, EntVars:var, Float:value);
|
||||
*/
|
||||
var_armortype,
|
||||
|
||||
/*
|
||||
* Description: -
|
||||
* Member type: float
|
||||
* Get params: Float:get_entvar(index, EntVars:var);
|
||||
* Set params: set_entvar(index, EntVars:var, Float:value);
|
||||
*/
|
||||
var_armorvalue,
|
||||
|
||||
/*
|
||||
* Description: -
|
||||
* Member type: int
|
||||
* Get params: get_entvar(index, EntVars:var);
|
||||
* Set params: set_entvar(index, EntVars:var, value);
|
||||
*/
|
||||
var_waterlevel,
|
||||
|
||||
/*
|
||||
* Description: -
|
||||
* Member type: int
|
||||
* Get params: get_entvar(index, EntVars:var);
|
||||
* Set params: set_entvar(index, EntVars:var, value);
|
||||
*/
|
||||
var_watertype,
|
||||
|
||||
/*
|
||||
* Description: -
|
||||
* Member type: string_t
|
||||
* Get params: get_entvar(index, EntVars:var, dest[], const lenght);
|
||||
* Set params: set_entvar(index, EntVars:var, const source[]);
|
||||
*/
|
||||
var_target,
|
||||
|
||||
/*
|
||||
* Description: -
|
||||
* Member type: string_t
|
||||
* Get params: get_entvar(index, EntVars:var, dest[], const lenght);
|
||||
* Set params: set_entvar(index, EntVars:var, const source[]);
|
||||
*/
|
||||
var_targetname,
|
||||
|
||||
/*
|
||||
* Description: -
|
||||
* Member type: string_t
|
||||
* Get params: get_entvar(index, EntVars:var, dest[], const lenght);
|
||||
* Set params: set_entvar(index, EntVars:var, const source[]);
|
||||
*/
|
||||
var_netname,
|
||||
|
||||
/*
|
||||
* Description: -
|
||||
* Member type: string_t
|
||||
* Get params: get_entvar(index, EntVars:var, dest[], const lenght);
|
||||
* Set params: set_entvar(index, EntVars:var, const source[]);
|
||||
*/
|
||||
var_message,
|
||||
|
||||
/*
|
||||
* Description: -
|
||||
* Member type: int
|
||||
* Get params: get_entvar(index, EntVars:var);
|
||||
* Set params: set_entvar(index, EntVars:var, value);
|
||||
*/
|
||||
var_dmg_take,
|
||||
|
||||
/*
|
||||
* Description: -
|
||||
* Member type: int
|
||||
* Get params: get_entvar(index, EntVars:var);
|
||||
* Set params: set_entvar(index, EntVars:var, value);
|
||||
*/
|
||||
var_dmg_save,
|
||||
|
||||
/*
|
||||
* Description: -
|
||||
* Member type: int
|
||||
* Get params: get_entvar(index, EntVars:var);
|
||||
* Set params: set_entvar(index, EntVars:var, value);
|
||||
*/
|
||||
var_dmg,
|
||||
|
||||
/*
|
||||
* Description: -
|
||||
* Member type: int
|
||||
* Get params: get_entvar(index, EntVars:var);
|
||||
* Set params: set_entvar(index, EntVars:var, value);
|
||||
*/
|
||||
var_dmgtime,
|
||||
|
||||
/*
|
||||
* Description: -
|
||||
* Member type: string_t
|
||||
* Get params: get_entvar(index, EntVars:var, dest[], const lenght);
|
||||
* Set params: set_entvar(index, EntVars:var, const source[]);
|
||||
*/
|
||||
var_noise,
|
||||
|
||||
/*
|
||||
* Description: -
|
||||
* Member type: string_t
|
||||
* Get params: get_entvar(index, EntVars:var, dest[], const lenght);
|
||||
* Set params: set_entvar(index, EntVars:var, const source[]);
|
||||
*/
|
||||
var_noise1,
|
||||
|
||||
/*
|
||||
* Description: -
|
||||
* Member type: string_t
|
||||
* Get params: get_entvar(index, EntVars:var, dest[], const lenght);
|
||||
* Set params: set_entvar(index, EntVars:var, const source[]);
|
||||
*/
|
||||
var_noise2,
|
||||
|
||||
/*
|
||||
* Description: -
|
||||
* Member type: string_t
|
||||
* Get params: get_entvar(index, EntVars:var, dest[], const lenght);
|
||||
* Set params: set_entvar(index, EntVars:var, const source[]);
|
||||
*/
|
||||
var_noise3,
|
||||
|
||||
/*
|
||||
* Description: -
|
||||
* Member type: float
|
||||
* Get params: Float:get_entvar(index, EntVars:var);
|
||||
* Set params: set_entvar(index, EntVars:var, Float:value);
|
||||
*/
|
||||
var_speed,
|
||||
|
||||
/*
|
||||
* Description: -
|
||||
* Member type: float
|
||||
* Get params: Float:get_entvar(index, EntVars:var);
|
||||
* Set params: set_entvar(index, EntVars:var, Float:value);
|
||||
*/
|
||||
var_air_finished,
|
||||
|
||||
/*
|
||||
* Description: -
|
||||
* Member type: float
|
||||
* Get params: Float:get_entvar(index, EntVars:var);
|
||||
* Set params: set_entvar(index, EntVars:var, Float:value);
|
||||
*/
|
||||
var_pain_finished,
|
||||
|
||||
/*
|
||||
* Description: -
|
||||
* Member type: float
|
||||
* Get params: Float:get_entvar(index, EntVars:var);
|
||||
* Set params: set_entvar(index, EntVars:var, Float:value);
|
||||
*/
|
||||
var_radsuit_finished,
|
||||
|
||||
/*
|
||||
* Description: -
|
||||
* Member type: struct edict_s *
|
||||
* Get params: get_entvar(index, EntVars:var);
|
||||
* Set params: set_entvar(index, EntVars:var, value);
|
||||
*/
|
||||
var_pContainingEntity,
|
||||
|
||||
/*
|
||||
* Description: -
|
||||
* Member type: int
|
||||
* Get params: get_entvar(index, EntVars:var);
|
||||
* Set params: set_entvar(index, EntVars:var, value);
|
||||
*/
|
||||
var_playerclass,
|
||||
|
||||
/*
|
||||
* Description: -
|
||||
* Member type: float
|
||||
* Get params: Float:get_entvar(index, EntVars:var);
|
||||
* Set params: set_entvar(index, EntVars:var, Float:value);
|
||||
*/
|
||||
var_maxspeed,
|
||||
|
||||
/*
|
||||
* Description: -
|
||||
* Member type: float
|
||||
* Get params: Float:get_entvar(index, EntVars:var);
|
||||
* Set params: set_entvar(index, EntVars:var, Float:value);
|
||||
*/
|
||||
var_fov,
|
||||
|
||||
/*
|
||||
* Description: -
|
||||
* Member type: int
|
||||
* Get params: get_entvar(index, EntVars:var);
|
||||
* Set params: set_entvar(index, EntVars:var, value);
|
||||
*/
|
||||
var_weaponanim,
|
||||
|
||||
/*
|
||||
* Description: -
|
||||
* Member type: int
|
||||
* Get params: get_entvar(index, EntVars:var);
|
||||
* Set params: set_entvar(index, EntVars:var, value);
|
||||
*/
|
||||
var_pushmsec,
|
||||
|
||||
/*
|
||||
* Description: -
|
||||
* Member type: int
|
||||
* Get params: get_entvar(index, EntVars:var);
|
||||
* Set params: set_entvar(index, EntVars:var, value);
|
||||
*/
|
||||
var_bInDuck,
|
||||
|
||||
/*
|
||||
* Description: -
|
||||
* Member type: int
|
||||
* Get params: get_entvar(index, EntVars:var);
|
||||
* Set params: set_entvar(index, EntVars:var, value);
|
||||
*/
|
||||
var_flTimeStepSound,
|
||||
|
||||
/*
|
||||
* Description: -
|
||||
* Member type: int
|
||||
* Get params: get_entvar(index, EntVars:var);
|
||||
* Set params: set_entvar(index, EntVars:var, value);
|
||||
*/
|
||||
var_flSwimTime,
|
||||
|
||||
/*
|
||||
* Description: -
|
||||
* Member type: int
|
||||
* Get params: get_entvar(index, EntVars:var);
|
||||
* Set params: set_entvar(index, EntVars:var, value);
|
||||
*/
|
||||
var_flDuckTime,
|
||||
|
||||
/*
|
||||
* Description: -
|
||||
* Member type: int
|
||||
* Get params: get_entvar(index, EntVars:var);
|
||||
* Set params: set_entvar(index, EntVars:var, value);
|
||||
*/
|
||||
var_iStepLeft,
|
||||
|
||||
/*
|
||||
* Description: -
|
||||
* Member type: float
|
||||
* Get params: Float:get_entvar(index, EntVars:var);
|
||||
* Set params: set_entvar(index, EntVars:var, Float:value);
|
||||
*/
|
||||
var_flFallVelocity,
|
||||
|
||||
/*
|
||||
* Description: -
|
||||
* Member type: int
|
||||
* Get params: get_entvar(index, EntVars:var);
|
||||
* Set params: set_entvar(index, EntVars:var, value);
|
||||
*/
|
||||
var_gamestate,
|
||||
|
||||
/*
|
||||
* Description: -
|
||||
* Member type: int
|
||||
* Get params: get_entvar(index, EntVars:var);
|
||||
* Set params: set_entvar(index, EntVars:var, value);
|
||||
*/
|
||||
var_oldbuttons,
|
||||
|
||||
/*
|
||||
* Description: -
|
||||
* Member type: int
|
||||
* Get params: get_entvar(index, EntVars:var);
|
||||
* Set params: set_entvar(index, EntVars:var, value);
|
||||
*/
|
||||
var_groupinfo,
|
||||
|
||||
/*
|
||||
* Description: -
|
||||
* Member type: int
|
||||
* Get params: get_entvar(index, EntVars:var);
|
||||
* Set params: set_entvar(index, EntVars:var, value);
|
||||
*/
|
||||
var_iuser1,
|
||||
|
||||
/*
|
||||
* Description: -
|
||||
* Member type: int
|
||||
* Get params: get_entvar(index, EntVars:var);
|
||||
* Set params: set_entvar(index, EntVars:var, value);
|
||||
*/
|
||||
var_iuser2,
|
||||
|
||||
/*
|
||||
* Description: -
|
||||
* Member type: int
|
||||
* Get params: get_entvar(index, EntVars:var);
|
||||
* Set params: set_entvar(index, EntVars:var, value);
|
||||
*/
|
||||
var_iuser3,
|
||||
|
||||
/*
|
||||
* Description: -
|
||||
* Member type: int
|
||||
* Get params: get_entvar(index, EntVars:var);
|
||||
* Set params: set_entvar(index, EntVars:var, value);
|
||||
*/
|
||||
var_iuser4,
|
||||
|
||||
/*
|
||||
* Description: -
|
||||
* Member type: int
|
||||
* Get params: get_entvar(index, EntVars:var);
|
||||
* Set params: set_entvar(index, EntVars:var, value);
|
||||
*/
|
||||
var_fuser1,
|
||||
|
||||
/*
|
||||
* Description: -
|
||||
* Member type: int
|
||||
* Get params: get_entvar(index, EntVars:var);
|
||||
* Set params: set_entvar(index, EntVars:var, value);
|
||||
*/
|
||||
var_fuser2,
|
||||
|
||||
/*
|
||||
* Description: -
|
||||
* Member type: int
|
||||
* Get params: get_entvar(index, EntVars:var);
|
||||
* Set params: set_entvar(index, EntVars:var, value);
|
||||
*/
|
||||
var_fuser3,
|
||||
|
||||
/*
|
||||
* Description: -
|
||||
* Member type: int
|
||||
* Get params: get_entvar(index, EntVars:var);
|
||||
* Set params: set_entvar(index, EntVars:var, value);
|
||||
*/
|
||||
var_fuser4,
|
||||
|
||||
/*
|
||||
* Description: -
|
||||
* Member type: class Vector
|
||||
* Get params: get_entvar(index, EntVars:var, Float:output[3]);
|
||||
* Set params: set_entvar(index, EntVars:var, Float:dest[3]);
|
||||
*/
|
||||
var_vuser1,
|
||||
|
||||
/*
|
||||
* Description: -
|
||||
* Member type: class Vector
|
||||
* Get params: get_entvar(index, EntVars:var, Float:output[3]);
|
||||
* Set params: set_entvar(index, EntVars:var, Float:dest[3]);
|
||||
*/
|
||||
var_vuser2,
|
||||
|
||||
/*
|
||||
* Description: -
|
||||
* Member type: class Vector
|
||||
* Get params: get_entvar(index, EntVars:var, Float:output[3]);
|
||||
* Set params: set_entvar(index, EntVars:var, Float:dest[3]);
|
||||
*/
|
||||
var_vuser3,
|
||||
|
||||
/*
|
||||
* Description: -
|
||||
* Member type: class Vector
|
||||
* Get params: get_entvar(index, EntVars:var, Float:output[3]);
|
||||
* Set params: set_entvar(index, EntVars:var, Float:dest[3]);
|
||||
*/
|
||||
var_vuser4,
|
||||
|
||||
/*
|
||||
* Description: -
|
||||
* Member type: struct edict_s *
|
||||
* Get params: get_entvar(index, EntVars:var);
|
||||
* Set params: set_entvar(index, EntVars:var, value);
|
||||
*/
|
||||
var_euser1,
|
||||
|
||||
/*
|
||||
* Description: -
|
||||
* Member type: struct edict_s *
|
||||
* Get params: get_entvar(index, EntVars:var);
|
||||
* Set params: set_entvar(index, EntVars:var, value);
|
||||
*/
|
||||
var_euser2,
|
||||
|
||||
/*
|
||||
* Description: -
|
||||
* Member type: struct edict_s *
|
||||
* Get params: get_entvar(index, EntVars:var);
|
||||
* Set params: set_entvar(index, EntVars:var, value);
|
||||
*/
|
||||
var_euser3,
|
||||
|
||||
/*
|
||||
* Description: -
|
||||
* Member type: struct edict_s *
|
||||
* Get params: get_entvar(index, EntVars:var);
|
||||
* Set params: set_entvar(index, EntVars:var, value);
|
||||
*/
|
||||
var_euser4
|
||||
};
|
||||
|
||||
|
||||
|
@ -74,7 +74,7 @@ native rg_add_account(const index, amount, bool:bTrackChange = true);
|
||||
*
|
||||
* @noreturn
|
||||
*/
|
||||
native rg_give_item(const index, const pszName[]);
|
||||
native rg_give_item(index, const pszName[], GiveType:type = GT_APPEND);
|
||||
|
||||
/*
|
||||
* Give the player default items
|
||||
@ -243,7 +243,7 @@ native rg_find_ent_by_owner(&start_index, const classname[], owner);
|
||||
* @error If weapon_id and type are out of bound, an error will be thrown.
|
||||
*
|
||||
*/
|
||||
native rg_get_weapon_info(any:...);
|
||||
native any:rg_get_weapon_info(any:...);
|
||||
|
||||
/*
|
||||
* Sets specific values of weapons info.
|
||||
@ -276,3 +276,63 @@ native rg_remove_all_items(const index, bool:bRemoveSuit);
|
||||
*
|
||||
*/
|
||||
native rg_remove_item(const index, const item_name[]);
|
||||
|
||||
/*
|
||||
* Returns amount of ammo in the client's backpack for a specific weapon.
|
||||
*
|
||||
* @param index Client index
|
||||
* @param weapon Weapon id
|
||||
*
|
||||
* @return Amount of ammo in backpack
|
||||
*
|
||||
*/
|
||||
native rg_get_user_bpammo(const index, WeaponIdType:weapon);
|
||||
|
||||
/*
|
||||
* Sets amount of ammo in the client's backpack for a specific weapon.
|
||||
*
|
||||
* @param index Client index
|
||||
* @param weapon Weapon id
|
||||
* @param amount New backpack ammo amount to set
|
||||
*
|
||||
* @noreturn
|
||||
*
|
||||
*/
|
||||
native rg_set_user_bpammo(const index, WeaponIdType:weapon, amount);
|
||||
|
||||
/*
|
||||
* Sets the client's defusekit status and allows to set a custom HUD icon and color.
|
||||
*
|
||||
* @param index Client index
|
||||
* @param defusekit If nonzero the client will have a defusekit, otherwise it will be removed
|
||||
* @param color Color RGB
|
||||
* @param icon HUD sprite to use as icon
|
||||
* @param flash If nonzero the icon will flash red
|
||||
*
|
||||
* @noreturn
|
||||
*
|
||||
*/
|
||||
native rg_give_defusekit(const index, bool:bDefusekit = true, Float:color[] = {0.0, 160.0, 0.0}, const icon[] = "defuser", bool:bFlash = false);
|
||||
|
||||
/*
|
||||
* Returns the client's armor value and retrieves the type of armor.
|
||||
*
|
||||
* @param index Client index
|
||||
* @param armortype Variable to store armor type in
|
||||
*
|
||||
* @return Amount of armor, 0 if client has no armor
|
||||
*
|
||||
*/
|
||||
native rg_get_user_armor(const index, &ArmorType:armortype);
|
||||
|
||||
/*
|
||||
* Sets the client's armor value the type of armor.
|
||||
*
|
||||
* @param index Client index
|
||||
* @param armorvalue Amount of armor to set
|
||||
* @param armortype Armor type
|
||||
*
|
||||
* @noreturn
|
||||
*
|
||||
*/
|
||||
native rg_set_user_armor(const index, armorvalue, ArmorType:armortype);
|
||||
|
@ -22,6 +22,21 @@
|
||||
#define RG_CBasePlayer_Observer_IsValidTarget RG_CBasePlayer_Observer_IsValid
|
||||
#endif
|
||||
|
||||
// use with rg_give_item
|
||||
enum GiveType
|
||||
{
|
||||
GT_APPEND, // just give item
|
||||
GT_REPLACE, // to remove all weapons from the slot
|
||||
GT_DROP_AND_REPLACE // drop all weapons on the ground
|
||||
};
|
||||
|
||||
enum ArmorType
|
||||
{
|
||||
ARMOR_NONE, // no armor
|
||||
ARMOR_KEVLAR, // body vest only
|
||||
ARMOR_VESTHELM, // vest and helmet
|
||||
};
|
||||
|
||||
enum WeaponIdType
|
||||
{
|
||||
WEAPON_NONE,
|
||||
|
205
reapi/include/com_progdefs.h
Normal file
205
reapi/include/com_progdefs.h
Normal file
@ -0,0 +1,205 @@
|
||||
#pragma once
|
||||
|
||||
struct qstring_t { unsigned int str; };
|
||||
struct rstring_t { const char *str; };
|
||||
|
||||
struct com_globalvars
|
||||
{
|
||||
float time;
|
||||
float frametime;
|
||||
float force_retouch;
|
||||
qstring_t mapname;
|
||||
qstring_t startspot;
|
||||
float deathmatch;
|
||||
float coop;
|
||||
float teamplay;
|
||||
float serverflags;
|
||||
float found_secrets;
|
||||
vec3_t v_forward;
|
||||
vec3_t v_up;
|
||||
vec3_t v_right;
|
||||
float trace_allsolid;
|
||||
float trace_startsolid;
|
||||
float trace_fraction;
|
||||
vec3_t trace_endpos;
|
||||
vec3_t trace_plane_normal;
|
||||
float trace_plane_dist;
|
||||
edict_t *trace_ent;
|
||||
float trace_inopen;
|
||||
float trace_inwater;
|
||||
int trace_hitgroup;
|
||||
int trace_flags;
|
||||
int msg_entity;
|
||||
int cdAudioTrack;
|
||||
int maxClients;
|
||||
int maxEntities;
|
||||
rstring_t pStringBase;
|
||||
void *pSaveData;
|
||||
vec3_t vecLandmarkOffset;
|
||||
};
|
||||
|
||||
struct com_entvars
|
||||
{
|
||||
qstring_t classname;
|
||||
qstring_t globalname;
|
||||
|
||||
vec3_t origin;
|
||||
vec3_t oldorigin;
|
||||
vec3_t velocity;
|
||||
vec3_t basevelocity;
|
||||
vec3_t clbasevelocity; // Base velocity that was passed in to server physics so
|
||||
// client can predict conveyors correctly. Server zeroes it, so we need to store here, too.
|
||||
vec3_t movedir;
|
||||
|
||||
vec3_t angles; // Model angles
|
||||
vec3_t avelocity; // angle velocity (degrees per second)
|
||||
vec3_t punchangle; // auto-decaying view angle adjustment
|
||||
vec3_t v_angle; // Viewing angle (player only)
|
||||
|
||||
// For parametric entities
|
||||
vec3_t endpos;
|
||||
vec3_t startpos;
|
||||
float impacttime;
|
||||
float starttime;
|
||||
|
||||
int fixangle; // 0:nothing, 1:force view angles, 2:add avelocity
|
||||
float idealpitch;
|
||||
float pitch_speed;
|
||||
float ideal_yaw;
|
||||
float yaw_speed;
|
||||
|
||||
int modelindex;
|
||||
qstring_t model;
|
||||
|
||||
int viewmodel; // player's viewmodel
|
||||
int weaponmodel; // what other players see
|
||||
|
||||
vec3_t absmin; // BB max translated to world coord
|
||||
vec3_t absmax; // BB max translated to world coord
|
||||
vec3_t mins; // local BB min
|
||||
vec3_t maxs; // local BB max
|
||||
vec3_t size; // maxs - mins
|
||||
|
||||
float ltime;
|
||||
float nextthink;
|
||||
|
||||
int movetype;
|
||||
int solid;
|
||||
|
||||
int skin;
|
||||
int body; // sub-model selection for studiomodels
|
||||
int effects;
|
||||
|
||||
float gravity; // % of "normal" gravity
|
||||
float friction; // inverse elasticity of MOVETYPE_BOUNCE
|
||||
|
||||
int light_level;
|
||||
|
||||
int sequence; // animation sequence
|
||||
int gaitsequence; // movement animation sequence for player (0 for none)
|
||||
float frame; // % playback position in animation sequences (0..255)
|
||||
float animtime; // world time when frame was set
|
||||
float framerate; // animation playback rate (-8x to 8x)
|
||||
byte controller[4]; // bone controller setting (0..255)
|
||||
byte blending[2]; // blending amount between sub-sequences (0..255)
|
||||
|
||||
float scale; // sprite rendering scale (0..255)
|
||||
|
||||
int rendermode;
|
||||
float renderamt;
|
||||
vec3_t rendercolor;
|
||||
int renderfx;
|
||||
|
||||
float health;
|
||||
float frags;
|
||||
int weapons; // bit mask for available weapons
|
||||
float takedamage;
|
||||
|
||||
int deadflag;
|
||||
vec3_t view_ofs; // eye position
|
||||
|
||||
int button;
|
||||
int impulse;
|
||||
|
||||
edict_t *chain; // Entity pointer when linked into a linked list
|
||||
edict_t *dmg_inflictor;
|
||||
edict_t *enemy;
|
||||
edict_t *aiment; // entity pointer when MOVETYPE_FOLLOW
|
||||
edict_t *owner;
|
||||
edict_t *groundentity;
|
||||
|
||||
int spawnflags;
|
||||
int flags;
|
||||
|
||||
int colormap; // lowbyte topcolor, highbyte bottomcolor
|
||||
int team;
|
||||
|
||||
float max_health;
|
||||
float teleport_time;
|
||||
float armortype;
|
||||
float armorvalue;
|
||||
int waterlevel;
|
||||
int watertype;
|
||||
|
||||
qstring_t target;
|
||||
qstring_t targetname;
|
||||
qstring_t netname;
|
||||
qstring_t message;
|
||||
|
||||
float dmg_take;
|
||||
float dmg_save;
|
||||
float dmg;
|
||||
float dmgtime;
|
||||
|
||||
qstring_t noise;
|
||||
qstring_t noise1;
|
||||
qstring_t noise2;
|
||||
qstring_t noise3;
|
||||
|
||||
float speed;
|
||||
float air_finished;
|
||||
float pain_finished;
|
||||
float radsuit_finished;
|
||||
|
||||
edict_t *pContainingEntity;
|
||||
|
||||
int playerclass;
|
||||
float maxspeed;
|
||||
|
||||
float fov;
|
||||
int weaponanim;
|
||||
|
||||
int pushmsec;
|
||||
|
||||
int bInDuck;
|
||||
int flTimeStepSound;
|
||||
int flSwimTime;
|
||||
int flDuckTime;
|
||||
int iStepLeft;
|
||||
float flFallVelocity;
|
||||
|
||||
int gamestate;
|
||||
int oldbuttons;
|
||||
int groupinfo;
|
||||
|
||||
// For mods
|
||||
int iuser1;
|
||||
int iuser2;
|
||||
int iuser3;
|
||||
int iuser4;
|
||||
|
||||
float fuser1;
|
||||
float fuser2;
|
||||
float fuser3;
|
||||
float fuser4;
|
||||
|
||||
vec3_t vuser1;
|
||||
vec3_t vuser2;
|
||||
vec3_t vuser3;
|
||||
vec3_t vuser4;
|
||||
|
||||
edict_t *euser1;
|
||||
edict_t *euser2;
|
||||
edict_t *euser3;
|
||||
edict_t *euser4;
|
||||
};
|
@ -68,16 +68,6 @@ public:
|
||||
virtual void unregisterHook(hookfunc_t hook) = 0;
|
||||
};
|
||||
|
||||
// Hook chain registry(for hooks [un]registration)
|
||||
template<typename t_ret, typename ...t_args>
|
||||
class IHookChainRegistryClassEmpty {
|
||||
public:
|
||||
typedef t_ret(*hookfunc_t)(IHookChain<t_ret, t_args...>*, t_args...);
|
||||
|
||||
virtual void registerHook(hookfunc_t hook) = 0;
|
||||
virtual void unregisterHook(hookfunc_t hook) = 0;
|
||||
};
|
||||
|
||||
// Hook chain registry(for hooks [un]registration)
|
||||
template<typename ...t_args>
|
||||
class IVoidHookChainRegistry {
|
||||
|
@ -55,8 +55,8 @@ typedef IVoidHookChain<struct entvars_s *, float, Vector &, struct TraceResult *
|
||||
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;
|
||||
typedef IHookChainRegistryClass<int, class CBasePlayer, struct entvars_s *, struct entvars_s *, float, int> IReGameHookRegistry_CBasePlayer_TakeDamage;
|
||||
typedef IHookChain<int, struct entvars_s *, struct entvars_s *, float&, int> IReGameHook_CBasePlayer_TakeDamage;
|
||||
typedef IHookChainRegistryClass<int, class CBasePlayer, struct entvars_s *, struct entvars_s *, float&, int> IReGameHookRegistry_CBasePlayer_TakeDamage;
|
||||
|
||||
// CBasePlayer::TakeHealth hook
|
||||
typedef IHookChain<int, float, int> IReGameHook_CBasePlayer_TakeHealth;
|
||||
@ -171,8 +171,8 @@ typedef IVoidHookChain<class CBasePlayer *, struct entvars_s *, struct entvars_s
|
||||
typedef IVoidHookChainRegistry<class CBasePlayer *, struct entvars_s *, struct entvars_s *, Vector &, Vector &, struct TraceResult *> IReGameHookRegistry_RadiusFlash_TraceLine;
|
||||
|
||||
// RoundEnd hook
|
||||
typedef IHookChain<bool, int, ScenarioEventEndRound, float> IReGameHook_RoundEnd;
|
||||
typedef IHookChainRegistryClassEmpty<bool, int, ScenarioEventEndRound, float> IReGameHookRegistry_RoundEnd;
|
||||
typedef IHookChain<bool, int, enum ScenarioEventEndRound, float> IReGameHook_RoundEnd;
|
||||
typedef IHookChainRegistry<bool, int, enum ScenarioEventEndRound, float> IReGameHookRegistry_RoundEnd;
|
||||
|
||||
// CanBuyThis hook
|
||||
typedef IHookChain<bool, class CBasePlayer *, int> IReGameHook_CanBuyThis;
|
||||
@ -182,6 +182,106 @@ typedef IHookChainRegistry<bool, class CBasePlayer *, int> IReGameHookRegistry_C
|
||||
typedef IHookChain<class CGameRules *> IReGameHook_InstallGameRules;
|
||||
typedef IHookChainRegistry<class CGameRules *> IReGameHookRegistry_InstallGameRules;
|
||||
|
||||
// PM_Init hook
|
||||
typedef IVoidHookChain<struct playermove_s *> IReGameHook_PM_Init;
|
||||
typedef IVoidHookChainRegistry<struct playermove_s *> IReGameHookRegistry_PM_Init;
|
||||
|
||||
// PM_Move hook
|
||||
typedef IVoidHookChain<struct playermove_s *, int> IReGameHook_PM_Move;
|
||||
typedef IVoidHookChainRegistry<struct playermove_s *, int> IReGameHookRegistry_PM_Move;
|
||||
|
||||
// PM_AirMove hook
|
||||
typedef IVoidHookChain<> IReGameHook_PM_AirMove;
|
||||
typedef IVoidHookChainRegistry<> IReGameHookRegistry_PM_AirMove;
|
||||
|
||||
// CHalfLifeMultiplay::FShouldSwitchWeapon hook
|
||||
typedef IHookChain<BOOL, class CBasePlayer *, class CBasePlayerItem *> IReGameHook_CSGameRules_FShouldSwitchWeapon;
|
||||
typedef IHookChainRegistry<BOOL, class CBasePlayer *, class CBasePlayerItem *> IReGameHookRegistry_CSGameRules_FShouldSwitchWeapon;
|
||||
|
||||
// CHalfLifeMultiplay::GetNextBestWeapon hook
|
||||
typedef IHookChain<BOOL, class CBasePlayer *, class CBasePlayerItem *> IReGameHook_CSGameRules_GetNextBestWeapon;
|
||||
typedef IHookChainRegistry<BOOL, class CBasePlayer *, class CBasePlayerItem *> IReGameHookRegistry_CSGameRules_GetNextBestWeapon;
|
||||
|
||||
// CHalfLifeMultiplay::FlPlayerFallDamage hook
|
||||
typedef IHookChain<float, class CBasePlayer *> IReGameHook_CSGameRules_FlPlayerFallDamage;
|
||||
typedef IHookChainRegistry<float, class CBasePlayer *> IReGameHookRegistry_CSGameRules_FlPlayerFallDamage;
|
||||
|
||||
// CHalfLifeMultiplay::FPlayerCanTakeDamage hook
|
||||
typedef IHookChain<BOOL, class CBasePlayer *, CBaseEntity *> IReGameHook_CSGameRules_FPlayerCanTakeDamage;
|
||||
typedef IHookChainRegistry<BOOL, class CBasePlayer *, CBaseEntity *> IReGameHookRegistry_CSGameRules_FPlayerCanTakeDamage;
|
||||
|
||||
// CHalfLifeMultiplay::PlayerSpawn hook
|
||||
typedef IVoidHookChain<class CBasePlayer *> IReGameHook_CSGameRules_PlayerSpawn;
|
||||
typedef IVoidHookChainRegistry<class CBasePlayer *> IReGameHookRegistry_CSGameRules_PlayerSpawn;
|
||||
|
||||
// CHalfLifeMultiplay::FPlayerCanRespawn hook
|
||||
typedef IHookChain<BOOL, class CBasePlayer *> IReGameHook_CSGameRules_FPlayerCanRespawn;
|
||||
typedef IHookChainRegistry<BOOL, class CBasePlayer *> IReGameHookRegistry_CSGameRules_FPlayerCanRespawn;
|
||||
|
||||
// CHalfLifeMultiplay::GetPlayerSpawnSpot hook
|
||||
typedef IHookChain<struct edict_s *, class CBasePlayer *> IReGameHook_CSGameRules_GetPlayerSpawnSpot;
|
||||
typedef IHookChainRegistry<struct edict_s *, class CBasePlayer *> IReGameHookRegistry_CSGameRules_GetPlayerSpawnSpot;
|
||||
|
||||
// CHalfLifeMultiplay::ClientUserInfoChanged hook
|
||||
typedef IVoidHookChain<class CBasePlayer *, char *> IReGameHook_CSGameRules_ClientUserInfoChanged;
|
||||
typedef IVoidHookChainRegistry<class CBasePlayer *, char *> IReGameHookRegistry_CSGameRules_ClientUserInfoChanged;
|
||||
|
||||
// CHalfLifeMultiplay::PlayerKilled hook
|
||||
typedef IVoidHookChain<class CBasePlayer *, struct entvars_s *, struct entvars_s *> IReGameHook_CSGameRules_PlayerKilled;
|
||||
typedef IVoidHookChainRegistry<class CBasePlayer *, struct entvars_s *, struct entvars_s *> IReGameHookRegistry_CSGameRules_PlayerKilled;
|
||||
|
||||
// CHalfLifeMultiplay::DeathNotice hook
|
||||
typedef IVoidHookChain<class CBasePlayer *, struct entvars_s *, struct entvars_s *> IReGameHook_CSGameRules_DeathNotice;
|
||||
typedef IVoidHookChainRegistry<class CBasePlayer *, struct entvars_s *, struct entvars_s *> IReGameHookRegistry_CSGameRules_DeathNotice;
|
||||
|
||||
// CHalfLifeMultiplay::CanHavePlayerItem hook
|
||||
typedef IHookChain<BOOL, class CBasePlayer *, class CBasePlayerItem *> IReGameHook_CSGameRules_CanHavePlayerItem;
|
||||
typedef IHookChainRegistry<BOOL, class CBasePlayer *, class CBasePlayerItem *> IReGameHookRegistry_CSGameRules_CanHavePlayerItem;
|
||||
|
||||
// CHalfLifeMultiplay::DeadPlayerWeapons hook
|
||||
typedef IHookChain<int, class CBasePlayer *> IReGameHook_CSGameRules_DeadPlayerWeapons;
|
||||
typedef IHookChainRegistry<int, class CBasePlayer *> IReGameHookRegistry_CSGameRules_DeadPlayerWeapons;
|
||||
|
||||
// CHalfLifeMultiplay::ServerDeactivate hook
|
||||
typedef IVoidHookChain<> IReGameHook_CSGameRules_ServerDeactivate;
|
||||
typedef IVoidHookChainRegistry<> IReGameHookRegistry_CSGameRules_ServerDeactivate;
|
||||
|
||||
// CHalfLifeMultiplay::CheckMapConditions hook
|
||||
typedef IVoidHookChain<> IReGameHook_CSGameRules_CheckMapConditions;
|
||||
typedef IVoidHookChainRegistry<> IReGameHookRegistry_CSGameRules_CheckMapConditions;
|
||||
|
||||
// CHalfLifeMultiplay::CleanUpMap hook
|
||||
typedef IVoidHookChain<> IReGameHook_CSGameRules_CleanUpMap;
|
||||
typedef IVoidHookChainRegistry<> IReGameHookRegistry_CSGameRules_CleanUpMap;
|
||||
|
||||
// CHalfLifeMultiplay::RestartRound hook
|
||||
typedef IVoidHookChain<> IReGameHook_CSGameRules_RestartRound;
|
||||
typedef IVoidHookChainRegistry<> IReGameHookRegistry_CSGameRules_RestartRound;
|
||||
|
||||
// CHalfLifeMultiplay::CheckWinConditions hook
|
||||
typedef IVoidHookChain<> IReGameHook_CSGameRules_CheckWinConditions;
|
||||
typedef IVoidHookChainRegistry<> IReGameHookRegistry_CSGameRules_CheckWinConditions;
|
||||
|
||||
// CHalfLifeMultiplay::RemoveGuns hook
|
||||
typedef IVoidHookChain<> IReGameHook_CSGameRules_RemoveGuns;
|
||||
typedef IVoidHookChainRegistry<> IReGameHookRegistry_CSGameRules_RemoveGuns;
|
||||
|
||||
// CHalfLifeMultiplay::GiveC4 hook
|
||||
typedef IVoidHookChain<> IReGameHook_CSGameRules_GiveC4;
|
||||
typedef IVoidHookChainRegistry<> IReGameHookRegistry_CSGameRules_GiveC4;
|
||||
|
||||
// CHalfLifeMultiplay::ChangeLevel hook
|
||||
typedef IVoidHookChain<> IReGameHook_CSGameRules_ChangeLevel;
|
||||
typedef IVoidHookChainRegistry<> IReGameHookRegistry_CSGameRules_ChangeLevel;
|
||||
|
||||
// CHalfLifeMultiplay::GoToIntermission hook
|
||||
typedef IVoidHookChain<> IReGameHook_CSGameRules_GoToIntermission;
|
||||
typedef IVoidHookChainRegistry<> IReGameHookRegistry_CSGameRules_GoToIntermission;
|
||||
|
||||
// CHalfLifeMultiplay::BalanceTeams hook
|
||||
typedef IVoidHookChain<> IReGameHook_CSGameRules_BalanceTeams;
|
||||
typedef IVoidHookChainRegistry<> IReGameHookRegistry_CSGameRules_BalanceTeams;
|
||||
|
||||
class IReGameHookchains {
|
||||
public:
|
||||
virtual ~IReGameHookchains() {}
|
||||
@ -215,17 +315,40 @@ public:
|
||||
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;
|
||||
virtual IReGameHookRegistry_RoundEnd* RoundEnd() = 0;
|
||||
virtual IReGameHookRegistry_CanBuyThis* CanBuyThis() = 0;
|
||||
virtual IReGameHookRegistry_InstallGameRules* InstallGameRules() = 0;
|
||||
virtual IReGameHookRegistry_PM_Init* PM_Init() = 0;
|
||||
virtual IReGameHookRegistry_PM_Move* PM_Move() = 0;
|
||||
virtual IReGameHookRegistry_PM_AirMove* PM_AirMove() = 0;
|
||||
|
||||
virtual IReGameHookRegistry_CSGameRules_FShouldSwitchWeapon* CSGameRules_FShouldSwitchWeapon() = 0;
|
||||
virtual IReGameHookRegistry_CSGameRules_GetNextBestWeapon* CSGameRules_GetNextBestWeapon() = 0;
|
||||
virtual IReGameHookRegistry_CSGameRules_FlPlayerFallDamage* CSGameRules_FlPlayerFallDamage() = 0;
|
||||
virtual IReGameHookRegistry_CSGameRules_FPlayerCanTakeDamage* CSGameRules_FPlayerCanTakeDamage() = 0;
|
||||
virtual IReGameHookRegistry_CSGameRules_PlayerSpawn* CSGameRules_PlayerSpawn() = 0;
|
||||
virtual IReGameHookRegistry_CSGameRules_FPlayerCanRespawn* CSGameRules_FPlayerCanRespawn() = 0;
|
||||
virtual IReGameHookRegistry_CSGameRules_GetPlayerSpawnSpot* CSGameRules_GetPlayerSpawnSpot() = 0;
|
||||
virtual IReGameHookRegistry_CSGameRules_ClientUserInfoChanged* CSGameRules_ClientUserInfoChanged() = 0;
|
||||
virtual IReGameHookRegistry_CSGameRules_PlayerKilled* CSGameRules_PlayerKilled() = 0;
|
||||
virtual IReGameHookRegistry_CSGameRules_DeathNotice* CSGameRules_DeathNotice() = 0;
|
||||
virtual IReGameHookRegistry_CSGameRules_CanHavePlayerItem* CSGameRules_CanHavePlayerItem() = 0;
|
||||
virtual IReGameHookRegistry_CSGameRules_DeadPlayerWeapons* CSGameRules_DeadPlayerWeapons() = 0;
|
||||
virtual IReGameHookRegistry_CSGameRules_ServerDeactivate* CSGameRules_ServerDeactivate() = 0;
|
||||
virtual IReGameHookRegistry_CSGameRules_CheckMapConditions* CSGameRules_CheckMapConditions() = 0;
|
||||
virtual IReGameHookRegistry_CSGameRules_CleanUpMap* CSGameRules_CleanUpMap() = 0;
|
||||
virtual IReGameHookRegistry_CSGameRules_RestartRound* CSGameRules_RestartRound() = 0;
|
||||
virtual IReGameHookRegistry_CSGameRules_CheckWinConditions* CSGameRules_CheckWinConditions() = 0;
|
||||
virtual IReGameHookRegistry_CSGameRules_RemoveGuns* CSGameRules_RemoveGuns() = 0;
|
||||
virtual IReGameHookRegistry_CSGameRules_GiveC4* CSGameRules_GiveC4() = 0;
|
||||
virtual IReGameHookRegistry_CSGameRules_ChangeLevel* CSGameRules_ChangeLevel() = 0;
|
||||
virtual IReGameHookRegistry_CSGameRules_GoToIntermission* CSGameRules_GoToIntermission() = 0;
|
||||
virtual IReGameHookRegistry_CSGameRules_BalanceTeams* CSGameRules_BalanceTeams() = 0;
|
||||
|
||||
};
|
||||
|
||||
@ -256,7 +379,13 @@ public:
|
||||
virtual int GetMinorVersion() = 0;
|
||||
virtual const ReGameFuncs_t* GetFuncs() = 0;
|
||||
virtual IReGameHookchains* GetHookchains() = 0;
|
||||
virtual IReGameData* GetGameData() = 0;
|
||||
|
||||
virtual class CGameRules* GetGameRules() = 0;
|
||||
virtual struct WeaponInfoStruct* GetWeaponInfo(int weaponID) = 0;
|
||||
virtual struct WeaponInfoStruct* GetWeaponInfo(const char* weaponName) = 0;
|
||||
virtual struct playermove_s* GetPlayerMove() = 0;
|
||||
virtual struct WeaponSlotInfo* GetWeaponSlot(WeaponIdType weaponID) = 0;
|
||||
virtual struct WeaponSlotInfo* GetWeaponSlot(const char* weaponName) = 0;
|
||||
|
||||
};
|
||||
|
||||
|
@ -299,8 +299,12 @@ public:
|
||||
virtual void SetAnimation(PLAYER_ANIM playerAnim) = 0;
|
||||
virtual void AddAccount(int amount, bool bTrackChange = true) = 0;
|
||||
virtual void GiveNamedItem(const char *pszName) = 0;
|
||||
virtual void GiveNamedItemEx(const char *pszName) = 0;
|
||||
virtual void GiveDefaultItems() = 0;
|
||||
virtual void GiveShield(bool bDeploy = true) = 0;
|
||||
virtual void DropShield(bool bDeploy = true) = 0;
|
||||
virtual void DropPlayerItem(const char *pszItemName) = 0;
|
||||
virtual void RemoveShield() = 0;
|
||||
virtual void RemoveAllItems(bool bRemoveSuit) = 0;
|
||||
};
|
||||
|
||||
@ -2071,11 +2075,3 @@ public:
|
||||
virtual void Spawn() = 0;
|
||||
virtual void KeyValue(struct KeyValueData_s *pkvd) = 0;
|
||||
};
|
||||
|
||||
class IReGameData {
|
||||
public:
|
||||
virtual ~IReGameData() {}
|
||||
|
||||
virtual class CGameRules* GetGameRules() = 0;
|
||||
virtual struct WeaponInfoStruct *GetWeaponInfo(int weaponID) = 0;
|
||||
};
|
||||
|
@ -44,10 +44,6 @@ class CBasePlayer;
|
||||
|
||||
#define WEAPON_IS_ONTARGET 0x40
|
||||
|
||||
#define ARMOR_TYPE_EMPTY 0
|
||||
#define ARMOR_TYPE_KEVLAR 1 // Armor
|
||||
#define ARMOR_TYPE_HELMET 2 // Armor and helmet
|
||||
|
||||
// the maximum amount of ammo each weapon's clip can hold
|
||||
#define WEAPON_NOCLIP -1
|
||||
|
||||
@ -69,6 +65,13 @@ class CBasePlayer;
|
||||
#define SF_DETONATE 0x0001 // Grenades flagged with this will be triggered when the owner calls detonateSatchelCharges
|
||||
|
||||
// custom enum
|
||||
enum ArmorType
|
||||
{
|
||||
ARMOR_NONE, // no armor
|
||||
ARMOR_KEVLAR, // body vest only
|
||||
ARMOR_VESTHELM, // vest and helmet
|
||||
};
|
||||
|
||||
enum ArmouryItemPack
|
||||
{
|
||||
ARMOURY_MP5NAVY,
|
||||
@ -90,6 +93,7 @@ enum ArmouryItemPack
|
||||
ARMOURY_KEVLAR,
|
||||
ARMOURY_ASSAULT,
|
||||
ARMOURY_SMOKEGRENADE,
|
||||
ARMOURY_END
|
||||
};
|
||||
|
||||
struct ItemInfo
|
||||
|
@ -251,6 +251,7 @@ enum MaxAmmoType
|
||||
|
||||
enum AmmoType
|
||||
{
|
||||
AMMO_NONE = -1,
|
||||
AMMO_BUCKSHOT,
|
||||
AMMO_9MM,
|
||||
AMMO_556NATO,
|
||||
@ -327,7 +328,8 @@ enum shieldgren_e
|
||||
|
||||
enum InventorySlotType
|
||||
{
|
||||
PRIMARY_WEAPON_SLOT = 1,
|
||||
NONE_SLOT,
|
||||
PRIMARY_WEAPON_SLOT,
|
||||
PISTOL_SLOT,
|
||||
KNIFE_SLOT,
|
||||
GRENADE_SLOT,
|
||||
@ -401,3 +403,10 @@ struct WeaponInfoStruct
|
||||
char *entityName;
|
||||
const char *ammoName;
|
||||
};
|
||||
|
||||
struct WeaponSlotInfo
|
||||
{
|
||||
WeaponIdType id;
|
||||
InventorySlotType slot;
|
||||
const char *weaponName;
|
||||
};
|
||||
|
@ -11,6 +11,7 @@
|
||||
</ProjectConfiguration>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClInclude Include="..\include\com_progdefs.h" />
|
||||
<ClInclude Include="..\include\cssdk\common\beamdef.h" />
|
||||
<ClInclude Include="..\include\cssdk\common\cl_entity.h" />
|
||||
<ClInclude Include="..\include\cssdk\common\com_model.h" />
|
||||
@ -194,6 +195,7 @@
|
||||
<ClInclude Include="..\include\metamod\plinfo.h" />
|
||||
<ClInclude Include="..\include\metamod\sdk_util.h" />
|
||||
<ClInclude Include="..\include\metamod\types_meta.h" />
|
||||
<ClInclude Include="..\include\reunion_api.h" />
|
||||
<ClInclude Include="..\include\vtc_api.h" />
|
||||
<ClInclude Include="..\src\amxxmodule.h" />
|
||||
<ClInclude Include="..\src\api_config.h" />
|
||||
|
@ -651,6 +651,12 @@
|
||||
<ClInclude Include="..\src\natives\natives_addons.h">
|
||||
<Filter>src\natives</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\include\com_progdefs.h">
|
||||
<Filter>include</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\include\reunion_api.h">
|
||||
<Filter>include</Filter>
|
||||
</ClInclude>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClCompile Include="..\include\cssdk\common\parsemsg.cpp">
|
||||
|
@ -100,11 +100,11 @@ void CBasePlayer_TraceAttack(IReGameHook_CBasePlayer_TraceAttack *chain, CBasePl
|
||||
callVoidForward(RG_CBasePlayer_TraceAttack, original, indexOfEdict(pthis->pev), indexOfEdict(pevAttacker), flDamage, g_amxxapi.PrepareCellArrayA(reinterpret_cast<cell *>(&vecDirCopy), 3, true), ptr, bitsDamageType);
|
||||
}
|
||||
|
||||
int CBasePlayer_TakeDamage(IReGameHook_CBasePlayer_TakeDamage *chain, CBasePlayer *pthis, entvars_t *pevInflictor, entvars_t *pevAttacker, float flDamage, int bitsDamageType)
|
||||
int CBasePlayer_TakeDamage(IReGameHook_CBasePlayer_TakeDamage *chain, CBasePlayer *pthis, entvars_t *pevInflictor, entvars_t *pevAttacker, float& flDamage, int bitsDamageType)
|
||||
{
|
||||
auto original = [chain](int _pthis, int _pevInflictor, int _pevAttacker, float _flDamage, int _bitsDamageType)
|
||||
auto original = [chain](int _pthis, int _pevInflictor, int _pevAttacker, volatile float& _flDamage, int _bitsDamageType)
|
||||
{
|
||||
return chain->callNext(PEV(_pevInflictor), PEV(_pevAttacker), _flDamage, _bitsDamageType);
|
||||
return chain->callNext(PEV(_pevInflictor), PEV(_pevAttacker), const_cast<float&>(_flDamage), _bitsDamageType);
|
||||
};
|
||||
|
||||
return callForward<int>(RG_CBasePlayer_TakeDamage, original, indexOfEdict(pthis->pev), indexOfEdict(pevInflictor), indexOfEdict(pevAttacker), flDamage, bitsDamageType);
|
||||
|
@ -211,7 +211,7 @@ void CBasePlayer_Precache(IReGameHook_CBasePlayer_Precache *chain, CBasePlayer *
|
||||
int CBasePlayer_ObjectCaps(IReGameHook_CBasePlayer_ObjectCaps *chain, CBasePlayer *pthis);
|
||||
int CBasePlayer_Classify(IReGameHook_CBasePlayer_Classify *chain, CBasePlayer *pthis);
|
||||
void CBasePlayer_TraceAttack(IReGameHook_CBasePlayer_TraceAttack *chain, CBasePlayer *pthis, entvars_t *pevAttacker, float flDamage, Vector& vecDir, TraceResult *ptr, int bitsDamageType);
|
||||
int CBasePlayer_TakeDamage(IReGameHook_CBasePlayer_TakeDamage *chain, CBasePlayer *pthis, entvars_t *pevInflictor, entvars_t *pevAttacker, float flDamage, int bitsDamageType);
|
||||
int CBasePlayer_TakeDamage(IReGameHook_CBasePlayer_TakeDamage *chain, CBasePlayer *pthis, entvars_t *pevInflictor, entvars_t *pevAttacker, float& flDamage, int bitsDamageType);
|
||||
int CBasePlayer_TakeHealth(IReGameHook_CBasePlayer_TakeHealth *chain, CBasePlayer *pthis, float flHealth, int bitsDamageType);
|
||||
void CBasePlayer_Killed(IReGameHook_CBasePlayer_Killed *chain, CBasePlayer *pthis, entvars_t *pevAttacker, int iGib);
|
||||
void CBasePlayer_AddPoints(IReGameHook_CBasePlayer_AddPoints *chain, CBasePlayer *pthis, int score, BOOL bAllowNegativeScore);
|
||||
|
@ -6,6 +6,7 @@ inline size_t getFwdParamType(void(*)(Vector&)) { return FP_ARRAY; }
|
||||
inline size_t getFwdParamType(void(*)(PLAYER_ANIM)) { return FP_CELL; }
|
||||
inline size_t getFwdParamType(void(*)(ScenarioEventEndRound)) { return FP_CELL; }
|
||||
inline size_t getFwdParamType(void(*)(float)) { return FP_FLOAT; }
|
||||
inline size_t getFwdParamType(void(*)(float&)) { return FP_FLOAT; }
|
||||
inline size_t getFwdParamType(void(*)(const char *)) { return FP_STRING; }
|
||||
inline size_t getFwdParamType(void(*)(char *)) { return FP_STRING; }
|
||||
|
||||
|
@ -1,8 +1,7 @@
|
||||
#include "precompiled.h"
|
||||
|
||||
edict_t* g_pEdicts;
|
||||
int gmsgSendAudio;
|
||||
int gmsgTeamScore;
|
||||
int gmsgSendAudio, gmsgTeamScore, gmsgStatusIcon, gmsgArmorType;
|
||||
|
||||
void OnAmxxAttach()
|
||||
{
|
||||
@ -33,8 +32,11 @@ void OnMetaDetach()
|
||||
void ServerActivate_Post(edict_t *pEdictList, int edictCount, int clientMax)
|
||||
{
|
||||
g_pEdicts = pEdictList;
|
||||
|
||||
gmsgSendAudio = GET_USER_MSG_ID(PLID, "SendAudio", NULL);
|
||||
gmsgTeamScore = GET_USER_MSG_ID(PLID, "TeamScore", NULL);
|
||||
gmsgStatusIcon = GET_USER_MSG_ID(PLID, "StatusIcon", NULL);
|
||||
gmsgArmorType = GET_USER_MSG_ID(PLID, "ArmorType", NULL);
|
||||
|
||||
SET_META_RESULT(MRES_IGNORED);
|
||||
}
|
||||
|
@ -3,6 +3,8 @@
|
||||
extern edict_t* g_pEdicts;
|
||||
extern int gmsgSendAudio;
|
||||
extern int gmsgTeamScore;
|
||||
extern int gmsgStatusIcon;
|
||||
extern int gmsgArmorType;
|
||||
|
||||
void OnAmxxAttach();
|
||||
bool OnMetaAttach();
|
||||
|
@ -7,6 +7,7 @@
|
||||
#define BASE_MEMBERS(mx) CLASS_MEMBERS(CBaseEntity, mx)
|
||||
#define ANIM_MEMBERS(mx) CLASS_MEMBERS(CBaseAnimating, mx)
|
||||
#define PL_MEMBERS(mx) CLASS_MEMBERS(CBasePlayer, mx)
|
||||
#define EVAR_MEMBERS(mx) CLASS_MEMBERS(com_entvars, mx)
|
||||
|
||||
inline MType getMemberType(float*) { return MEMBER_FLOAT; }
|
||||
inline MType getMemberType(float) { return MEMBER_FLOAT; }
|
||||
@ -27,6 +28,11 @@ inline MType getMemberType(Vector*) { return MEMBER_VECTOR; }
|
||||
inline MType getMemberType(Vector) { return MEMBER_VECTOR; }
|
||||
|
||||
inline MType getMemberType(char*) { return MEMBER_STRING; }
|
||||
inline MType getMemberType(qstring_t) { return MEMBER_QSTRING; }
|
||||
|
||||
inline MType getMemberType(char) { return MEMBER_BYTE; }
|
||||
inline MType getMemberType(byte) { return MEMBER_BYTE; }
|
||||
inline MType getMemberType(byte*) { return MEMBER_BYTE; }
|
||||
|
||||
inline MType getMemberType(int*) { return MEMBER_INTEGER; }
|
||||
inline MType getMemberType(int) { return MEMBER_INTEGER; }
|
||||
@ -40,7 +46,6 @@ inline MType getMemberType(MusicState) { return MEMBER_INTEGER; }
|
||||
inline MType getMemberType(short) { return MEMBER_SHORT; }
|
||||
inline MType getMemberType(unsigned short) { return MEMBER_SHORT; }
|
||||
|
||||
inline MType getMemberType(char) { return MEMBER_BYTE; }
|
||||
inline MType getMemberType(bool) { return MEMBER_BOOL; }
|
||||
inline MType getMemberType(CUnifiedSignals) { return MEMBER_SIGNALS; }
|
||||
inline MType getMemberType(RebuyStruct) { return MEBMER_REBUYSTRUCT; }
|
||||
@ -379,6 +384,133 @@ member_t memberlist_player[] = {
|
||||
PL_MEMBERS(m_flLastCommandTime),
|
||||
};
|
||||
|
||||
member_t memberlist_entvars[] = {
|
||||
EVAR_MEMBERS(classname),
|
||||
EVAR_MEMBERS(globalname),
|
||||
EVAR_MEMBERS(origin),
|
||||
EVAR_MEMBERS(oldorigin),
|
||||
EVAR_MEMBERS(velocity),
|
||||
EVAR_MEMBERS(basevelocity),
|
||||
EVAR_MEMBERS(clbasevelocity),
|
||||
EVAR_MEMBERS(movedir),
|
||||
EVAR_MEMBERS(angles),
|
||||
EVAR_MEMBERS(avelocity),
|
||||
EVAR_MEMBERS(punchangle),
|
||||
EVAR_MEMBERS(v_angle),
|
||||
EVAR_MEMBERS(endpos),
|
||||
EVAR_MEMBERS(startpos),
|
||||
EVAR_MEMBERS(impacttime),
|
||||
EVAR_MEMBERS(starttime),
|
||||
EVAR_MEMBERS(fixangle),
|
||||
EVAR_MEMBERS(idealpitch),
|
||||
EVAR_MEMBERS(pitch_speed),
|
||||
EVAR_MEMBERS(ideal_yaw),
|
||||
EVAR_MEMBERS(yaw_speed),
|
||||
EVAR_MEMBERS(modelindex),
|
||||
EVAR_MEMBERS(model),
|
||||
EVAR_MEMBERS(viewmodel),
|
||||
EVAR_MEMBERS(weaponmodel),
|
||||
EVAR_MEMBERS(absmin),
|
||||
EVAR_MEMBERS(absmax),
|
||||
EVAR_MEMBERS(mins),
|
||||
EVAR_MEMBERS(maxs),
|
||||
EVAR_MEMBERS(size),
|
||||
EVAR_MEMBERS(ltime),
|
||||
EVAR_MEMBERS(nextthink),
|
||||
EVAR_MEMBERS(movetype),
|
||||
EVAR_MEMBERS(solid),
|
||||
EVAR_MEMBERS(skin),
|
||||
EVAR_MEMBERS(body),
|
||||
EVAR_MEMBERS(effects),
|
||||
EVAR_MEMBERS(gravity),
|
||||
EVAR_MEMBERS(friction),
|
||||
EVAR_MEMBERS(light_level),
|
||||
EVAR_MEMBERS(sequence),
|
||||
EVAR_MEMBERS(gaitsequence),
|
||||
EVAR_MEMBERS(frame),
|
||||
EVAR_MEMBERS(animtime),
|
||||
EVAR_MEMBERS(framerate),
|
||||
EVAR_MEMBERS(controller),
|
||||
EVAR_MEMBERS(blending),
|
||||
EVAR_MEMBERS(scale),
|
||||
EVAR_MEMBERS(rendermode),
|
||||
EVAR_MEMBERS(renderamt),
|
||||
EVAR_MEMBERS(rendercolor),
|
||||
EVAR_MEMBERS(renderfx),
|
||||
EVAR_MEMBERS(health),
|
||||
EVAR_MEMBERS(frags),
|
||||
EVAR_MEMBERS(weapons),
|
||||
EVAR_MEMBERS(takedamage),
|
||||
EVAR_MEMBERS(deadflag),
|
||||
EVAR_MEMBERS(view_ofs),
|
||||
EVAR_MEMBERS(button),
|
||||
EVAR_MEMBERS(impulse),
|
||||
EVAR_MEMBERS(chain),
|
||||
EVAR_MEMBERS(dmg_inflictor),
|
||||
EVAR_MEMBERS(enemy),
|
||||
EVAR_MEMBERS(aiment),
|
||||
EVAR_MEMBERS(owner),
|
||||
EVAR_MEMBERS(groundentity),
|
||||
EVAR_MEMBERS(spawnflags),
|
||||
EVAR_MEMBERS(flags),
|
||||
EVAR_MEMBERS(colormap),
|
||||
EVAR_MEMBERS(team),
|
||||
EVAR_MEMBERS(max_health),
|
||||
EVAR_MEMBERS(teleport_time),
|
||||
EVAR_MEMBERS(armortype),
|
||||
EVAR_MEMBERS(armorvalue),
|
||||
EVAR_MEMBERS(waterlevel),
|
||||
EVAR_MEMBERS(watertype),
|
||||
EVAR_MEMBERS(target),
|
||||
EVAR_MEMBERS(targetname),
|
||||
EVAR_MEMBERS(netname),
|
||||
EVAR_MEMBERS(message),
|
||||
EVAR_MEMBERS(dmg_take),
|
||||
EVAR_MEMBERS(dmg_save),
|
||||
EVAR_MEMBERS(dmg),
|
||||
EVAR_MEMBERS(dmgtime),
|
||||
EVAR_MEMBERS(noise),
|
||||
EVAR_MEMBERS(noise1),
|
||||
EVAR_MEMBERS(noise2),
|
||||
EVAR_MEMBERS(noise3),
|
||||
EVAR_MEMBERS(speed),
|
||||
EVAR_MEMBERS(air_finished),
|
||||
EVAR_MEMBERS(pain_finished),
|
||||
EVAR_MEMBERS(radsuit_finished),
|
||||
EVAR_MEMBERS(pContainingEntity),
|
||||
EVAR_MEMBERS(playerclass),
|
||||
EVAR_MEMBERS(maxspeed),
|
||||
EVAR_MEMBERS(fov),
|
||||
EVAR_MEMBERS(weaponanim),
|
||||
EVAR_MEMBERS(pushmsec),
|
||||
EVAR_MEMBERS(bInDuck),
|
||||
EVAR_MEMBERS(flTimeStepSound),
|
||||
EVAR_MEMBERS(flSwimTime),
|
||||
EVAR_MEMBERS(flDuckTime),
|
||||
EVAR_MEMBERS(iStepLeft),
|
||||
EVAR_MEMBERS(flFallVelocity),
|
||||
EVAR_MEMBERS(gamestate),
|
||||
EVAR_MEMBERS(oldbuttons),
|
||||
EVAR_MEMBERS(groupinfo),
|
||||
EVAR_MEMBERS(iuser1),
|
||||
EVAR_MEMBERS(iuser2),
|
||||
EVAR_MEMBERS(iuser3),
|
||||
EVAR_MEMBERS(iuser4),
|
||||
EVAR_MEMBERS(fuser1),
|
||||
EVAR_MEMBERS(fuser2),
|
||||
EVAR_MEMBERS(fuser3),
|
||||
EVAR_MEMBERS(fuser4),
|
||||
EVAR_MEMBERS(vuser1),
|
||||
EVAR_MEMBERS(vuser2),
|
||||
EVAR_MEMBERS(vuser3),
|
||||
EVAR_MEMBERS(vuser4),
|
||||
EVAR_MEMBERS(euser1),
|
||||
EVAR_MEMBERS(euser2),
|
||||
EVAR_MEMBERS(euser3),
|
||||
EVAR_MEMBERS(euser4)
|
||||
};
|
||||
|
||||
|
||||
memberlist_t memberlist;
|
||||
|
||||
member_t *memberlist_t::operator[](size_t members) const
|
||||
@ -393,6 +525,7 @@ member_t *memberlist_t::operator[](size_t members) const
|
||||
CASE(base)
|
||||
CASE(animating)
|
||||
CASE(player)
|
||||
CASE(entvars)
|
||||
}
|
||||
|
||||
return nullptr;
|
||||
|
@ -14,6 +14,8 @@ enum MType
|
||||
MEMBER_EDICT, // edict_t *, or edict_t * (same thing)
|
||||
MEMBER_VECTOR, // Any vector
|
||||
MEMBER_STRING, // char *, char []
|
||||
MEMBER_QSTRING, // quake string, like string_t
|
||||
MEMBER_RSTRING, // reverse of qstring to string
|
||||
MEMBER_INTEGER, // Any integer or enum
|
||||
MEMBER_SHORT, // 2 byte integer
|
||||
MEMBER_BYTE, // a byte
|
||||
@ -39,7 +41,8 @@ struct memberlist_t
|
||||
ht_gamerules,
|
||||
ht_base,
|
||||
ht_animating,
|
||||
ht_player
|
||||
ht_player,
|
||||
ht_entvars,
|
||||
};
|
||||
};
|
||||
|
||||
@ -366,3 +369,131 @@ enum CBasePlayer_Members
|
||||
m_musicState,
|
||||
m_flLastCommandTime
|
||||
};
|
||||
|
||||
// entvars
|
||||
enum EntVars
|
||||
{
|
||||
classname = BEGIN_MEMBER_REGION(entvars),
|
||||
globalname,
|
||||
origin,
|
||||
oldorigin,
|
||||
velocity,
|
||||
basevelocity,
|
||||
clbasevelocity,
|
||||
movedir,
|
||||
angles,
|
||||
avelocity,
|
||||
punchangle,
|
||||
v_angle,
|
||||
endpos,
|
||||
startpos,
|
||||
impacttime,
|
||||
starttime,
|
||||
fixangle,
|
||||
idealpitch,
|
||||
pitch_speed,
|
||||
ideal_yaw,
|
||||
yaw_speed,
|
||||
modelindex,
|
||||
model,
|
||||
viewmodel,
|
||||
weaponmodel,
|
||||
absmin,
|
||||
absmax,
|
||||
mins,
|
||||
maxs,
|
||||
size,
|
||||
ltime,
|
||||
nextthink,
|
||||
movetype,
|
||||
solid,
|
||||
skin,
|
||||
body,
|
||||
effects,
|
||||
gravity,
|
||||
friction,
|
||||
light_level,
|
||||
sequence,
|
||||
gaitsequence,
|
||||
frame,
|
||||
animtime,
|
||||
framerate,
|
||||
controller,
|
||||
blending,
|
||||
scale,
|
||||
rendermode,
|
||||
renderamt,
|
||||
rendercolor,
|
||||
renderfx,
|
||||
health,
|
||||
frags,
|
||||
weapons,
|
||||
takedamage,
|
||||
deadflag,
|
||||
view_ofs,
|
||||
button,
|
||||
impulse,
|
||||
chain,
|
||||
dmg_inflictor,
|
||||
enemy,
|
||||
aiment,
|
||||
owner,
|
||||
groundentity,
|
||||
spawnflags,
|
||||
flags,
|
||||
colormap,
|
||||
team,
|
||||
max_health,
|
||||
teleport_time,
|
||||
armortype,
|
||||
armorvalue,
|
||||
waterlevel,
|
||||
watertype,
|
||||
target,
|
||||
targetname,
|
||||
netname,
|
||||
message,
|
||||
dmg_take,
|
||||
dmg_save,
|
||||
dmg,
|
||||
dmgtime,
|
||||
noise,
|
||||
noise1,
|
||||
noise2,
|
||||
noise3,
|
||||
speed,
|
||||
air_finished,
|
||||
pain_finished,
|
||||
radsuit_finished,
|
||||
pContainingEntity,
|
||||
playerclass,
|
||||
maxspeed,
|
||||
fov,
|
||||
weaponanim,
|
||||
pushmsec,
|
||||
bInDuck,
|
||||
flTimeStepSound,
|
||||
flSwimTime,
|
||||
flDuckTime,
|
||||
iStepLeft,
|
||||
flFallVelocity,
|
||||
gamestate,
|
||||
oldbuttons,
|
||||
groupinfo,
|
||||
iuser1,
|
||||
iuser2,
|
||||
iuser3,
|
||||
iuser4,
|
||||
fuser1,
|
||||
fuser2,
|
||||
fuser3,
|
||||
fuser4,
|
||||
vuser1,
|
||||
vuser2,
|
||||
vuser3,
|
||||
vuser4,
|
||||
euser1,
|
||||
euser2,
|
||||
euser3,
|
||||
euser4
|
||||
};
|
||||
|
@ -132,6 +132,84 @@ cell AMX_NATIVE_CALL get_member_game(AMX *amx, cell *params)
|
||||
return get_member(g_pGameRules, member, element, dest);
|
||||
}
|
||||
|
||||
// native set_entvar(const index, const EntVars:var, any:...);
|
||||
cell AMX_NATIVE_CALL set_entvar(AMX *amx, cell *params)
|
||||
{
|
||||
enum args_e { arg_count, arg_index, arg_var, arg_value, arg_elem };
|
||||
member_t *member = memberlist[params[arg_var]];
|
||||
|
||||
if (member == nullptr) {
|
||||
MF_LogError(amx, AMX_ERR_NATIVE, "%s: unknown member id %i", __FUNCTION__, params[arg_var]);
|
||||
return FALSE;
|
||||
}
|
||||
CHECK_ISENTITY(arg_index);
|
||||
|
||||
edict_t *pEdict = edictByIndexAmx(params[arg_index]);
|
||||
if (pEdict == nullptr || pEdict->pvPrivateData == nullptr) {
|
||||
MF_LogError(amx, AMX_ERR_NATIVE, "%s: invalid or uninitialized entity", __FUNCTION__);
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
cell* value = getAmxAddr(amx, params[arg_value]);
|
||||
size_t element = (PARAMS_COUNT == 4) ? *getAmxAddr(amx, params[arg_elem]) : 0;
|
||||
|
||||
return set_member(&pEdict->v, member, element, value);
|
||||
}
|
||||
|
||||
// native any:get_entvar(const index, const EntVars:var, any:...);
|
||||
cell AMX_NATIVE_CALL get_entvar(AMX *amx, cell *params)
|
||||
{
|
||||
enum args_e { arg_count, arg_index, arg_var, arg_3, arg_4 };
|
||||
member_t *member = memberlist[params[arg_var]];
|
||||
|
||||
if (member == nullptr) {
|
||||
MF_LogError(amx, AMX_ERR_NATIVE, "%s: unknown member id %i", __FUNCTION__, params[arg_var]);
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
CHECK_ISENTITY(arg_index);
|
||||
|
||||
edict_t *pEdict = edictByIndexAmx(params[arg_index]);
|
||||
if (pEdict == nullptr || pEdict->pvPrivateData == nullptr) {
|
||||
MF_LogError(amx, AMX_ERR_NATIVE, "%s: invalid or uninitialized entity", __FUNCTION__);
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
cell* dest;
|
||||
size_t element;
|
||||
|
||||
if (PARAMS_COUNT == 4) {
|
||||
dest = getAmxAddr(amx, params[arg_3]);
|
||||
element = *getAmxAddr(amx, params[arg_4]);
|
||||
}
|
||||
else if (PARAMS_COUNT == 3) {
|
||||
cell* arg3 = getAmxAddr(amx, params[arg_3]);
|
||||
|
||||
if (isTypeReturnable(member->type)) {
|
||||
dest = nullptr;
|
||||
element = *arg3;
|
||||
}
|
||||
else {
|
||||
dest = arg3;
|
||||
element = 0;
|
||||
}
|
||||
}
|
||||
else {
|
||||
dest = nullptr;
|
||||
element = 0;
|
||||
}
|
||||
|
||||
return get_member(&pEdict->v, member, element, dest);
|
||||
}
|
||||
|
||||
AMX_NATIVE_INFO EntVars_Natives[] =
|
||||
{
|
||||
{ "set_entvar", set_entvar },
|
||||
{ "get_entvar", get_entvar },
|
||||
|
||||
{ nullptr, nullptr }
|
||||
};
|
||||
|
||||
AMX_NATIVE_INFO Member_Natives[] =
|
||||
{
|
||||
{ "set_member", set_member },
|
||||
@ -147,6 +225,8 @@ void RegisterNatives_Members()
|
||||
{
|
||||
if (api_cfg.hasReGameDLL())
|
||||
g_amxxapi.AddNatives(Member_Natives);
|
||||
|
||||
g_amxxapi.AddNatives(EntVars_Natives);
|
||||
}
|
||||
|
||||
BOOL set_member(void* pdata, const member_t *member, size_t element, cell* value)
|
||||
@ -187,7 +267,7 @@ BOOL set_member(void* pdata, const member_t *member, size_t element, cell* value
|
||||
if (member->max_size > sizeof(char*)) {
|
||||
// char []
|
||||
char *source = getAmxString(value);
|
||||
char *dest = get_member_direct<char *>(pdata, member->offset);
|
||||
char *dest = get_member_direct<char>(pdata, member->offset);
|
||||
strncpy(dest, source, member->max_size - 1);
|
||||
dest[member->max_size - 1] = '\0';
|
||||
|
||||
@ -198,6 +278,14 @@ BOOL set_member(void* pdata, const member_t *member, size_t element, cell* value
|
||||
g_ReGameFuncs->ChangeString(dest, source);
|
||||
}
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
case MEMBER_QSTRING:
|
||||
{
|
||||
char *source = getAmxString(value);
|
||||
string_t newstr = ALLOC_STRING(source);
|
||||
set_member<string_t>(pdata, member->offset, newstr, element);
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
case MEMBER_FLOAT:
|
||||
@ -281,7 +369,7 @@ cell get_member(void* pdata, const member_t *member, size_t element, cell* dest)
|
||||
if (!dest)
|
||||
return 0;
|
||||
|
||||
dest = get_member_direct<cell *>(pdata, member->offset, element);
|
||||
dest = (cell *)get_member_direct<Vector>(pdata, member->offset, element);
|
||||
return 1;
|
||||
}
|
||||
case MEMBER_STRING:
|
||||
@ -292,7 +380,7 @@ cell get_member(void* pdata, const member_t *member, size_t element, cell* dest)
|
||||
|
||||
if (member->max_size > sizeof(char*)) {
|
||||
// char []
|
||||
const char *src = get_member_direct<const char *>(pdata, member->offset);
|
||||
const char *src = get_member_direct<char>(pdata, member->offset);
|
||||
setAmxString(dest, src, element);
|
||||
} else {
|
||||
// char *
|
||||
@ -304,6 +392,20 @@ cell get_member(void* pdata, const member_t *member, size_t element, cell* dest)
|
||||
setAmxString(dest, src, element);
|
||||
}
|
||||
|
||||
return 1;
|
||||
}
|
||||
case MEMBER_QSTRING:
|
||||
{
|
||||
if (!dest)
|
||||
return 0;
|
||||
|
||||
string_t str = get_member<string_t>(pdata, member->offset);
|
||||
if (str == 0) {
|
||||
setAmxString(dest, "", 1);
|
||||
return 0;
|
||||
}
|
||||
|
||||
setAmxString(dest, STRING(str), element);
|
||||
return 1;
|
||||
}
|
||||
case MEMBER_FLOAT:
|
||||
|
@ -53,6 +53,8 @@ cell AMX_NATIVE_CALL rg_add_account(AMX *amx, cell *params)
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
enum GiveType { GT_APPEND, GT_REPLACE, GT_DROP_AND_REPLACE };
|
||||
|
||||
/*
|
||||
* Gives item to player
|
||||
*
|
||||
@ -61,11 +63,11 @@ cell AMX_NATIVE_CALL rg_add_account(AMX *amx, cell *params)
|
||||
*
|
||||
* @noreturn
|
||||
*
|
||||
* native rg_give_item(index, const pszName[]);
|
||||
* native rg_give_item(index, const pszName[], GiveType:type = GT_APPEND);
|
||||
*/
|
||||
cell AMX_NATIVE_CALL rg_give_item(AMX *amx, cell *params)
|
||||
{
|
||||
enum args_e { arg_count, arg_index, arg_item };
|
||||
enum args_e { arg_count, arg_index, arg_item, arg_type };
|
||||
|
||||
CHECK_ISPLAYER(arg_index);
|
||||
|
||||
@ -75,8 +77,38 @@ cell AMX_NATIVE_CALL rg_give_item(AMX *amx, cell *params)
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
GiveType type = static_cast<GiveType>(params[arg_type]);
|
||||
const char *itemName = getAmxString(amx, params[arg_item]);
|
||||
pPlayer->GiveNamedItem(itemName);
|
||||
|
||||
if (type > GT_APPEND) {
|
||||
CBasePlayer *player = static_cast<CBasePlayer *>(pPlayer->GetEntity());
|
||||
|
||||
auto pInfo = g_ReGameApi->GetWeaponSlot(itemName);
|
||||
auto pItem = player->m_rgpPlayerItems[ pInfo->slot ];
|
||||
|
||||
while (pItem != nullptr) {
|
||||
if (pItem->m_iId == pInfo->id) {
|
||||
pItem = pItem->m_pNext;
|
||||
continue;
|
||||
}
|
||||
|
||||
switch (type)
|
||||
{
|
||||
case GT_DROP_AND_REPLACE:
|
||||
pPlayer->DropPlayerItem(STRING(pItem->pev->classname));
|
||||
break;
|
||||
case GT_REPLACE:
|
||||
player->pev->weapons &= ~(1 << pItem->m_iId);
|
||||
player->RemovePlayerItem(pItem);
|
||||
pItem->Kill();
|
||||
break;
|
||||
}
|
||||
|
||||
pItem = pItem->m_pNext;
|
||||
}
|
||||
}
|
||||
|
||||
pPlayer->GiveNamedItemEx(itemName);
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
@ -510,7 +542,7 @@ cell AMX_NATIVE_CALL rg_find_ent_by_owner(AMX *amx, cell *params)
|
||||
* @return Weapon information value
|
||||
* @error If weapon_id and type are out of bound, an error will be thrown.
|
||||
*
|
||||
* native rg_get_weapon_info(any:...);
|
||||
* native any:rg_get_weapon_info(any:...);
|
||||
*/
|
||||
cell AMX_NATIVE_CALL rg_get_weapon_info(AMX *amx, cell *params)
|
||||
{
|
||||
@ -525,26 +557,19 @@ cell AMX_NATIVE_CALL rg_get_weapon_info(AMX *amx, cell *params)
|
||||
return 0;
|
||||
}
|
||||
|
||||
WeaponInfoStruct* info = g_ReGameApi->GetGameData()->GetWeaponInfo(weaponID);
|
||||
WeaponInfoStruct* info = g_ReGameApi->GetWeaponInfo(weaponID);
|
||||
char* szWeaponName = getAmxString(amx, params[arg_weapon_id]);
|
||||
|
||||
switch (info_type)
|
||||
{
|
||||
case WI_ID:
|
||||
if (szWeaponName == nullptr) {
|
||||
return WEAPON_NONE;
|
||||
}
|
||||
|
||||
_strlwr(szWeaponName);
|
||||
for (int i = 0; i < MAX_WEAPONS; ++i) {
|
||||
info = g_ReGameApi->GetGameData()->GetWeaponInfo(i);
|
||||
if (info == nullptr || info->id == WEAPON_NONE)
|
||||
continue;
|
||||
|
||||
if (strcmp(info->entityName, szWeaponName) == 0) {
|
||||
return info->id;
|
||||
if (szWeaponName != nullptr) {
|
||||
auto infoName = g_ReGameApi->GetWeaponInfo(szWeaponName);
|
||||
if (infoName != nullptr) {
|
||||
return infoName->id;
|
||||
}
|
||||
}
|
||||
|
||||
return WEAPON_NONE;
|
||||
case WI_COST:
|
||||
return info->cost;
|
||||
@ -605,7 +630,7 @@ cell AMX_NATIVE_CALL rg_set_weapon_info(AMX *amx, cell *params)
|
||||
}
|
||||
|
||||
cell* value = getAmxAddr(amx, params[arg_value]);
|
||||
WeaponInfoStruct *info = g_ReGameApi->GetGameData()->GetWeaponInfo(weaponID);
|
||||
WeaponInfoStruct *info = g_ReGameApi->GetWeaponInfo(weaponID);
|
||||
WpnInfo info_type = static_cast<WpnInfo>(params[arg_type]);
|
||||
|
||||
switch (info_type)
|
||||
@ -690,7 +715,9 @@ cell AMX_NATIVE_CALL rg_remove_item(AMX *amx, cell *params)
|
||||
pWeapon->RetireWeapon();
|
||||
}
|
||||
|
||||
pPlayer->pev->weapons &= ~(1 << pItem->m_iId);
|
||||
pPlayer->RemovePlayerItem(pItem);
|
||||
pItem->Kill();
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
@ -701,6 +728,216 @@ cell AMX_NATIVE_CALL rg_remove_item(AMX *amx, cell *params)
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
/*
|
||||
* Returns amount of ammo in the client's backpack for a specific weapon.
|
||||
*
|
||||
* @param index Client index
|
||||
* @param weapon Weapon id
|
||||
*
|
||||
* @return Amount of ammo in backpack
|
||||
*
|
||||
* native rg_get_user_bpammo(const index, WeaponIdType:weapon);
|
||||
*/
|
||||
cell AMX_NATIVE_CALL rg_get_user_bpammo(AMX *amx, cell *params)
|
||||
{
|
||||
enum args_e { arg_count, arg_index, arg_weapon };
|
||||
|
||||
CHECK_ISPLAYER(arg_index);
|
||||
|
||||
CBasePlayer *pPlayer = (CBasePlayer *)g_ReGameFuncs->UTIL_PlayerByIndex(params[arg_index]);
|
||||
if (pPlayer == nullptr || pPlayer->has_disconnected) {
|
||||
MF_LogError(amx, AMX_ERR_NATIVE, "%s: player %i is not connected", __FUNCTION__, params[arg_index]);
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
WeaponIdType weaponId = static_cast<WeaponIdType>(params[arg_weapon]);
|
||||
if (weaponId < WEAPON_P228 || weaponId > WEAPON_P90 || weaponId == WEAPON_KNIFE)
|
||||
{
|
||||
MF_LogError(amx, AMX_ERR_NATIVE, "Invalid weapon id %d", params[arg_weapon]);
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
for (auto pItem : pPlayer->m_rgpPlayerItems)
|
||||
{
|
||||
while (pItem != nullptr)
|
||||
{
|
||||
if (pItem->m_iId == weaponId) {
|
||||
return pPlayer->m_rgAmmo[ static_cast<CBasePlayerWeapon *>(pItem)->m_iPrimaryAmmoType ];
|
||||
}
|
||||
|
||||
pItem = pItem->m_pNext;
|
||||
}
|
||||
}
|
||||
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
/*
|
||||
* Sets amount of ammo in the client's backpack for a specific weapon.
|
||||
*
|
||||
* @param index Client index
|
||||
* @param weapon Weapon id
|
||||
* @param amount New backpack ammo amount to set
|
||||
*
|
||||
* @noreturn
|
||||
*
|
||||
* native rg_set_user_bpammo(const index, WeaponIdType:weapon, amount);
|
||||
*/
|
||||
cell AMX_NATIVE_CALL rg_set_user_bpammo(AMX *amx, cell *params)
|
||||
{
|
||||
enum args_e { arg_count, arg_index, arg_weapon, arg_amount };
|
||||
|
||||
CHECK_ISPLAYER(arg_index);
|
||||
|
||||
CBasePlayer *pPlayer = (CBasePlayer *)g_ReGameFuncs->UTIL_PlayerByIndex(params[arg_index]);
|
||||
if (pPlayer == nullptr || pPlayer->has_disconnected) {
|
||||
MF_LogError(amx, AMX_ERR_NATIVE, "%s: player %i is not connected", __FUNCTION__, params[arg_index]);
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
WeaponIdType weaponId = static_cast<WeaponIdType>(params[arg_weapon]);
|
||||
if (weaponId < WEAPON_P228 || weaponId > WEAPON_P90 || weaponId == WEAPON_KNIFE)
|
||||
{
|
||||
MF_LogError(amx, AMX_ERR_NATIVE, "Invalid weapon id %d", params[arg_weapon]);
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
for (auto pItem : pPlayer->m_rgpPlayerItems)
|
||||
{
|
||||
while (pItem != nullptr)
|
||||
{
|
||||
if (pItem->m_iId == weaponId) {
|
||||
pPlayer->m_rgAmmo[ static_cast<CBasePlayerWeapon *>(pItem)->m_iPrimaryAmmoType ] = params[arg_amount];
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
pItem = pItem->m_pNext;
|
||||
}
|
||||
}
|
||||
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
/*
|
||||
* Sets the client's defusekit status and allows to set a custom HUD icon and color.
|
||||
*
|
||||
* @param index Client index
|
||||
* @param defusekit If nonzero the client will have a defusekit, otherwise it will be removed
|
||||
* @param color Color RGB
|
||||
* @param icon HUD sprite to use as icon
|
||||
* @param flash If nonzero the icon will flash red
|
||||
*
|
||||
* @noreturn
|
||||
*
|
||||
* native rg_give_defusekit(const index, bool:bDefusekit = true, Float:color[] = {0.0, 160.0, 0.0}, const icon[] = "defuser", bool:bFlash = false);
|
||||
*/
|
||||
cell AMX_NATIVE_CALL rg_give_defusekit(AMX *amx, cell *params)
|
||||
{
|
||||
enum args_e { arg_count, arg_index, arg_def, arg_color, arg_icon, arg_flash };
|
||||
|
||||
CHECK_ISPLAYER(arg_index);
|
||||
|
||||
CBasePlayer *pPlayer = (CBasePlayer *)g_ReGameFuncs->UTIL_PlayerByIndex(params[arg_index]);
|
||||
if (pPlayer == nullptr || pPlayer->has_disconnected) {
|
||||
MF_LogError(amx, AMX_ERR_NATIVE, "%s: player %i is not connected", __FUNCTION__, params[arg_index]);
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
// on the map there is not bomb places
|
||||
if (CSGameRules() != nullptr && !CSGameRules()->m_bMapHasBombTarget && !CSGameRules()->m_bMapHasBombZone) {
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
pPlayer->m_bHasDefuser =
|
||||
pPlayer->pev->body = params[arg_def] != 0;
|
||||
|
||||
if (params[arg_def] != 0)
|
||||
{
|
||||
Vector* color = (Vector *)getAmxAddr(amx, params[arg_color]);
|
||||
const char* icon = getAmxString(amx, params[arg_icon]);
|
||||
|
||||
MESSAGE_BEGIN(MSG_ONE, gmsgStatusIcon, nullptr, pPlayer->pev);
|
||||
WRITE_BYTE(params[arg_flash] != 0 ? STATUSICON_FLASH : STATUSICON_SHOW);
|
||||
WRITE_STRING(icon);
|
||||
WRITE_BYTE(color->x);
|
||||
WRITE_BYTE(color->y);
|
||||
WRITE_BYTE(color->z);
|
||||
MESSAGE_END();
|
||||
}
|
||||
else
|
||||
{
|
||||
MESSAGE_BEGIN(MSG_ONE, gmsgStatusIcon, nullptr, pPlayer->pev);
|
||||
WRITE_BYTE(STATUSICON_HIDE);
|
||||
WRITE_STRING("defuser");
|
||||
MESSAGE_END();
|
||||
}
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
/*
|
||||
* Returns the client's armor value and retrieves the type of armor.
|
||||
*
|
||||
* @param index Client index
|
||||
* @param armortype Variable to store armor type in
|
||||
*
|
||||
* @return Amount of armor, 0 if client has no armor
|
||||
*
|
||||
* native rg_get_user_armor(const index, &ArmorType:armortype);
|
||||
*/
|
||||
cell AMX_NATIVE_CALL rg_get_user_armor(AMX *amx, cell *params)
|
||||
{
|
||||
enum args_e { arg_count, arg_index, arg_armortype };
|
||||
|
||||
CHECK_ISPLAYER(arg_index);
|
||||
|
||||
CBasePlayer *pPlayer = (CBasePlayer *)g_ReGameFuncs->UTIL_PlayerByIndex(params[arg_index]);
|
||||
if (pPlayer == nullptr || pPlayer->has_disconnected) {
|
||||
MF_LogError(amx, AMX_ERR_NATIVE, "%s: player %i is not connected", __FUNCTION__, params[arg_index]);
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
*getAmxAddr(amx, params[arg_armortype]) = pPlayer->m_iKevlar;
|
||||
return static_cast<cell>(pPlayer->pev->armorvalue);
|
||||
}
|
||||
|
||||
/*
|
||||
* Sets the client's armor value the type of armor.
|
||||
*
|
||||
* @param index Client index
|
||||
* @param armorvalue Amount of armor to set
|
||||
* @param armortype Armor type
|
||||
*
|
||||
* @noreturn
|
||||
*
|
||||
* native rg_set_user_armor(const index, armorvalue, ArmorType:armortype);
|
||||
*/
|
||||
cell AMX_NATIVE_CALL rg_set_user_armor(AMX *amx, cell *params)
|
||||
{
|
||||
enum args_e { arg_count, arg_index, arg_armorvalue, arg_armortype };
|
||||
|
||||
CHECK_ISPLAYER(arg_index);
|
||||
|
||||
CBasePlayer *pPlayer = (CBasePlayer *)g_ReGameFuncs->UTIL_PlayerByIndex(params[arg_index]);
|
||||
if (pPlayer == nullptr || pPlayer->has_disconnected) {
|
||||
MF_LogError(amx, AMX_ERR_NATIVE, "%s: player %i is not connected", __FUNCTION__, params[arg_index]);
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
int armorType = params[arg_armortype];
|
||||
|
||||
pPlayer->pev->armorvalue = params[arg_armorvalue];
|
||||
pPlayer->m_iKevlar = armorType;
|
||||
|
||||
if (armorType == ARMOR_KEVLAR || armorType == ARMOR_VESTHELM) {
|
||||
MESSAGE_BEGIN(MSG_ONE, gmsgArmorType, nullptr, pPlayer->pev);
|
||||
WRITE_BYTE(armorType == ARMOR_VESTHELM ? 1 : 0);
|
||||
MESSAGE_END();
|
||||
}
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
AMX_NATIVE_INFO Misc_Natives_RG[] =
|
||||
{
|
||||
{ "rg_set_animation", rg_set_animation },
|
||||
@ -730,6 +967,14 @@ AMX_NATIVE_INFO Misc_Natives_RG[] =
|
||||
{ "rg_remove_all_items", rg_remove_all_items },
|
||||
{ "rg_remove_item", rg_remove_item },
|
||||
|
||||
{ "rg_get_user_bpammo", rg_get_user_bpammo },
|
||||
{ "rg_set_user_bpammo", rg_set_user_bpammo },
|
||||
|
||||
{ "rg_give_defusekit", rg_give_defusekit },
|
||||
|
||||
{ "rg_get_user_armor", rg_get_user_armor },
|
||||
{ "rg_set_user_armor", rg_set_user_armor },
|
||||
|
||||
{ nullptr, nullptr }
|
||||
};
|
||||
|
||||
|
@ -11,6 +11,7 @@
|
||||
|
||||
#include <extdll.h>
|
||||
#include <cbase.h>
|
||||
#include "com_progdefs.h"
|
||||
|
||||
#include "osdep.h" // win32 vsnprintf, etc
|
||||
#include "sdk_util.h"
|
||||
|
@ -79,9 +79,9 @@ inline void set_member(edict_t *pEntity, int offset, T value, int element = 0)
|
||||
}
|
||||
|
||||
template <typename T>
|
||||
inline T get_member_direct(void *ptr, int offset, int element = 0, int size = 0)
|
||||
inline T* get_member_direct(void *ptr, int offset, int element = 0, int size = sizeof(T))
|
||||
{
|
||||
return reinterpret_cast<T>(reinterpret_cast<int8 *>(ptr) + offset + (element * size));
|
||||
return reinterpret_cast<T *>(reinterpret_cast<int8 *>(ptr) + offset + (element * size));
|
||||
}
|
||||
|
||||
template <typename T>
|
||||
|
Loading…
x
Reference in New Issue
Block a user