From 23fe1507a1a63ceab4f6251dd2af653cb62f6c3b Mon Sep 17 00:00:00 2001 From: s1lent Date: Thu, 28 Sep 2017 04:12:09 +0700 Subject: [PATCH] Add natives rg_set_user_ammo, rg_get_user_ammo, rg_give_custom_item, set_rebuy, get_rebuy Add all the members weapons, also CMapInfo, RebuyStruct, CGrenade Add hookchain StartDeathCam Cosmetic changes Update regamedll API 5.3 --- .../amxmodx/scripting/include/cssdk_const.inc | 20 + .../extra/amxmodx/scripting/include/reapi.inc | 44 +- .../scripting/include/reapi_engine.inc | 4 - .../scripting/include/reapi_gamedll.inc | 123 +- .../scripting/include/reapi_gamedll_const.inc | 1032 ++++++++++++++++- .../scripting/include/reapi_rechecker.inc | 2 - .../scripting/include/reapi_reunion.inc | 1 - .../amxmodx/scripting/include/reapi_vtc.inc | 3 - reapi/include/cssdk/dlls/player.h | 16 +- reapi/include/cssdk/dlls/regamedll_api.h | 16 +- reapi/include/cssdk/dlls/weapons.h | 122 +- reapi/src/hook_callback.cpp | 14 +- reapi/src/hook_callback.h | 3 +- reapi/src/hook_list.cpp | 37 +- reapi/src/hook_list.h | 1 + reapi/src/member_list.cpp | 383 +++++- reapi/src/member_list.h | 295 ++++- reapi/src/natives/natives_common.cpp | 14 +- reapi/src/natives/natives_hookchains.cpp | 50 +- reapi/src/natives/natives_members.cpp | 209 +++- reapi/src/natives/natives_misc.cpp | 915 ++++++++------- reapi/src/natives/natives_reunion.cpp | 17 +- reapi/src/natives/natives_vtc.cpp | 28 +- reapi/src/precompiled.h | 1 + reapi/src/reapi_utils.cpp | 29 + reapi/src/reapi_utils.h | 9 +- 26 files changed, 2633 insertions(+), 755 deletions(-) diff --git a/reapi/extra/amxmodx/scripting/include/cssdk_const.inc b/reapi/extra/amxmodx/scripting/include/cssdk_const.inc index 533ebe1..c1009b0 100644 --- a/reapi/extra/amxmodx/scripting/include/cssdk_const.inc +++ b/reapi/extra/amxmodx/scripting/include/cssdk_const.inc @@ -223,6 +223,17 @@ #define PFLAG_USING (1<<4) // Using a continuous entity #define PFLAG_OBSERVER (1<<5) // Player is locked in stationary cam mode. Spectators can move, observers can't. +// Player HUD +// CBasePlayer::m_iHideHUD +#define HIDEHUD_WEAPONS (1<<0) +#define HIDEHUD_FLASHLIGHT (1<<1) +#define HIDEHUD_ALL (1<<2) +#define HIDEHUD_HEALTH (1<<3) +#define HIDEHUD_TIMER (1<<4) +#define HIDEHUD_MONEY (1<<5) +#define HIDEHUD_CROSSHAIR (1<<6) +#define HIDEHUD_OBSERVER_CROSSHAIR (1<<7) + /** * @section get_entvar(entity, var_spawnflags) values */ @@ -1162,3 +1173,12 @@ enum ItemID ITEM_ANTIDOTE, ITEM_BATTERY }; + +// CMapInfo:m_iBuyingStatus +enum InfoMapBuyParam +{ + BUYING_EVERYONE = 0, + BUYING_ONLY_CTS, + BUYING_ONLY_TERRORISTS, + BUYING_NO_ONE, +}; diff --git a/reapi/extra/amxmodx/scripting/include/reapi.inc b/reapi/extra/amxmodx/scripting/include/reapi.inc index ba0397f..e95d793 100644 --- a/reapi/extra/amxmodx/scripting/include/reapi.inc +++ b/reapi/extra/amxmodx/scripting/include/reapi.inc @@ -39,7 +39,39 @@ enum members_tables_e mt_baseitem, mt_baseweapon, mt_weaponbox, - mt_armoury + mt_armoury, + mt_grenade, + mt_p228, + mt_scout, + mt_hegrenade, + mt_xm1014, + mt_c4, + mt_mac10, + mt_aug, + mt_smokegrenade, + mt_elite, + mt_fiveseven, + mt_ump45, + mt_sg550, + mt_galil, + mt_famas, + mt_usp, + mt_glock18, + mt_awp, + mt_mp5n, + mt_m249, + mt_m3, + mt_m4a1, + mt_tmp, + mt_g3sg1, + mt_deagle, + mt_sg552, + mt_ak47, + mt_knife, + mt_p90, + mt_shield, + mt_rebuystruct, + mt_mapinfo, }; // Is like FNullEnt @@ -94,7 +126,6 @@ enum HookChain * @param post Whether or not to forward this in post * * @return Returns a hook handle. Use EnableHookChain/DisableHookChain to toggle the forward on or off -* */ native HookChain:RegisterHookChain({EngineFunc, GamedllFunc, GamedllFunc_CBaseAnimating, GamedllFunc_CBasePlayer, GamedllFunc_CSGameRules, ReCheckerFunc}:function_id, const callback[], post = 0); @@ -114,7 +145,6 @@ native bool:DisableHookChain(HookChain:hook); * @param hook The hook to re-enable * * @return Returns true if the function is successfully executed, otherwise false -* */ native bool:EnableHookChain(HookChain:hook); @@ -135,7 +165,6 @@ native SetHookChainReturn(AType:type, any:...); * @param [maxlen] Max length of string (optional) * * @return If an integer or boolean or one byte or float, array or everything else is passed via 1st argument and more -* */ native any:GetHookChainReturn(AType:type, any:...); @@ -148,7 +177,6 @@ native any:GetHookChainReturn(AType:type, any:...); * @param [maxlen] Max length of string (optional) * * @return Returns true if the function is successfully executed, otherwise false -* */ native SetHookChainArg(number, AType:type, any:...); @@ -157,7 +185,6 @@ native SetHookChainArg(number, AType:type, any:...); * @note This native also checks the validity of an entity. * * @return true/false -* */ native bool:FClassnameIs(const entityIndex, const className[]); @@ -192,7 +219,6 @@ native get_viewent(const index); * Check if the entity is valid. * * @return true/false -* */ native bool:is_entity(const entityIndex); @@ -200,7 +226,6 @@ native bool:is_entity(const entityIndex); * Check if ReHLDS is available. * * @return true/false -* */ native bool:is_rehlds(); @@ -208,7 +233,6 @@ native bool:is_rehlds(); * Check if ReGameDLL is available. * * @return true/false -* */ native bool:is_regamedll(); @@ -224,7 +248,6 @@ native bool:has_reunion(); * Check if VTC is available. * * @return true/false -* */ native bool:has_vtc(); @@ -232,7 +255,6 @@ native bool:has_vtc(); * Check if Rechecker is available. * * @return true/false -* */ native bool:has_rechecker(); diff --git a/reapi/extra/amxmodx/scripting/include/reapi_engine.inc b/reapi/extra/amxmodx/scripting/include/reapi_engine.inc index 4dc00cc..1c64826 100644 --- a/reapi/extra/amxmodx/scripting/include/reapi_engine.inc +++ b/reapi/extra/amxmodx/scripting/include/reapi_engine.inc @@ -61,7 +61,6 @@ native set_key_value(const pbuffer, const key[], const value[]); * @param mapname New map name. * * @noreturn -* */ native rh_set_mapname(const mapname[]); @@ -74,7 +73,6 @@ native rh_set_mapname(const mapname[]); * MNT_TRUE will return the original map name independant of the name set with via rh_set_mapname * * @noreturn -* */ native rh_get_mapname(output[], len, MapNameType:type = MNT_SET); @@ -82,7 +80,6 @@ native rh_get_mapname(output[], len, MapNameType:type = MNT_SET); * Reverts back the original map name. * * @noreturn -* */ native rh_reset_mapname(); @@ -101,7 +98,6 @@ native rh_reset_mapname(); * @param origin Specify origin and only on "param" entity worldspawn that is 0 * * @return true if the emission was successfull, false otherwise -* */ native bool:rh_emit_sound2(const entity, const recipient, const channel, const sample[], Float:vol = VOL_NORM, Float:attn = ATTN_NORM, const flags = 0, const pitch = PITCH_NORM, emitFlags = 0, const Float:origin[3] = {0.0,0.0,0.0}); diff --git a/reapi/extra/amxmodx/scripting/include/reapi_gamedll.inc b/reapi/extra/amxmodx/scripting/include/reapi_gamedll.inc index 6b090bb..bc2a478 100644 --- a/reapi/extra/amxmodx/scripting/include/reapi_gamedll.inc +++ b/reapi/extra/amxmodx/scripting/include/reapi_gamedll.inc @@ -21,7 +21,6 @@ native set_member_game(CSGameRules_Members:member, any:...); * @param member The specified member, look at the enums with name CSGameRules_Members * * @return If an integer or boolean or one byte, array or everything else is passed via the 3rd argument and more, look at the argument list for the specified member -* */ native any:get_member_game(CSGameRules_Members:member, any:...); @@ -33,9 +32,7 @@ native any:get_member_game(CSGameRules_Members:member, any:...); * * @return 1 on success. */ -native set_member(const index, {CBaseEntity_Members, CBaseAnimating_Members, CBaseMonster_Members, - CBasePlayer_Members, CCSPlayer_Members, CBasePlayerItem_Members, CBasePlayerWeapon_Members, - CWeaponBox_Members, CArmoury_Members}:member, any:...); +native set_member(const index, any:member, any:...); /* * Returns a value from an entity's member. @@ -45,9 +42,7 @@ native set_member(const index, {CBaseEntity_Members, CBaseAnimating_Members, CBa * * @return If an integer or boolean or one byte, array or everything else is passed via the 3rd argument and more, look at the argument list for the specified member */ -native any:get_member(const index, {CBaseEntity_Members, CBaseAnimating_Members, CBaseMonster_Members, - CBasePlayer_Members, CCSPlayer_Members, CBasePlayerItem_Members, CBasePlayerWeapon_Members, - CWeaponBox_Members, CArmoury_Members}:member, any:...); +native any:get_member(const index, any:member, any:...); /* * Sets playermove var. @@ -103,6 +98,24 @@ native set_pmtrace(const tracehandle, const PMTrace:var, any:...); */ native any:get_pmtrace(const tracehandle, const PMTrace:var, any:...); +/* +* Sets a RebuyStruct member. +* +* @param var The specified RebuyStruct, look at the enum RebuyStruct +* +* @return 1 on success. +*/ +native set_rebuy(const RebuyHandle:rebuyhandle, const RebuyStruct:member, value); + +/* +* Returns a RebuyStruct member +* +* @param var The specified RebuyStruct, look at the enum RebuyStruct +* +* @return If an integer or boolean or one byte, array or everything else is passed via the 3rd argument and more, look at the argument list for the specified RebuyStruct +*/ +native get_rebuy(const RebuyHandle:rebuyhandle, RebuyStruct:member); + /* * Assign the number of the player's animation. * @@ -135,6 +148,20 @@ native rg_add_account(const index, amount, AccountSet:typeSet = AS_ADD, const bo */ native rg_give_item(const index, const pszName[], GiveType:type = GT_APPEND); +/* +* Gives the player an custom item, this means that don't handled API things. +* +* @example rg_give_custom_item(id, "weapon_c4"); doesn't sets the member m_bHasC4 to true, as the rg_give_item does. +* +* @param index Client index +* @param pszName Item classname +* @param type Look at the enums with name GiveType +* +* @return Index of entity if successfull, -1 otherwise +* +*/ +native rg_give_custom_item(const index, const pszName[], GiveType:type = GT_APPEND); + /* * Give the default items to a player. * @@ -269,7 +296,6 @@ native rg_update_teamscores(const iCtsWins = 0, const iTsWins = 0, const bool:bA * @note: Do not use this if you use a custom classname * * @return Index of the created entity or 0 otherwise -* */ native rg_create_entity(const classname[], const bool:useHashTable = false); @@ -283,7 +309,6 @@ native rg_create_entity(const classname[], const bool:useHashTable = false); * @note: Do not use this if you use a custom classname * * @return Entity index > 0 if found, 0 otherwise -* */ native rg_find_ent_by_class(start_index, const classname[], const bool:useHashTable = false); @@ -294,7 +319,6 @@ native rg_find_ent_by_class(start_index, const classname[], const bool:useHashTa * @param classname Classname to search for * * @return 1 if found, 0 otherwise -* */ native rg_find_ent_by_owner(&start_index, const classname[], owner); @@ -305,7 +329,6 @@ native rg_find_ent_by_owner(&start_index, const classname[], owner); * @param weapon Weapon name * * @return Weapon's entity index, 0 otherwise -* */ native rg_find_weapon_bpack_by_name(const index, const weapon[]); @@ -316,7 +339,6 @@ native rg_find_weapon_bpack_by_name(const index, const weapon[]); * @param item Item name * * @return true if he does, false otherwise -* */ native bool:rg_has_item_by_name(const index, const item[]); @@ -328,7 +350,6 @@ native bool:rg_has_item_by_name(const index, const item[]); * * @return Weapon information * @error If weapon_id or type are out of bounds, an error will be thrown -* */ native any:rg_get_weapon_info(any:...); @@ -339,7 +360,6 @@ native any:rg_get_weapon_info(any:...); * @param type Info type, see WI_* constants * * @return 1 on success, 0 otherwise -* */ native rg_set_weapon_info(const {WeaponIdType,_}:weapon_id, WpnInfo:type, any:...); @@ -350,7 +370,6 @@ native rg_set_weapon_info(const {WeaponIdType,_}:weapon_id, WpnInfo:type, any:.. * @param slot The slot that will be emptied * * @return 1 on success, 0 otherwise -* */ native rg_remove_items_by_slot(const index, const InventorySlotType:slot); @@ -361,7 +380,6 @@ native rg_remove_items_by_slot(const index, const InventorySlotType:slot); * @param slot Specific slot for remove of each item. * * @return 1 on success, 0 otherwise -* */ native rg_drop_items_by_slot(const index, const InventorySlotType:slot); @@ -372,7 +390,6 @@ native rg_drop_items_by_slot(const index, const InventorySlotType:slot); * @param removeSuit Remove suit * * @return 1 on success, 0 otherwise -* */ native rg_remove_all_items(const index, const bool:removeSuit = false); @@ -395,7 +412,6 @@ native rg_drop_item(const index, const item_name[]); * @param arg Optional command arguments * * @return 1 on success, 0 otherwise -* */ native rg_internal_cmd(const index, const cmd[], const arg[] = ""); @@ -406,21 +422,9 @@ native rg_internal_cmd(const index, const cmd[], const arg[] = ""); * @param item_name Item classname * * @return 1 if found and remove, 0 otherwise -* */ native rg_remove_item(const index, const item_name[]); -/* -* Returns the 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 the amount of ammo in the client's backpack for a specific weapon. * @@ -429,10 +433,40 @@ native rg_get_user_bpammo(const index, WeaponIdType:weapon); * @param amount New backpack ammo amount to set * * @noreturn -* */ native rg_set_user_bpammo(const index, WeaponIdType:weapon, amount); +/* +* Returns the 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 the amount of clip ammo for a specific weapon. +* +* @param index Client index +* @param weapon Weapon id +* @param amount New clip ammo amount to set +* +* @noreturn +*/ +native rg_set_user_ammo(const index, WeaponIdType:weapon, amount); + +/* +* Returns the amount of clip ammo for a specific weapon. +* +* @param index Client index +* @param weapon Weapon id +* +* @return Amount of clip ammo +*/ +native rg_get_user_ammo(const index, WeaponIdType:weapon); + /* * Sets the client's defusekit status and allows to set a custom HUD icon and color. * @@ -443,7 +477,6 @@ native rg_set_user_bpammo(const index, WeaponIdType:weapon, amount); * @param flash If nonzero the icon will flash red * * @noreturn -* */ native rg_give_defusekit(const index, const bool:bDefusekit = true, const Float:color[] = {0.0, 160.0, 0.0}, const icon[] = "defuser", const bool:bFlash = false); @@ -454,9 +487,8 @@ native rg_give_defusekit(const index, const bool:bDefusekit = true, const Float: * @param armortype Variable to store armor type in * * @return Amount of armor, 0 if the client has no armor -* */ -native rg_get_user_armor(const index, &ArmorType:armortype); +native rg_get_user_armor(const index, &ArmorType:armortype = ARMOR_NONE); /* * Sets the client's armor value and the type of armor. @@ -466,7 +498,6 @@ native rg_get_user_armor(const index, &ArmorType:armortype); * @param armortype Armor type to set * * @noreturn -* */ native rg_set_user_armor(const index, armorvalue, ArmorType:armortype); @@ -482,7 +513,6 @@ native rg_set_user_armor(const index, armorvalue, ArmorType:armortype); * @param send_teaminfo If true, a TeamInfo message will be sent * * @return 1 on success, 0 otherwise -* */ native rg_set_user_team(const index, {TeamName,_}:team, {ModelName,_}:model = MODEL_AUTO, const bool:send_teaminfo = true); @@ -494,7 +524,6 @@ native rg_set_user_team(const index, {TeamName,_}:team, {ModelName,_}:model = MO * @param update_index If true, the modelindex is updated as well * * @return 1 on success, 0 otherwise -* */ native rg_set_user_model(const index, const model[], const bool:update_index = false); @@ -505,7 +534,6 @@ native rg_set_user_model(const index, const model[], const bool:update_index = f * @param update_index If true, the modelindex is reset as well * * @return 1 on success, 0 otherwise -* */ native rg_reset_user_model(const index, const bool:update_index = false); @@ -516,7 +544,6 @@ native rg_reset_user_model(const index, const bool:update_index = false); * @param silent To enable silent footsteps * * @return 1 on success, 0 otherwise -* */ native rg_set_user_footsteps(const index, bool:silent = false); @@ -526,7 +553,6 @@ native rg_set_user_footsteps(const index, bool:silent = false); * @param index Client index * * @return 1 if the player has silent footsteps, 0 otherwise -* */ native rg_get_user_footsteps(const index); @@ -537,7 +563,6 @@ native rg_get_user_footsteps(const index); * @param receiver Receiver index, if 0 it will transfer to a random player * * @return 1 on success, 0 otherwise -* */ native rg_transfer_c4(const index, const receiver = 0); @@ -548,7 +573,6 @@ native rg_transfer_c4(const index, const receiver = 0); * @param weapon Weapon entity-index, if 0 then all weapons will be reloaded * * @return 1 on success, 0 otherwise -* */ native rg_instant_reload_weapons(const index, const weapon = 0); @@ -559,7 +583,6 @@ native rg_instant_reload_weapons(const index, const weapon = 0); * @param amount The money amount * * @noreturn -* */ native rg_set_account_rules(const RewardRules:rules_index, const amount); @@ -577,7 +600,6 @@ native rg_get_account_rules(const RewardRules:rules_index); * Checks if the bomb is planted. * * @return true if the bomb is planted, false otherwise -* */ native bool:rg_is_bomb_planted(); @@ -588,7 +610,6 @@ native bool:rg_is_bomb_planted(); * @param team Team id * * @return 1 on success, 0 otherwise -* */ native rg_join_team(const index, const TeamName:team); @@ -596,7 +617,6 @@ native rg_join_team(const index, const TeamName:team); * Instantly balances the teams. * * @noreturn -* */ native rg_balance_teams(); @@ -604,7 +624,6 @@ native rg_balance_teams(); * Swaps players' teams without reseting frags, deaths and wins. * * @noreturn -* */ native rg_swap_all_players(); @@ -615,7 +634,6 @@ native rg_swap_all_players(); * @param index Client index * * @noreturn -* */ native rg_switch_team(const index); @@ -626,7 +644,6 @@ native rg_switch_team(const index); * @param weapon Weapon entity-index * * @return 1 on success, 0 otherwise -* */ native rg_switch_weapon(const index, const weapon); @@ -634,7 +651,6 @@ native rg_switch_weapon(const index, const weapon); * Gets which team has a higher join priority. * * @return Returns the Team Name -* */ native TeamName:rg_get_join_team_priority(); @@ -645,7 +661,6 @@ native TeamName:rg_get_join_team_priority(); * @param attacker Attacker index * * @return true if he can take damage, false otherwise -* */ native bool:rg_is_player_can_takedamage(const index, const attacker); @@ -655,7 +670,6 @@ native bool:rg_is_player_can_takedamage(const index, const attacker); * @param entity Weaponbox entity * * @return return enum of WeaponIdType -* */ native WeaponIdType:rg_get_weaponbox_id(const entity); @@ -665,7 +679,6 @@ native WeaponIdType:rg_get_weaponbox_id(const entity); * @param index Client index * * @noreturn -* */ native rg_round_respawn(const index); @@ -675,7 +688,6 @@ native rg_round_respawn(const index); * @param index Client index * * @noreturn -* */ native rg_reset_maxspeed(const index); @@ -688,7 +700,6 @@ native rg_reset_maxspeed(const index); * @param observer Send for everyone who is observing the player * * @noreturn -* */ native rg_send_bartime(const index, const duration, const bool:observer = true); @@ -701,7 +712,6 @@ native rg_send_bartime(const index, const duration, const bool:observer = true); * @param observer Send for everyone who is observing the player * * @noreturn -* */ native rg_send_bartime2(const index, const duration, const startPercent, const bool:observer = true); @@ -713,6 +723,5 @@ native rg_send_bartime2(const index, const duration, const startPercent, const b * @param pitch Sound pitch * * @noreturn -* */ native rg_send_audio(const index, const sample[], const pitch = PITCH_NORM); diff --git a/reapi/extra/amxmodx/scripting/include/reapi_gamedll_const.inc b/reapi/extra/amxmodx/scripting/include/reapi_gamedll_const.inc index 5db9697..922d241 100644 --- a/reapi/extra/amxmodx/scripting/include/reapi_gamedll_const.inc +++ b/reapi/extra/amxmodx/scripting/include/reapi_gamedll_const.inc @@ -486,8 +486,13 @@ enum GamedllFunc_CBasePlayer * Return type: bool * Params: (const this) */ - RG_CBasePlayer_GetIntoGame + RG_CBasePlayer_GetIntoGame, + /* + * Description: Called when a player dying and goes into observer mode like StartObserver + * Params: (const this) + */ + RG_CBasePlayer_StartDeathCam }; enum GamedllFunc_CSGameRules @@ -2792,8 +2797,8 @@ enum CBasePlayer_Members /* * Description: - * Member type: class Vector - * Get params: get_member(index, member, element); - * Set params: set_member(index, member, value, element); + * Get params: get_member(index, member, Float:output[3]); + * Set params: set_member(index, member, Float:dest[3]); */ m_vecAutoAim, @@ -2928,8 +2933,8 @@ enum CBasePlayer_Members /* * Description: - * Member type: class Vector - * Get params: get_member(index, member, element); - * Set params: set_member(index, member, value, element); + * Get params: get_member(index, member, Float:output[3]); + * Set params: set_member(index, member, Float:dest[3]); */ m_prevgaitorigin, @@ -3088,7 +3093,7 @@ enum CBasePlayer_Members /* * Description: - * Member type: struct RebuyStruct - * Get params: get_member(index, member); + * Get params: RebuyHandle:get_member(index, member); * Set params: set_member(index, member, value); */ m_rebuyStruct, @@ -3190,6 +3195,89 @@ enum CBasePlayer_Members m_flLastCommandTime }; +enum RebuyStruct +{ + /* + * Description: - + * Member type: int + * Get params: get_rebuy(RebuyHandle:handle, RebuyStruct:member); + * Set params: set_rebuy(RebuyHandle:handle, RebuyStruct:member, value); + */ + m_primaryWeapon = BEGIN_MEMBER_REGION(rebuystruct), + + /* + * Description: - + * Member type: int + * Get params: get_rebuy(RebuyHandle:handle, RebuyStruct:member); + * Set params: set_rebuy(RebuyHandle:handle, RebuyStruct:member, value); + */ + m_primaryAmmo, + + /* + * Description: - + * Member type: int + * Get params: get_rebuy(RebuyHandle:handle, RebuyStruct:member); + * Set params: set_rebuy(RebuyHandle:handle, RebuyStruct:member, value); + */ + m_secondaryWeapon, + + /* + * Description: - + * Member type: int + * Get params: get_rebuy(RebuyHandle:handle, RebuyStruct:member); + * Set params: set_rebuy(RebuyHandle:handle, RebuyStruct:member, value); + */ + m_secondaryAmmo, + + /* + * Description: - + * Member type: int + * Get params: get_rebuy(RebuyHandle:handle, RebuyStruct:member); + * Set params: set_rebuy(RebuyHandle:handle, RebuyStruct:member, value); + */ + m_heGrenade, + + /* + * Description: - + * Member type: int + * Get params: get_rebuy(RebuyHandle:handle, RebuyStruct:member); + * Set params: set_rebuy(RebuyHandle:handle, RebuyStruct:member, value); + */ + m_flashbang, + + /* + * Description: - + * Member type: int + * Get params: get_rebuy(RebuyHandle:handle, RebuyStruct:member); + * Set params: set_rebuy(RebuyHandle:handle, RebuyStruct:member, value); + */ + m_smokeGrenade, + + /* + * Description: - + * Member type: int + * Get params: get_rebuy(RebuyHandle:handle, RebuyStruct:member); + * Set params: set_rebuy(RebuyHandle:handle, RebuyStruct:member, value); + */ + m_defuser, + + /* + * Description: - + * Member type: int + * Get params: get_rebuy(RebuyHandle:handle, RebuyStruct:member); + * Set params: set_rebuy(RebuyHandle:handle, RebuyStruct:member, value); + */ + m_nightVision, + + /* + * Description: enum ArmorType + * Member type: int + * Get params: get_rebuy(RebuyHandle:handle, RebuyStruct:member); + * Set params: set_rebuy(RebuyHandle:handle, RebuyStruct:member, value); + */ + m_armor, +}; + enum PlayerMove { /* @@ -3375,7 +3463,7 @@ enum PlayerMove * Set params: set_pmove(const PlayerMove:var, Float:value); */ pm_flNextPrimaryAttack, - + /* * Description: - * Member type: int @@ -3383,7 +3471,7 @@ enum PlayerMove * Set params: set_pmove(const PlayerMove:var, value); */ pm_effects, - + /* * Description: - * Member type: int @@ -3391,7 +3479,7 @@ enum PlayerMove * Set params: set_pmove(const PlayerMove:var, value); */ pm_flags, - + /* * Description: - * Member type: int @@ -3415,7 +3503,7 @@ enum PlayerMove * Set params: set_pmove(const PlayerMove:var, Float:value); */ pm_friction, - + /* * Description: - * Member type: int @@ -3431,7 +3519,7 @@ enum PlayerMove * Set params: set_pmove(const PlayerMove:var, Float:value); */ pm_waterjumptime, - + /* * Description: - * Member type: qboolean @@ -3439,7 +3527,7 @@ enum PlayerMove * Set params: set_pmove(const PlayerMove:var, value); */ pm_dead, - + /* * Description: - * Member type: int @@ -3447,7 +3535,7 @@ enum PlayerMove * Set params: set_pmove(const PlayerMove:var, value); */ pm_deadflag, - + /* * Description: - * Member type: int @@ -3455,7 +3543,7 @@ enum PlayerMove * Set params: set_pmove(const PlayerMove:var, value); */ pm_spectator, - + /* * Description: - * Member type: int @@ -3463,7 +3551,7 @@ enum PlayerMove * Set params: set_pmove(const PlayerMove:var, value); */ pm_movetype, - + /* * Description: - * Member type: int @@ -3471,7 +3559,7 @@ enum PlayerMove * Set params: set_pmove(const PlayerMove:var, value); */ pm_onground, - + /* * Description: - * Member type: int @@ -3479,7 +3567,7 @@ enum PlayerMove * Set params: set_pmove(const PlayerMove:var, value); */ pm_waterlevel, - + /* * Description: - * Member type: int @@ -3487,7 +3575,7 @@ enum PlayerMove * Set params: set_pmove(const PlayerMove:var, value); */ pm_watertype, - + /* * Description: - * Member type: int @@ -3527,7 +3615,7 @@ enum PlayerMove * Set params: set_pmove(const PlayerMove:var, Float:value); */ pm_clientmaxspeed, - + /* * Description: - * Member type: int @@ -3535,7 +3623,7 @@ enum PlayerMove * Set params: set_pmove(const PlayerMove:var, value); */ pm_iuser1, - + /* * Description: - * Member type: int @@ -3543,7 +3631,7 @@ enum PlayerMove * Set params: set_pmove(const PlayerMove:var, value); */ pm_iuser2, - + /* * Description: - * Member type: int @@ -3551,7 +3639,7 @@ enum PlayerMove * Set params: set_pmove(const PlayerMove:var, value); */ pm_iuser3, - + /* * Description: - * Member type: int @@ -3623,7 +3711,7 @@ enum PlayerMove * Set params: set_pmove(const PlayerMove:var, Float:dest[3]); */ pm_vuser4, - + /* * Description: - * Member type: int @@ -3631,7 +3719,7 @@ enum PlayerMove * Set params: set_pmove(const PlayerMove:var, value); */ pm_numphysent, - + /* * Description: - * Member type: struct usercmd_s * @@ -4354,3 +4442,899 @@ enum CArmoury_Members */ m_Armoury_bAlreadyCounted, }; + +// CGrenade +enum CGrenade_Members +{ + /* + * Description: - + * Member type: bool + * Get params: get_member(index, member); + * Set params: set_member(index, member, value); + */ + m_Grenade_bStartDefuse = BEGIN_MEMBER_REGION(grenade), + + /* + * Description: - + * Member type: bool + * Get params: get_member(index, member); + * Set params: set_member(index, member, value); + */ + m_Grenade_bIsC4, + + /* + * Description: - + * Member type: class EHANDLE + * Get params: get_member(index, member); + * Set params: set_member(index, member, value); + */ + m_Grenade_pBombDefuser, + + /* + * Description: - + * Member type: float + * Get params: Float:get_member(index, member); + * Set params: set_member(index, member, Float:value); + */ + m_Grenade_flDefuseCountDown, + + /* + * Description: - + * Member type: float + * Get params: Float:get_member(index, member); + * Set params: set_member(index, member, Float:value); + */ + m_Grenade_flC4Blow, + + /* + * Description: - + * Member type: float + * Get params: Float:get_member(index, member); + * Set params: set_member(index, member, Float:value); + */ + m_Grenade_flNextFreqInterval, + + /* + * Description: - + * Member type: float + * Get params: Float:get_member(index, member); + * Set params: set_member(index, member, Float:value); + */ + m_Grenade_flNextBeep, + + /* + * Description: - + * Member type: float + * Get params: Float:get_member(index, member); + * Set params: set_member(index, member, Float:value); + */ + m_Grenade_flNextFreq, + + /* + * Description: - + * Member type: char * + * Get params: get_member(index, member, dest[], const lenght); + * Set params: set_member(index, member, const source[]); + */ + m_Grenade_sBeepName, + + /* + * Description: - + * Member type: float + * Get params: Float:get_member(index, member); + * Set params: set_member(index, member, Float:value); + */ + m_Grenade_fAttenu, + + /* + * Description: - + * Member type: float + * Get params: Float:get_member(index, member); + * Set params: set_member(index, member, Float:value); + */ + m_Grenade_flNextBlink, + + /* + * Description: - + * Member type: float + * Get params: Float:get_member(index, member); + * Set params: set_member(index, member, Float:value); + */ + m_Grenade_fNextDefuse, + + /* + * Description: - + * Member type: bool + * Get params: get_member(index, member); + * Set params: set_member(index, member, value); + */ + m_Grenade_bJustBlew, + + /* + * Description: - + * Member type: int + * Get params: get_member(index, member); + * Set params: set_member(index, member, value); + */ + m_Grenade_iTeam, + + /* + * Description: - + * Member type: int + * Get params: get_member(index, member); + * Set params: set_member(index, member, value); + */ + m_Grenade_iCurWave, + + /* + * Description: - + * Member type: struct edict_s * + * Get params: get_member(index, member); + * Set params: set_member(index, member, value); + */ + m_Grenade_pentCurBombTarget, + + /* + * Description: - + * Member type: int + * Get params: get_member(index, member); + * Set params: set_member(index, member, value); + */ + m_Grenade_SGSmoke, + + /* + * Description: - + * Member type: int + * Get params: get_member(index, member); + * Set params: set_member(index, member, value); + */ + m_Grenade_angle, + + /* + * Description: - + * Member type: unsigned short + * Get params: get_member(index, member); + * Set params: set_member(index, member, value); + */ + m_Grenade_usEvent, + + /* + * Description: - + * Member type: bool + * Get params: get_member(index, member); + * Set params: set_member(index, member, value); + */ + m_Grenade_bLightSmoke, + + /* + * Description: - + * Member type: bool + * Get params: get_member(index, member); + * Set params: set_member(index, member, value); + */ + m_Grenade_bDetonated, + + /* + * Description: - + * Member type: class Vector + * Get params: get_member(index, member, Float:output[3]); + * Set params: set_member(index, member, Float:dest[3]); + */ + m_Grenade_vSmokeDetonate, + + /* + * Description: - + * Member type: int + * Get params: get_member(index, member); + * Set params: set_member(index, member, value); + */ + m_Grenade_iBounceCount, + + /* + * Description: Whether or not this grenade has issued its DANGER sound to the world sound list yet. + * Member type: BOOL + * Get params: get_member(index, member); + * Set params: set_member(index, member, value); + */ + m_Grenade_fRegisteredSound, +}; + +// CP228 +enum CP228_Members +{ + /* + * Description: - + * Member type: int + * Get params: get_member(index, member); + * Set params: set_member(index, member, value); + */ + m_P228_iShell = BEGIN_MEMBER_REGION(p228), + + /* + * Description: - + * Member type: unsigned short + * Get params: get_member(index, member); + * Set params: set_member(index, member, value); + */ + m_P228_usFire, +}; + +// CSCOUT +enum CSCOUT_Members +{ + /* + * Description: - + * Member type: int + * Get params: get_member(index, member); + * Set params: set_member(index, member, value); + */ + m_SCOUT_iShell = BEGIN_MEMBER_REGION(scout), + + /* + * Description: - + * Member type: unsigned short + * Get params: get_member(index, member); + * Set params: set_member(index, member, value); + */ + m_SCOUT_usFire, +}; + +// CHEGrenade +enum CHEGrenade_Members +{ + /* + * Description: - + * Member type: unsigned short + * Get params: get_member(index, member); + * Set params: set_member(index, member, value); + */ + m_HEGrenade_usCreate = BEGIN_MEMBER_REGION(hegrenade), +}; + +// CXM1014 +enum CXM1014_Members +{ + /* + * Description: - + * Member type: int + * Get params: get_member(index, member); + * Set params: set_member(index, member, value); + */ + m_XM1014_iShell = BEGIN_MEMBER_REGION(xm1014), + + /* + * Description: - + * Member type: float + * Get params: Float:get_member(index, member); + * Set params: set_member(index, member, Float:value); + */ + m_XM1014_flPumpTime, + + /* + * Description: - + * Member type: unsigned short + * Get params: get_member(index, member); + * Set params: set_member(index, member, value); + */ + m_XM1014_usFire, +}; + +// CC4 +enum CC4_Members +{ + /* + * Description: - + * Member type: bool + * Get params: get_member(index, member); + * Set params: set_member(index, member, value); + */ + m_C4_bStartedArming = BEGIN_MEMBER_REGION(c4), + + /* + * Description: - + * Member type: bool + * Get params: get_member(index, member); + * Set params: set_member(index, member, value); + */ + m_C4_bBombPlacedAnimation, + + /* + * Description: - + * Member type: float + * Get params: Float:get_member(index, member); + * Set params: set_member(index, member, Float:value); + */ + m_C4_fArmedTime, + + /* + * Description: - + * Member type: bool + * Get params: get_member(index, member); + * Set params: set_member(index, member, value); + */ + m_C4_bHasShield, +}; + +// CMAC10 +enum CMAC10_Members +{ + /* + * Description: - + * Member type: int + * Get params: get_member(index, member); + * Set params: set_member(index, member, value); + */ + m_MAC10_iShell = BEGIN_MEMBER_REGION(mac10), + + /* + * Description: - + * Member type: int + * Get params: get_member(index, member); + * Set params: set_member(index, member, value); + */ + m_MAC10_iShellOn, + + /* + * Description: - + * Member type: unsigned short + * Get params: get_member(index, member); + * Set params: set_member(index, member, value); + */ + m_MAC10_usFire, +}; + +// CAUG +enum CAUG_Members +{ + /* + * Description: - + * Member type: int + * Get params: get_member(index, member); + * Set params: set_member(index, member, value); + */ + m_AUG_iShell = BEGIN_MEMBER_REGION(aug), + + /* + * Description: - + * Member type: int + * Get params: get_member(index, member); + * Set params: set_member(index, member, value); + */ + m_AUG_iShellOn, + + /* + * Description: - + * Member type: unsigned short + * Get params: get_member(index, member); + * Set params: set_member(index, member, value); + */ + m_AUG_usFire, +}; + +// CSmokeGrenade +enum CSmokeGrenade_Members +{ + /* + * Description: - + * Member type: unsigned short + * Get params: get_member(index, member); + * Set params: set_member(index, member, value); + */ + m_SmokeGrenade_usCreate = BEGIN_MEMBER_REGION(smokegrenade), +}; + +// CELITE +enum CELITE_Members +{ + /* + * Description: - + * Member type: int + * Get params: get_member(index, member); + * Set params: set_member(index, member, value); + */ + m_ELITE_iShell = BEGIN_MEMBER_REGION(elite), + + /* + * Description: - + * Member type: unsigned short + * Get params: get_member(index, member); + * Set params: set_member(index, member, value); + */ + m_ELITE_usFire_LEFT, + + /* + * Description: - + * Member type: unsigned short + * Get params: get_member(index, member); + * Set params: set_member(index, member, value); + */ + m_ELITE_usFire_RIGHT, +}; + +// CFiveSeven +enum CFiveSeven_Members +{ + /* + * Description: - + * Member type: int + * Get params: get_member(index, member); + * Set params: set_member(index, member, value); + */ + m_FiveSeven_iShell = BEGIN_MEMBER_REGION(fiveseven), + + /* + * Description: - + * Member type: unsigned short + * Get params: get_member(index, member); + * Set params: set_member(index, member, value); + */ + m_FiveSeven_usFire, +}; + +// CUMP45 +enum CUMP45_Members +{ + /* + * Description: - + * Member type: int + * Get params: get_member(index, member); + * Set params: set_member(index, member, value); + */ + m_UMP45_iShell = BEGIN_MEMBER_REGION(ump45), + + /* + * Description: - + * Member type: int + * Get params: get_member(index, member); + * Set params: set_member(index, member, value); + */ + m_UMP45_iShellOn, + + /* + * Description: - + * Member type: unsigned short + * Get params: get_member(index, member); + * Set params: set_member(index, member, value); + */ + m_UMP45_usFire, +}; + +// CSG550 +enum CSG550_Members +{ + m_SG550_iShell = BEGIN_MEMBER_REGION(sg550), + + /* + * Description: - + * Member type: unsigned short + * Get params: get_member(index, member); + * Set params: set_member(index, member, value); + */ + m_SG550_usFire, +}; + +// CGalil +enum CGalil_Members +{ + /* + * Description: - + * Member type: int + * Get params: get_member(index, member); + * Set params: set_member(index, member, value); + */ + m_Galil_iShell = BEGIN_MEMBER_REGION(galil), + + /* + * Description: - + * Member type: int + * Get params: get_member(index, member); + * Set params: set_member(index, member, value); + */ + m_Galil_iShellOn, + + /* + * Description: - + * Member type: unsigned short + * Get params: get_member(index, member); + * Set params: set_member(index, member, value); + */ + m_Galil_usFire, +}; + +// CFamas +enum CFamas_Members +{ + /* + * Description: - + * Member type: int + * Get params: get_member(index, member); + * Set params: set_member(index, member, value); + */ + m_Famas_iShell = BEGIN_MEMBER_REGION(famas), + + /* + * Description: - + * Member type: int + * Get params: get_member(index, member); + * Set params: set_member(index, member, value); + */ + m_Famas_iShellOn, +}; + +// CUSP +enum CUSP_Members +{ + /* + * Description: - + * Member type: int + * Get params: get_member(index, member); + * Set params: set_member(index, member, value); + */ + m_USP_iShell = BEGIN_MEMBER_REGION(usp), + + /* + * Description: - + * Member type: unsigned short + * Get params: get_member(index, member); + * Set params: set_member(index, member, value); + */ + m_USP_usFire, +}; + +// CGLOCK18 +enum CGLOCK18_Members +{ + /* + * Description: - + * Member type: int + * Get params: get_member(index, member); + * Set params: set_member(index, member, value); + */ + m_GLOCK18_iShell = BEGIN_MEMBER_REGION(glock18), + + /* + * Description: - + * Member type: bool + * Get params: get_member(index, member); + * Set params: set_member(index, member, value); + */ + m_GLOCK18_bBurstFire, +}; + +// CAWP +enum CAWP_Members +{ + /* + * Description: - + * Member type: int + * Get params: get_member(index, member); + * Set params: set_member(index, member, value); + */ + m_AWP_iShell = BEGIN_MEMBER_REGION(awp), + + /* + * Description: - + * Member type: unsigned short + * Get params: get_member(index, member); + * Set params: set_member(index, member, value); + */ + m_AWP_usFire, +}; + +// CMP5N +enum CMP5N_Members +{ + /* + * Description: - + * Member type: int + * Get params: get_member(index, member); + * Set params: set_member(index, member, value); + */ + m_MP5N_iShell = BEGIN_MEMBER_REGION(mp5n), + + /* + * Description: - + * Member type: int + * Get params: get_member(index, member); + * Set params: set_member(index, member, value); + */ + m_MP5N_iShellOn, + + /* + * Description: - + * Member type: unsigned short + * Get params: get_member(index, member); + * Set params: set_member(index, member, value); + */ + m_MP5N_usFire, +}; + +// CM249 +enum CM249_Members +{ + /* + * Description: - + * Member type: int + * Get params: get_member(index, member); + * Set params: set_member(index, member, value); + */ + m_M249_iShell = BEGIN_MEMBER_REGION(m249), + + /* + * Description: - + * Member type: int + * Get params: get_member(index, member); + * Set params: set_member(index, member, value); + */ + m_M249_iShellOn, + + /* + * Description: - + * Member type: unsigned short + * Get params: get_member(index, member); + * Set params: set_member(index, member, value); + */ + m_M249_usFire, +}; + +// CM3 +enum CM3_Members +{ + m_M3_iShell = BEGIN_MEMBER_REGION(m3), + + /* + * Description: - + * Member type: float + * Get params: Float:get_member(index, member); + * Set params: set_member(index, member, Float:value); + */ + m_M3_flPumpTime, + + /* + * Description: - + * Member type: unsigned short + * Get params: get_member(index, member); + * Set params: set_member(index, member, value); + */ + m_M3_usFire, +}; + +// CM4A1 +enum CM4A1_Members +{ + /* + * Description: - + * Member type: int + * Get params: get_member(index, member); + * Set params: set_member(index, member, value); + */ + m_M4A1_iShell = BEGIN_MEMBER_REGION(m4a1), + + /* + * Description: - + * Member type: int + * Get params: get_member(index, member); + * Set params: set_member(index, member, value); + */ + m_M4A1_iShellOn, + + /* + * Description: - + * Member type: unsigned short + * Get params: get_member(index, member); + * Set params: set_member(index, member, value); + */ + m_M4A1_usFire, +}; + +// CTMP +enum CTMP_Members +{ + /* + * Description: - + * Member type: int + * Get params: get_member(index, member); + * Set params: set_member(index, member, value); + */ + m_TMP_iShell = BEGIN_MEMBER_REGION(tmp), + + /* + * Description: - + * Member type: int + * Get params: get_member(index, member); + * Set params: set_member(index, member, value); + */ + m_TMP_iShellOn, + + /* + * Description: - + * Member type: unsigned short + * Get params: get_member(index, member); + * Set params: set_member(index, member, value); + */ + m_TMP_usFire, +}; + +// CG3SG1 +enum CG3SG1_Members +{ + /* + * Description: - + * Member type: int + * Get params: get_member(index, member); + * Set params: set_member(index, member, value); + */ + m_G3SG1_iShell = BEGIN_MEMBER_REGION(g3sg1), + + /* + * Description: - + * Member type: unsigned short + * Get params: get_member(index, member); + * Set params: set_member(index, member, value); + */ + m_G3SG1_usFire, +}; + +// CDEAGLE +enum CDEAGLE_Members +{ + /* + * Description: - + * Member type: int + * Get params: get_member(index, member); + * Set params: set_member(index, member, value); + */ + m_DEAGLE_iShell = BEGIN_MEMBER_REGION(deagle), + + /* + * Description: - + * Member type: unsigned short + * Get params: get_member(index, member); + * Set params: set_member(index, member, value); + */ + m_DEAGLE_usFire, +}; + +// CSG552 +enum CSG552_Members +{ + /* + * Description: - + * Member type: int + * Get params: get_member(index, member); + * Set params: set_member(index, member, value); + */ + m_SG552_iShell = BEGIN_MEMBER_REGION(sg552), + + /* + * Description: - + * Member type: int + * Get params: get_member(index, member); + * Set params: set_member(index, member, value); + */ + m_SG552_iShellOn, + + /* + * Description: - + * Member type: unsigned short + * Get params: get_member(index, member); + * Set params: set_member(index, member, value); + */ + m_SG552_usFire, +}; + +// CAK47 +enum CAK47_Members +{ + /* + * Description: - + * Member type: int + * Get params: get_member(index, member); + * Set params: set_member(index, member, value); + */ + m_AK47_iShell = BEGIN_MEMBER_REGION(ak47), + + /* + * Description: - + * Member type: int + * Get params: get_member(index, member); + * Set params: set_member(index, member, value); + */ + m_AK47_iShellOn, + + /* + * Description: - + * Member type: unsigned short + * Get params: get_member(index, member); + * Set params: set_member(index, member, value); + */ + m_AK47_usFire, +}; + +// CKnife +enum CKnife_Members +{ + /* + * Description: - + * Member type: TraceResult + * Get params: TraceResult:get_member(index, member); + * Set params: set_member(index, member, TraceResult:value); + */ + m_Knife_trHit = BEGIN_MEMBER_REGION(knife), + + /* + * Description: - + * Member type: unsigned short + * Get params: get_member(index, member); + * Set params: set_member(index, member, value); + */ + m_Knife_usKnife, +}; + +// CP90 +enum CP90_Members +{ + /* + * Description: - + * Member type: int + * Get params: get_member(index, member); + * Set params: set_member(index, member, value); + */ + m_P90_iShell = BEGIN_MEMBER_REGION(p90), + + /* + * Description: - + * Member type: int + * Get params: get_member(index, member); + * Set params: set_member(index, member, value); + */ + m_P90_iShellOn, + + /* + * Description: - + * Member type: unsigned short + * Get params: get_member(index, member); + * Set params: set_member(index, member, value); + */ + m_P90_usFire, +}; + +// CWShield +enum CShield_Members +{ + /* + * Description: - + * Member type: class EHANDLE + * Get params: get_member(index, member); + * Set params: set_member(index, member, value); + */ + m_Shield_hEntToIgnoreTouchesFrom = BEGIN_MEMBER_REGION(shield), + + /* + * Description: - + * Member type: float + * Get params: Float:get_member(index, member); + * Set params: set_member(index, member, Float:value); + */ + m_Shield_flTimeToIgnoreTouches, +}; + +// CMapInfo +enum CMapInfo_Members +{ + /* + * Description: - + * Member type: enum InfoMapBuyParam + * Get params: get_member(index, member); + * Set params: set_member(index, member, value); + */ + m_MapInfo_iBuyingStatus = BEGIN_MEMBER_REGION(mapinfo), + + /* + * Description: - + * Member type: float + * Get params: Float:get_member(index, member); + * Set params: set_member(index, member, Float:value); + */ + m_MapInfo_flBombRadius, +}; diff --git a/reapi/extra/amxmodx/scripting/include/reapi_rechecker.inc b/reapi/extra/amxmodx/scripting/include/reapi_rechecker.inc index 068ffde..50c7f2d 100644 --- a/reapi/extra/amxmodx/scripting/include/reapi_rechecker.inc +++ b/reapi/extra/amxmodx/scripting/include/reapi_rechecker.inc @@ -44,7 +44,6 @@ enum ReCheckerFunc * @param hash Hash of file to request. * * @return Returns a hook handle. Use UnRegisterQueryFile to remove the forward -* */ native QueryFileHook:RegisterQueryFile(const file[], const function[], const ResourceType:type, const hash = -1); @@ -55,6 +54,5 @@ native QueryFileHook:RegisterQueryFile(const file[], const function[], const Res * @param hook The hook to remove * * @return Returns true if the hook is successfully removed, otherwise false -* */ native bool:UnRegisterQueryFile(QueryFileHook:hook); diff --git a/reapi/extra/amxmodx/scripting/include/reapi_reunion.inc b/reapi/extra/amxmodx/scripting/include/reapi_reunion.inc index 09ee254..ea85bce 100644 --- a/reapi/extra/amxmodx/scripting/include/reapi_reunion.inc +++ b/reapi/extra/amxmodx/scripting/include/reapi_reunion.inc @@ -45,6 +45,5 @@ native client_auth_type:REU_GetAuthtype(const index); * @param index Client index * * @return 1/0 -* */ native bool:REU_IsRevemuWithoutAdminRights(const index); diff --git a/reapi/extra/amxmodx/scripting/include/reapi_vtc.inc b/reapi/extra/amxmodx/scripting/include/reapi_vtc.inc index 3da1adf..98e3aae 100644 --- a/reapi/extra/amxmodx/scripting/include/reapi_vtc.inc +++ b/reapi/extra/amxmodx/scripting/include/reapi_vtc.inc @@ -9,7 +9,6 @@ * @param index Client index * * @return true if client is speaking, false otherwise -* */ native bool:VTC_IsClientSpeaking(const index); @@ -37,7 +36,6 @@ native VTC_UnmuteClient(const index); * @param index Client index * * @return true if client is muted, false otherwise -* */ native bool:VTC_IsClientMuted(const index); @@ -51,7 +49,6 @@ native bool:VTC_IsClientMuted(const index); * VTC_PlaySound(id, "sound/ambience/Opera.wav"); * * @noreturn -* */ native VTC_PlaySound(const receiver, const soundFilePath[]); diff --git a/reapi/include/cssdk/dlls/player.h b/reapi/include/cssdk/dlls/player.h index 365d663..53a9652 100644 --- a/reapi/include/cssdk/dlls/player.h +++ b/reapi/include/cssdk/dlls/player.h @@ -363,28 +363,28 @@ public: CCSPlayer *CSPlayer() const; // templates - template - CBasePlayerItem *ForEachItem(int slot, const Functor &func) + template + T *ForEachItem(int slot, const Functor &func) { auto item = m_rgpPlayerItems[ slot ]; while (item) { - if (func(item)) - return item; + if (func(static_cast(item))) + return static_cast(item); item = item->m_pNext; } return nullptr; } - template - CBasePlayerItem *ForEachItem(const Functor &func) + template + T *ForEachItem(const Functor &func) { for (auto item : m_rgpPlayerItems) { while (item) { - if (func(item)) - return item; + if (func(static_cast(item))) + return static_cast(item); item = item->m_pNext; } diff --git a/reapi/include/cssdk/dlls/regamedll_api.h b/reapi/include/cssdk/dlls/regamedll_api.h index 165f5b2..5cefdd5 100644 --- a/reapi/include/cssdk/dlls/regamedll_api.h +++ b/reapi/include/cssdk/dlls/regamedll_api.h @@ -36,7 +36,7 @@ #include "items.h" #define REGAMEDLL_API_VERSION_MAJOR 5 -#define REGAMEDLL_API_VERSION_MINOR 0 +#define REGAMEDLL_API_VERSION_MINOR 3 // CBasePlayer::Spawn hook typedef IVoidHookChainClass IReGameHook_CBasePlayer_Spawn; @@ -87,8 +87,8 @@ typedef IHookChainClass IReGam typedef IHookChainRegistryClass IReGameHookRegistry_CBasePlayer_RemovePlayerItem; // CBasePlayer::GiveAmmo hook -typedef IHookChainClass IReGameHook_CBasePlayer_GiveAmmo; -typedef IHookChainRegistryClass IReGameHookRegistry_CBasePlayer_GiveAmmo; +typedef IHookChainClass IReGameHook_CBasePlayer_GiveAmmo; +typedef IHookChainRegistryClass IReGameHookRegistry_CBasePlayer_GiveAmmo; // CBasePlayer::ResetMaxSpeed hook typedef IVoidHookChainClass IReGameHook_CBasePlayer_ResetMaxSpeed; @@ -354,6 +354,14 @@ typedef IVoidHookChainRegistry<> IReGameHookRegistry_CSGameRules_BalanceTeams; typedef IVoidHookChain<> IReGameHook_CSGameRules_OnRoundFreezeEnd; typedef IVoidHookChainRegistry<> IReGameHookRegistry_CSGameRules_OnRoundFreezeEnd; +// PM_UpdateStepSound hook +typedef IVoidHookChain<> IReGameHook_PM_UpdateStepSound; +typedef IVoidHookChainRegistry<> IReGameHookRegistry_PM_UpdateStepSound; + +// CBasePlayer::StartDeathCam hook +typedef IVoidHookChainClass IReGameHook_CBasePlayer_StartDeathCam; +typedef IVoidHookChainRegistryClass IReGameHookRegistry_CBasePlayer_StartDeathCam; + class IReGameHookchains { public: virtual ~IReGameHookchains() {} @@ -442,6 +450,8 @@ public: virtual IReGameHookRegistry_CSGameRules_GoToIntermission* CSGameRules_GoToIntermission() = 0; virtual IReGameHookRegistry_CSGameRules_BalanceTeams* CSGameRules_BalanceTeams() = 0; virtual IReGameHookRegistry_CSGameRules_OnRoundFreezeEnd* CSGameRules_OnRoundFreezeEnd() = 0; + virtual IReGameHookRegistry_PM_UpdateStepSound* PM_UpdateStepSound() = 0; + virtual IReGameHookRegistry_CBasePlayer_StartDeathCam* CBasePlayer_StartDeathCam() = 0; }; struct ReGameFuncs_t { diff --git a/reapi/include/cssdk/dlls/weapons.h b/reapi/include/cssdk/dlls/weapons.h index 3678a6c..9ce376c 100644 --- a/reapi/include/cssdk/dlls/weapons.h +++ b/reapi/include/cssdk/dlls/weapons.h @@ -331,12 +331,9 @@ public: virtual void WeaponIdle() = 0; virtual BOOL UseDecrement() = 0; virtual BOOL IsPistol() = 0; - public: int m_iShell; - unsigned short GetEventID() const { return m_usFireUSP; } -private: - unsigned short m_usFireUSP; + unsigned short m_usFire; }; class CMP5N: public CBasePlayerWeapon { @@ -353,10 +350,8 @@ public: virtual BOOL UseDecrement() = 0; public: int m_iShell; - int iShellOn; - unsigned short GetEventID() const { return m_usFireMP5N; } -private: - unsigned short m_usFireMP5N; + int m_iShellOn; + unsigned short m_usFire; }; class CSG552: public CBasePlayerWeapon { @@ -374,10 +369,8 @@ public: virtual BOOL UseDecrement() = 0; public: int m_iShell; - int iShellOn; - unsigned short GetEventID() const { return m_usFireSG552; } -private: - unsigned short m_usFireSG552; + int m_iShellOn; + unsigned short m_usFire; }; class CAK47: public CBasePlayerWeapon { @@ -395,10 +388,8 @@ public: virtual BOOL UseDecrement() = 0; public: int m_iShell; - int iShellOn; - unsigned short GetEventID() const { return m_usFireAK47; } -private: - unsigned short m_usFireAK47; + int m_iShellOn; + unsigned short m_usFire; }; class CAUG: public CBasePlayerWeapon { @@ -416,10 +407,8 @@ public: virtual BOOL UseDecrement() = 0; public: int m_iShell; - int iShellOn; - unsigned short GetEventID() const { return m_usFireAug; } -private: - unsigned short m_usFireAug; + int m_iShellOn; + unsigned short m_usFire; }; class CAWP: public CBasePlayerWeapon { @@ -437,9 +426,7 @@ public: virtual BOOL UseDecrement() = 0; public: int m_iShell; - unsigned short GetEventID() const { return m_usFireAWP; } -private: - unsigned short m_usFireAWP; + unsigned short m_usFire; }; // for usermsg BombDrop @@ -464,8 +451,6 @@ public: bool m_bStartedArming; bool m_bBombPlacedAnimation; float m_fArmedTime; - bool HasShield() const { return m_bHasShield; } -private: bool m_bHasShield; }; @@ -485,9 +470,7 @@ public: virtual BOOL IsPistol() = 0; public: int m_iShell; - unsigned short GetEventID() const { return m_usFireDeagle; } -private: - unsigned short m_usFireDeagle; + unsigned short m_usFire; }; class CFlashbang: public CBasePlayerWeapon { @@ -523,9 +506,7 @@ public: virtual BOOL UseDecrement() = 0; public: int m_iShell; - unsigned short GetEventID() const { return m_usFireG3SG1; } -private: - unsigned short m_usFireG3SG1; + unsigned short m_usFire; }; class CGLOCK18: public CBasePlayerWeapon { @@ -563,7 +544,7 @@ public: virtual void WeaponIdle() = 0; virtual BOOL UseDecrement() = 0; public: - unsigned short m_usCreateExplosion; + unsigned short m_usCreate; }; class CKnife: public CBasePlayerWeapon { @@ -599,10 +580,8 @@ public: virtual BOOL UseDecrement() = 0; public: int m_iShell; - int iShellOn; - unsigned short GetEventID() const { return m_usFireM249; } -private: - unsigned short m_usFireM249; + int m_iShellOn; + unsigned short m_usFire; }; class CM3: public CBasePlayerWeapon { @@ -620,9 +599,7 @@ public: public: int m_iShell; float m_flPumpTime; - unsigned short GetEventID() const { return m_usFireM3; } -private: - unsigned short m_usFireM3; + unsigned short m_usFire; }; class CM4A1: public CBasePlayerWeapon { @@ -640,10 +617,8 @@ public: virtual BOOL UseDecrement() = 0; public: int m_iShell; - int iShellOn; - unsigned short GetEventID() const { return m_usFireM4A1; } -private: - unsigned short m_usFireM4A1; + int m_iShellOn; + unsigned short m_usFire; }; class CMAC10: public CBasePlayerWeapon { @@ -660,10 +635,8 @@ public: virtual BOOL UseDecrement() = 0; public: int m_iShell; - int iShellOn; - unsigned short GetEventID() const { return m_usFireMAC10; } -private: - unsigned short m_usFireMAC10; + int m_iShellOn; + unsigned short m_usFire; }; class CP228: public CBasePlayerWeapon { @@ -682,9 +655,7 @@ public: virtual BOOL IsPistol() = 0; public: int m_iShell; - unsigned short GetEventID() const { return m_usFireP228; } -private: - unsigned short m_usFireP228; + unsigned short m_usFire; }; class CP90: public CBasePlayerWeapon { @@ -701,10 +672,8 @@ public: virtual BOOL UseDecrement() = 0; public: int m_iShell; - int iShellOn; - unsigned short GetEventID() const { return m_usFireP90; } -private: - unsigned short m_usFireP90; + int m_iShellOn; + unsigned short m_usFire; }; class CSCOUT: public CBasePlayerWeapon { @@ -722,9 +691,7 @@ public: virtual BOOL UseDecrement() = 0; public: int m_iShell; - unsigned short GetEventID() const { return m_usFireScout; } -private: - unsigned short m_usFireScout; + unsigned short m_usFire; }; class CSmokeGrenade: public CBasePlayerWeapon { @@ -743,7 +710,7 @@ public: virtual void WeaponIdle() = 0; virtual BOOL UseDecrement() = 0; public: - unsigned short m_usCreateSmoke; + unsigned short m_usCreate; }; class CTMP: public CBasePlayerWeapon { @@ -760,10 +727,8 @@ public: virtual BOOL UseDecrement() = 0; public: int m_iShell; - int iShellOn; - unsigned short GetEventID() const { return m_usFireTMP; } -private: - unsigned short m_usFireTMP; + int m_iShellOn; + unsigned short m_usFire; }; class CXM1014: public CBasePlayerWeapon { @@ -781,9 +746,7 @@ public: public: int m_iShell; float m_flPumpTime; - unsigned short GetEventID() const { return m_usFireXM1014; } -private: - unsigned short m_usFireXM1014; + unsigned short m_usFire; }; class CELITE: public CBasePlayerWeapon { @@ -801,11 +764,8 @@ public: virtual BOOL IsPistol() = 0; public: int m_iShell; - unsigned short GetEventID_Left() const { return m_usFireELITE_LEFT; } - unsigned short GetEventID_Right() const { return m_usFireELITE_RIGHT; } -private: - unsigned short m_usFireELITE_LEFT; - unsigned short m_usFireELITE_RIGHT; + unsigned short m_usFire_LEFT; + unsigned short m_usFire_RIGHT; }; class CFiveSeven: public CBasePlayerWeapon { @@ -824,9 +784,7 @@ public: virtual BOOL IsPistol() = 0; public: int m_iShell; - unsigned short GetEventID() const { return m_usFireFiveSeven; } -private: - unsigned short m_usFireFiveSeven; + unsigned short m_usFire; }; class CUMP45: public CBasePlayerWeapon { @@ -843,10 +801,8 @@ public: virtual BOOL UseDecrement() = 0; public: int m_iShell; - int iShellOn; - unsigned short GetEventID() const { return m_usFireUMP45; } -private: - unsigned short m_usFireUMP45; + int m_iShellOn; + unsigned short m_usFire; }; class CSG550: public CBasePlayerWeapon { @@ -864,9 +820,7 @@ public: virtual BOOL UseDecrement() = 0; public: int m_iShell; - unsigned short GetEventID() const { return m_usFireSG550; } -private: - unsigned short m_usFireSG550; + unsigned short m_usFire; }; class CGalil: public CBasePlayerWeapon { @@ -884,10 +838,8 @@ public: virtual BOOL UseDecrement() = 0; public: int m_iShell; - int iShellOn; - unsigned short GetEventID() const { return m_usFireGalil; } -private: - unsigned short m_usFireGalil; + int m_iShellOn; + unsigned short m_usFire; }; class CFamas: public CBasePlayerWeapon { @@ -905,5 +857,5 @@ public: virtual BOOL UseDecrement() = 0; public: int m_iShell; - int iShellOn; + int m_iShellOn; }; diff --git a/reapi/src/hook_callback.cpp b/reapi/src/hook_callback.cpp index d1cfef2..ed364f7 100644 --- a/reapi/src/hook_callback.cpp +++ b/reapi/src/hook_callback.cpp @@ -188,9 +188,9 @@ BOOL CBasePlayer_RemovePlayerItem(IReGameHook_CBasePlayer_RemovePlayerItem *chai return callForward(RG_CBasePlayer_RemovePlayerItem, original, indexOfEdict(pthis->pev), indexOfEdict(pItem->pev)); } -int CBasePlayer_GiveAmmo(IReGameHook_CBasePlayer_GiveAmmo *chain, CBasePlayer *pthis, int iAmount, char *szName, int iMax) +int CBasePlayer_GiveAmmo(IReGameHook_CBasePlayer_GiveAmmo *chain, CBasePlayer *pthis, int iAmount, const char *szName, int iMax) { - auto original = [chain](int _pthis, int _iAmount, char *_szName, int _iMax) + auto original = [chain](int _pthis, int _iAmount, const char *_szName, int _iMax) { return chain->callNext(getPrivate(_pthis), _iAmount, _szName, _iMax); }; @@ -470,6 +470,16 @@ bool CBasePlayer_GetIntoGame(IReGameHook_CBasePlayer_GetIntoGame *chain, CBasePl return callForward(RG_CBasePlayer_GetIntoGame, original, indexOfEdict(pthis->pev)); } +void CBasePlayer_StartDeathCam(IReGameHook_CBasePlayer_StartDeathCam *chain, CBasePlayer *pthis) +{ + auto original = [chain](int _pthis) + { + return chain->callNext(getPrivate(_pthis)); + }; + + callVoidForward(RG_CBasePlayer_StartDeathCam, original, indexOfEdict(pthis->pev)); +} + void CBaseAnimating_ResetSequenceInfo(IReGameHook_CBaseAnimating_ResetSequenceInfo *chain, CBaseAnimating *pthis) { auto original = [chain](int _pthis) diff --git a/reapi/src/hook_callback.h b/reapi/src/hook_callback.h index 61bbbe7..4cec8e7 100644 --- a/reapi/src/hook_callback.h +++ b/reapi/src/hook_callback.h @@ -339,7 +339,7 @@ void CBasePlayer_AddPoints(IReGameHook_CBasePlayer_AddPoints *chain, CBasePlayer void CBasePlayer_AddPointsToTeam(IReGameHook_CBasePlayer_AddPointsToTeam *chain, CBasePlayer *pthis, int score, BOOL bAllowNegativeScore); BOOL CBasePlayer_AddPlayerItem(IReGameHook_CBasePlayer_AddPlayerItem *chain, CBasePlayer *pthis, CBasePlayerItem *pItem); BOOL CBasePlayer_RemovePlayerItem(IReGameHook_CBasePlayer_RemovePlayerItem *chain, CBasePlayer *pthis, CBasePlayerItem *pItem); -int CBasePlayer_GiveAmmo(IReGameHook_CBasePlayer_GiveAmmo *chain, CBasePlayer *pthis, int iAmount, char *szName, int iMax); +int CBasePlayer_GiveAmmo(IReGameHook_CBasePlayer_GiveAmmo *chain, CBasePlayer *pthis, int iAmount, const char *szName, int iMax); void CBasePlayer_ResetMaxSpeed(IReGameHook_CBasePlayer_ResetMaxSpeed *chain, CBasePlayer *pthis); void CBasePlayer_Jump(IReGameHook_CBasePlayer_Jump *chain, CBasePlayer *pthis); void CBasePlayer_Duck(IReGameHook_CBasePlayer_Duck *chain, CBasePlayer *pthis); @@ -368,6 +368,7 @@ void CBasePlayer_MakeVIP(IReGameHook_CBasePlayer_MakeVIP *chain, CBasePlayer *pt bool CBasePlayer_MakeBomber(IReGameHook_CBasePlayer_MakeBomber *chain, CBasePlayer *pthis); void CBasePlayer_StartObserver(IReGameHook_CBasePlayer_StartObserver *chain, CBasePlayer *pthis, Vector &vecPosition, Vector &vecViewAngle); bool CBasePlayer_GetIntoGame(IReGameHook_CBasePlayer_GetIntoGame *chain, CBasePlayer *pthis); +void CBasePlayer_StartDeathCam(IReGameHook_CBasePlayer_StartDeathCam *chain, CBasePlayer *pthis); void CBaseAnimating_ResetSequenceInfo(IReGameHook_CBaseAnimating_ResetSequenceInfo *chain, CBaseAnimating *pthis); diff --git a/reapi/src/hook_list.cpp b/reapi/src/hook_list.cpp index 655e31d..b210a62 100644 --- a/reapi/src/hook_list.cpp +++ b/reapi/src/hook_list.cpp @@ -1,25 +1,25 @@ #include "precompiled.h" -inline size_t getFwdParamType(void(*)(int)) { return FP_CELL; } -inline size_t getFwdParamType(void(*)(size_t)) { return FP_CELL; } -inline size_t getFwdParamType(void(*)(short)) { return FP_CELL; } -inline size_t getFwdParamType(void(*)(bool)) { return FP_CELL; } -inline size_t getFwdParamType(void(*)(Vector&)) { return FP_ARRAY; } -inline size_t getFwdParamType(void(*)(PLAYER_ANIM)) { return FP_CELL; } -inline size_t getFwdParamType(void(*)(WeaponIdType)) { return FP_CELL; } -inline size_t getFwdParamType(void(*)(RewardType)) { return FP_CELL; } -inline size_t getFwdParamType(void(*)(ScenarioEventEndRound)) { return FP_CELL; } -inline size_t getFwdParamType(void(*)(ItemID)) { return FP_CELL; } -inline size_t getFwdParamType(void(*)(ItemRestType)) { return FP_CELL; } -inline size_t getFwdParamType(void(*)(ResourceType_e)) { 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; } -inline size_t getFwdParamType(void(*)(IResourceBuffer*)) { return FP_CELL; } +inline size_t getFwdParamType(void(*)(int)) { return FP_CELL; } +inline size_t getFwdParamType(void(*)(size_t)) { return FP_CELL; } +inline size_t getFwdParamType(void(*)(short)) { return FP_CELL; } +inline size_t getFwdParamType(void(*)(bool)) { return FP_CELL; } +inline size_t getFwdParamType(void(*)(Vector&)) { return FP_ARRAY; } +inline size_t getFwdParamType(void(*)(PLAYER_ANIM)) { return FP_CELL; } +inline size_t getFwdParamType(void(*)(WeaponIdType)) { return FP_CELL; } +inline size_t getFwdParamType(void(*)(RewardType)) { return FP_CELL; } +inline size_t getFwdParamType(void(*)(ScenarioEventEndRound)) { return FP_CELL; } +inline size_t getFwdParamType(void(*)(ItemID)) { return FP_CELL; } +inline size_t getFwdParamType(void(*)(ItemRestType)) { return FP_CELL; } +inline size_t getFwdParamType(void(*)(ResourceType_e)) { 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; } +inline size_t getFwdParamType(void(*)(IResourceBuffer*)) { return FP_CELL; } template -inline size_t getFwdParamType(void(*)(T *)) { return FP_CELL; } +inline size_t getFwdParamType(void(*)(T *)) { return FP_CELL; } template void setupParamTypes(size_t param_types[], void (*)()) @@ -140,6 +140,7 @@ hook_t hooklist_player[] = { DLL(CBasePlayer_MakeBomber), DLL(CBasePlayer_StartObserver), DLL(CBasePlayer_GetIntoGame), + DLL(CBasePlayer_StartDeathCam), }; hook_t hooklist_gamerules[] = { diff --git a/reapi/src/hook_list.h b/reapi/src/hook_list.h index ca4fbed..428d716 100644 --- a/reapi/src/hook_list.h +++ b/reapi/src/hook_list.h @@ -157,6 +157,7 @@ enum GamedllFunc_CBasePlayer RG_CBasePlayer_MakeBomber, RG_CBasePlayer_StartObserver, RG_CBasePlayer_GetIntoGame, + RG_CBasePlayer_StartDeathCam, // [...] }; diff --git a/reapi/src/member_list.cpp b/reapi/src/member_list.cpp index 2d1ca86..dec21ee 100644 --- a/reapi/src/member_list.cpp +++ b/reapi/src/member_list.cpp @@ -14,73 +14,108 @@ #define CLASS_MEMBERS(cx, mx, postf, pref) ((!(postf & (MAX_REGION_RANGE - 1)) ? regmember::current_cell = 1, true : false) || (postf & (MAX_REGION_RANGE - 1)) == regmember::current_cell++) ? regmember([](member_t* ptr){ decltypefx(cx, pref, ., mx) f = {};ptr->size = getTypeSize(f);ptr->max_size = sizeof(f);ptr->offset = offsetof(##cx, ##pref##mx);ptr->type = getMemberType(f);ptr->name = #postf;}) : regmember(#pref#mx) -#define GM_MEMBERS(mx) CLASS_MEMBERS(CHalfLifeMultiplay, mx, mx,) -#define GM_VOICE_MEMBERS(mx) CLASS_MEMBERS(CHalfLifeMultiplay, mx, mx, m_VoiceGameMgr.) -#define BASE_MEMBERS(mx) CLASS_MEMBERS(CBaseEntity, mx, mx,) -#define ANIM_MEMBERS(mx) CLASS_MEMBERS(CBaseAnimating, mx, mx,) -#define MONST_MEMBERS(mx) CLASS_MEMBERS(CBaseMonster, mx, mx,) -#define PL_MEMBERS(mx) CLASS_MEMBERS(CBasePlayer, mx, mx,) -#define EVAR_MEMBERS(mx) CLASS_MEMBERS(com_entvars, mx, var_##mx,) -#define PMOVE_MEMBERS(mx) CLASS_MEMBERS(com_playermove, mx, pm_##mx,) -#define MOVEVAR_MEMBERS(mx) CLASS_MEMBERS(movevars_t, mx, mv_##mx,) -#define UCMD_MEMBERS(mx) CLASS_MEMBERS(usercmd_s, mx, ucmd_##mx,) -#define PMTRACE_MEMBERS(mx) CLASS_MEMBERS(pmtrace_s, mx, pmt_##mx,) -#define CSPL_MEMBERS(mx) CLASS_MEMBERS(CCSPlayer, mx, mx,) -#define BASEITEM_MEMBERS(mx) CLASS_MEMBERS(CBasePlayerItem, mx, mx,) -#define BASEWPN_MEMBERS(mx) CLASS_MEMBERS(CBasePlayerWeapon, mx, m_Weapon_##mx, m_) -#define WPNBOX_MEMBERS(mx) CLASS_MEMBERS(CWeaponBox, mx, m_WeaponBox_##mx, m_) -#define ARMOURY_MEMBERS(mx) CLASS_MEMBERS(CArmoury, mx, m_Armoury_##mx, m_) +#define GM_MEMBERS(mx) CLASS_MEMBERS(CHalfLifeMultiplay, mx, mx,) +#define GM_VOICE_MEMBERS(mx) CLASS_MEMBERS(CHalfLifeMultiplay, mx, mx, m_VoiceGameMgr.) +#define BASE_MEMBERS(mx) CLASS_MEMBERS(CBaseEntity, mx, mx,) +#define ANIM_MEMBERS(mx) CLASS_MEMBERS(CBaseAnimating, mx, mx,) +#define MONST_MEMBERS(mx) CLASS_MEMBERS(CBaseMonster, mx, mx,) +#define PL_MEMBERS(mx) CLASS_MEMBERS(CBasePlayer, mx, mx,) +#define EVAR_MEMBERS(mx) CLASS_MEMBERS(com_entvars, mx, var_##mx,) +#define PMOVE_MEMBERS(mx) CLASS_MEMBERS(com_playermove, mx, pm_##mx,) +#define MOVEVAR_MEMBERS(mx) CLASS_MEMBERS(movevars_t, mx, mv_##mx,) +#define UCMD_MEMBERS(mx) CLASS_MEMBERS(usercmd_s, mx, ucmd_##mx,) +#define PMTRACE_MEMBERS(mx) CLASS_MEMBERS(pmtrace_s, mx, pmt_##mx,) +#define CSPL_MEMBERS(mx) CLASS_MEMBERS(CCSPlayer, mx, mx,) +#define BASEITEM_MEMBERS(mx) CLASS_MEMBERS(CBasePlayerItem, mx, mx,) +#define BASEWPN_MEMBERS(mx) CLASS_MEMBERS(CBasePlayerWeapon, mx, m_Weapon_##mx, m_) +#define WPNBOX_MEMBERS(mx) CLASS_MEMBERS(CWeaponBox, mx, m_WeaponBox_##mx, m_) +#define ARMOURY_MEMBERS(mx) CLASS_MEMBERS(CArmoury, mx, m_Armoury_##mx, m_) +#define GRENADE_MEMBERS(mx) CLASS_MEMBERS(CGrenade, mx, m_Grenade_##mx, m_) +#define P228_MEMBERS(mx) CLASS_MEMBERS(CP228, mx, m_P228_##mx, m_) +#define SCOUT_MEMBERS(mx) CLASS_MEMBERS(CSCOUT, mx, m_SCOUT_##mx, m_) +#define HEGREN_MEMBERS(mx) CLASS_MEMBERS(CHEGrenade, mx, m_HEGrenade_##mx, m_) +#define XM1014_MEMBERS(mx) CLASS_MEMBERS(CXM1014, mx, m_XM1014_##mx, m_) +#define C4_MEMBERS(mx) CLASS_MEMBERS(CC4, mx, m_C4_##mx, m_) +#define MAC10_MEMBERS(mx) CLASS_MEMBERS(CMAC10, mx, m_MAC10_##mx, m_) +#define AUG_MEMBERS(mx) CLASS_MEMBERS(CAUG, mx, m_AUG_##mx, m_) +#define SMOKEGREN_MEMBERS(mx) CLASS_MEMBERS(CSmokeGrenade, mx, m_SmokeGrenade_##mx, m_) +#define ELITE_MEMBERS(mx) CLASS_MEMBERS(CELITE, mx, m_ELITE_##mx, m_) +#define FIVESEVEN_MEMBERS(mx) CLASS_MEMBERS(CFiveSeven, mx, m_FiveSeven_##mx, m_) +#define UMP45_MEMBERS(mx) CLASS_MEMBERS(CUMP45, mx, m_UMP45_##mx, m_) +#define SG550_MEMBERS(mx) CLASS_MEMBERS(CSG550, mx, m_SG550_##mx, m_) +#define GALIL_MEMBERS(mx) CLASS_MEMBERS(CGalil, mx, m_Galil_##mx, m_) +#define FAMAS_MEMBERS(mx) CLASS_MEMBERS(CFamas, mx, m_Famas_##mx, m_) +#define USP_MEMBERS(mx) CLASS_MEMBERS(CUSP, mx, m_USP_##mx, m_) +#define GLOCK18_MEMBERS(mx) CLASS_MEMBERS(CGLOCK18, mx, m_GLOCK18_##mx, m_) +#define AWP_MEMBERS(mx) CLASS_MEMBERS(CAWP, mx, m_AWP_##mx, m_) +#define MP5N_MEMBERS(mx) CLASS_MEMBERS(CMP5N, mx, m_MP5N_##mx, m_) +#define M249_MEMBERS(mx) CLASS_MEMBERS(CM249, mx, m_M249_##mx, m_) +#define M3_MEMBERS(mx) CLASS_MEMBERS(CM3, mx, m_M3_##mx, m_) +#define M4A1_MEMBERS(mx) CLASS_MEMBERS(CM4A1, mx, m_M4A1_##mx, m_) +#define TMP_MEMBERS(mx) CLASS_MEMBERS(CTMP, mx, m_TMP_##mx, m_) +#define G3SG1_MEMBERS(mx) CLASS_MEMBERS(CG3SG1, mx, m_G3SG1_##mx, m_) +#define DEAGLE_MEMBERS(mx) CLASS_MEMBERS(CDEAGLE, mx, m_DEAGLE_##mx, m_) +#define SG552_MEMBERS(mx) CLASS_MEMBERS(CSG552, mx, m_SG552_##mx, m_) +#define AK47_MEMBERS(mx) CLASS_MEMBERS(CAK47, mx, m_AK47_##mx, m_) +#define KNIFE_MEMBERS(mx) CLASS_MEMBERS(CKnife, mx, m_Knife_##mx, m_) +#define P90_MEMBERS(mx) CLASS_MEMBERS(CP90, mx, m_P90_##mx, m_) +#define SHIELD_MEMBERS(mx) CLASS_MEMBERS(CWShield, mx, m_Shield_##mx, m_) +#define REBUYSTRUCT_MEMBERS(mx) CLASS_MEMBERS(RebuyStruct, mx, mx,) +#define MAPINFO_MEMBERS(mx) CLASS_MEMBERS(CMapInfo, mx, m_MapInfo_##mx, m_) -inline MType getMemberType(float*) { return MEMBER_FLOAT; } -inline MType getMemberType(float) { return MEMBER_FLOAT; } +inline MType getMemberType(float*) { return MEMBER_FLOAT; } +inline MType getMemberType(float) { return MEMBER_FLOAT; } -inline MType getMemberType(double) { return MEMBER_DOUBLE; } +inline MType getMemberType(double) { return MEMBER_DOUBLE; } -inline MType getMemberType(CBasePlayer**) { return MEMBER_CLASSPTR; } -inline MType getMemberType(CBasePlayer*) { return MEMBER_CLASSPTR; } -inline MType getMemberType(CBasePlayerItem**) { return MEMBER_CLASSPTR; } -inline MType getMemberType(CBasePlayerItem*) { return MEMBER_CLASSPTR; } -inline MType getMemberType(CBaseEntity*) { return MEMBER_CLASSPTR; } +inline MType getMemberType(CBasePlayer**) { return MEMBER_CLASSPTR; } +inline MType getMemberType(CBasePlayer*) { return MEMBER_CLASSPTR; } +inline MType getMemberType(CBasePlayerItem**) { return MEMBER_CLASSPTR; } +inline MType getMemberType(CBasePlayerItem*) { return MEMBER_CLASSPTR; } +inline MType getMemberType(CBaseEntity*) { return MEMBER_CLASSPTR; } -inline MType getMemberType(EHANDLE) { return MEMBER_EHANDLE; } -inline MType getMemberType(entvars_t*) { return MEMBER_EVARS; } -inline MType getMemberType(edict_t*) { return MEMBER_EDICT; } +inline MType getMemberType(EHANDLE) { return MEMBER_EHANDLE; } +inline MType getMemberType(entvars_t*) { return MEMBER_EVARS; } +inline MType getMemberType(edict_t*) { return MEMBER_EDICT; } -inline MType getMemberType(Vector*) { return MEMBER_VECTOR; } -inline MType getMemberType(Vector) { return MEMBER_VECTOR; } +inline MType getMemberType(Vector*) { return MEMBER_VECTOR; } +inline MType getMemberType(Vector) { return MEMBER_VECTOR; } -inline MType getMemberType(char*) { return MEMBER_STRING; } -inline MType getMemberType(string_t) { return MEMBER_QSTRING; } -inline MType getMemberType(string_t*) { return MEMBER_QSTRING; } -inline MType getMemberType(qstring_t) { return MEMBER_QSTRING; } -inline MType getMemberType(qstring_t*) { return MEMBER_QSTRING; } +inline MType getMemberType(char*) { return MEMBER_STRING; } +inline MType getMemberType(string_t) { return MEMBER_QSTRING; } +inline MType getMemberType(string_t*) { return MEMBER_QSTRING; } +inline MType getMemberType(qstring_t) { return MEMBER_QSTRING; } +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(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; } -inline MType getMemberType(unsigned) { return MEMBER_INTEGER; } -inline MType getMemberType(TeamName) { return MEMBER_INTEGER; } -inline MType getMemberType(JoinState) { return MEMBER_INTEGER; } -inline MType getMemberType(ModelName) { return MEMBER_INTEGER; } -inline MType getMemberType(_Menu) { return MEMBER_INTEGER; } -inline MType getMemberType(MusicState) { return MEMBER_INTEGER; } -inline MType getMemberType(Activity) { return MEMBER_INTEGER; } -inline MType getMemberType(MONSTERSTATE) { return MEMBER_INTEGER; } -inline MType getMemberType(ArmorType) { return MEMBER_INTEGER; } -inline MType getMemberType(ArmouryItemPack) { return MEMBER_INTEGER; } +inline MType getMemberType(int*) { return MEMBER_INTEGER; } +inline MType getMemberType(int) { return MEMBER_INTEGER; } +inline MType getMemberType(unsigned) { return MEMBER_INTEGER; } +inline MType getMemberType(TeamName) { return MEMBER_INTEGER; } +inline MType getMemberType(JoinState) { return MEMBER_INTEGER; } +inline MType getMemberType(ModelName) { return MEMBER_INTEGER; } +inline MType getMemberType(_Menu) { return MEMBER_INTEGER; } +inline MType getMemberType(MusicState) { return MEMBER_INTEGER; } +inline MType getMemberType(Activity) { return MEMBER_INTEGER; } +inline MType getMemberType(MONSTERSTATE) { return MEMBER_INTEGER; } +inline MType getMemberType(ArmorType) { return MEMBER_INTEGER; } +inline MType getMemberType(ArmouryItemPack) { return MEMBER_INTEGER; } +inline MType getMemberType(InfoMapBuyParam) { return MEMBER_INTEGER; } -inline MType getMemberType(short) { return MEMBER_SHORT; } -inline MType getMemberType(unsigned short) { return MEMBER_SHORT; } +inline MType getMemberType(TraceResult) { return MEMBER_TRACERESULT; } -inline MType getMemberType(bool) { return MEMBER_BOOL; } -inline MType getMemberType(CUnifiedSignals) { return MEMBER_SIGNALS; } -inline MType getMemberType(RebuyStruct) { return MEBMER_REBUYSTRUCT; } +inline MType getMemberType(short) { return MEMBER_SHORT; } +inline MType getMemberType(unsigned short) { return MEMBER_SHORT; } -inline MType getMemberType(pmtrace_t) { return MEMBER_PMTRACE; } -inline MType getMemberType(usercmd_s) { return MEBMER_USERCMD; } +inline MType getMemberType(bool) { return MEMBER_BOOL; } +inline MType getMemberType(CUnifiedSignals) { return MEMBER_SIGNALS; } +inline MType getMemberType(RebuyStruct) { return MEBMER_REBUYSTRUCT; } + +inline MType getMemberType(pmtrace_t) { return MEMBER_PMTRACE; } +inline MType getMemberType(usercmd_s) { return MEBMER_USERCMD; } template inline MType getMemberType(T) { static_assert(false, "Not implemented overload"); } @@ -748,6 +783,210 @@ member_t memberlist_armoury[] = { ARMOURY_MEMBERS(bAlreadyCounted), }; +member_t memberlist_grenade[] = { + GRENADE_MEMBERS(bStartDefuse), + GRENADE_MEMBERS(bIsC4), + GRENADE_MEMBERS(pBombDefuser), + GRENADE_MEMBERS(flDefuseCountDown), + GRENADE_MEMBERS(flC4Blow), + GRENADE_MEMBERS(flNextFreqInterval), + GRENADE_MEMBERS(flNextBeep), + GRENADE_MEMBERS(flNextFreq), + GRENADE_MEMBERS(sBeepName), + GRENADE_MEMBERS(fAttenu), + GRENADE_MEMBERS(flNextBlink), + GRENADE_MEMBERS(fNextDefuse), + GRENADE_MEMBERS(bJustBlew), + GRENADE_MEMBERS(iTeam), + GRENADE_MEMBERS(iCurWave), + GRENADE_MEMBERS(pentCurBombTarget), + GRENADE_MEMBERS(SGSmoke), + GRENADE_MEMBERS(angle), + GRENADE_MEMBERS(usEvent), + GRENADE_MEMBERS(bLightSmoke), + GRENADE_MEMBERS(bDetonated), + GRENADE_MEMBERS(vSmokeDetonate), + GRENADE_MEMBERS(iBounceCount), + GRENADE_MEMBERS(fRegisteredSound), +}; + +member_t memberlist_p228[] = { + P228_MEMBERS(iShell), + P228_MEMBERS(usFire), +}; + +member_t memberlist_scout[] = { + SCOUT_MEMBERS(iShell), + SCOUT_MEMBERS(usFire), +}; + +member_t memberlist_hegrenade[] = { + HEGREN_MEMBERS(usCreate), +}; + +member_t memberlist_xm1014[] = { + XM1014_MEMBERS(iShell), + XM1014_MEMBERS(flPumpTime), + XM1014_MEMBERS(usFire), +}; + +member_t memberlist_c4[] = { + C4_MEMBERS(bStartedArming), + C4_MEMBERS(bBombPlacedAnimation), + C4_MEMBERS(fArmedTime), + C4_MEMBERS(bHasShield), +}; + +member_t memberlist_mac10[] = { + MAC10_MEMBERS(iShell), + MAC10_MEMBERS(iShellOn), + MAC10_MEMBERS(usFire), +}; + +member_t memberlist_aug[] = { + AUG_MEMBERS(iShell), + AUG_MEMBERS(iShellOn), + AUG_MEMBERS(usFire), +}; + +member_t memberlist_smokegrenade[] = { + SMOKEGREN_MEMBERS(usCreate), +}; + +member_t memberlist_elite[] = { + ELITE_MEMBERS(iShell), + ELITE_MEMBERS(usFire_LEFT), + ELITE_MEMBERS(usFire_RIGHT), +}; + +member_t memberlist_fiveseven[] = { + FIVESEVEN_MEMBERS(iShell), + FIVESEVEN_MEMBERS(usFire), +}; + +member_t memberlist_ump45[] = { + UMP45_MEMBERS(iShell), + UMP45_MEMBERS(iShellOn), + UMP45_MEMBERS(usFire), +}; + +member_t memberlist_sg550[] = { + SG550_MEMBERS(iShell), + SG550_MEMBERS(usFire), +}; + +member_t memberlist_galil[] = { + GALIL_MEMBERS(iShell), + GALIL_MEMBERS(iShellOn), + GALIL_MEMBERS(usFire), +}; + +member_t memberlist_famas[] = { + FAMAS_MEMBERS(iShell), + FAMAS_MEMBERS(iShellOn), +}; + +member_t memberlist_usp[] = { + USP_MEMBERS(iShell), + USP_MEMBERS(usFire), +}; + +member_t memberlist_glock18[] = { + GLOCK18_MEMBERS(iShell), + GLOCK18_MEMBERS(bBurstFire), +}; + +member_t memberlist_awp[] = { + AWP_MEMBERS(iShell), + AWP_MEMBERS(usFire), +}; + +member_t memberlist_mp5n[] = { + MP5N_MEMBERS(iShell), + MP5N_MEMBERS(iShellOn), + MP5N_MEMBERS(usFire), +}; + +member_t memberlist_m249[] = { + M249_MEMBERS(iShell), + M249_MEMBERS(iShellOn), + M249_MEMBERS(usFire), +}; + +member_t memberlist_m3[] = { + M3_MEMBERS(iShell), + M3_MEMBERS(flPumpTime), + M3_MEMBERS(usFire), +}; + +member_t memberlist_m4a1[] = { + M4A1_MEMBERS(iShell), + M4A1_MEMBERS(iShellOn), + M4A1_MEMBERS(usFire), +}; + +member_t memberlist_tmp[] = { + TMP_MEMBERS(iShell), + TMP_MEMBERS(iShellOn), + TMP_MEMBERS(usFire), +}; + +member_t memberlist_g3sg1[] = { + G3SG1_MEMBERS(iShell), + G3SG1_MEMBERS(usFire), +}; + +member_t memberlist_deagle[] = { + DEAGLE_MEMBERS(iShell), + DEAGLE_MEMBERS(usFire), +}; + +member_t memberlist_sg552[] = { + SG552_MEMBERS(iShell), + SG552_MEMBERS(iShellOn), + SG552_MEMBERS(usFire), +}; + +member_t memberlist_ak47[] = { + AK47_MEMBERS(iShell), + AK47_MEMBERS(iShellOn), + AK47_MEMBERS(usFire), +}; + +member_t memberlist_knife[] = { + KNIFE_MEMBERS(trHit), + KNIFE_MEMBERS(usKnife), +}; + +member_t memberlist_p90[] = { + P90_MEMBERS(iShell), + P90_MEMBERS(iShellOn), + P90_MEMBERS(usFire), +}; + +member_t memberlist_shield[] = { + SHIELD_MEMBERS(hEntToIgnoreTouchesFrom), + SHIELD_MEMBERS(flTimeToIgnoreTouches), +}; + +member_t memberlist_rebuystruct[] = { + REBUYSTRUCT_MEMBERS(m_primaryWeapon), + REBUYSTRUCT_MEMBERS(m_primaryAmmo), + REBUYSTRUCT_MEMBERS(m_secondaryWeapon), + REBUYSTRUCT_MEMBERS(m_secondaryAmmo), + REBUYSTRUCT_MEMBERS(m_heGrenade), + REBUYSTRUCT_MEMBERS(m_flashbang), + REBUYSTRUCT_MEMBERS(m_smokeGrenade), + REBUYSTRUCT_MEMBERS(m_defuser), + REBUYSTRUCT_MEMBERS(m_nightVision), + REBUYSTRUCT_MEMBERS(m_armor), +}; + +member_t memberlist_mapinfo[] = { + MAPINFO_MEMBERS(iBuyingStatus), + MAPINFO_MEMBERS(flBombRadius), +}; + memberlist_t memberlist; member_t *memberlist_t::operator[](size_t members) const @@ -773,6 +1012,38 @@ member_t *memberlist_t::operator[](size_t members) const CASE(baseweapon) CASE(weaponbox) CASE(armoury) + CASE(grenade) + CASE(p228) + CASE(scout) + CASE(hegrenade) + CASE(xm1014) + CASE(c4) + CASE(mac10) + CASE(aug) + CASE(smokegrenade) + CASE(elite) + CASE(fiveseven) + CASE(ump45) + CASE(sg550) + CASE(galil) + CASE(famas) + CASE(usp) + CASE(glock18) + CASE(awp) + CASE(mp5n) + CASE(m249) + CASE(m3) + CASE(m4a1) + CASE(tmp) + CASE(g3sg1) + CASE(deagle) + CASE(sg552) + CASE(ak47) + CASE(knife) + CASE(p90) + CASE(shield) + CASE(rebuystruct) + CASE(mapinfo) } return nullptr; diff --git a/reapi/src/member_list.h b/reapi/src/member_list.h index 942bb1a..190aac8 100644 --- a/reapi/src/member_list.h +++ b/reapi/src/member_list.h @@ -24,6 +24,7 @@ enum MType MEBMER_REBUYSTRUCT, // struct RebuyStruct MEMBER_PMTRACE, // struct pmtrace_t MEBMER_USERCMD, // struct usercmd_s + MEMBER_TRACERESULT, // struct TraceResult }; struct memberlist_t @@ -46,7 +47,39 @@ struct memberlist_t mt_baseitem, mt_baseweapon, mt_weaponbox, - mt_armoury + mt_armoury, + mt_grenade, + mt_p228, + mt_scout, + mt_hegrenade, + mt_xm1014, + mt_c4, + mt_mac10, + mt_aug, + mt_smokegrenade, + mt_elite, + mt_fiveseven, + mt_ump45, + mt_sg550, + mt_galil, + mt_famas, + mt_usp, + mt_glock18, + mt_awp, + mt_mp5n, + mt_m249, + mt_m3, + mt_m4a1, + mt_tmp, + mt_g3sg1, + mt_deagle, + mt_sg552, + mt_ak47, + mt_knife, + mt_p90, + mt_shield, + mt_rebuystruct, + mt_mapinfo, }; }; @@ -108,21 +141,21 @@ enum CSGameRules_Members m_nMaxPlayers, m_UpdateInterval, - m_flRestartRoundTime, // The global time when the round is supposed to end, if this is not 0 (deprecated name m_fTeamCount) + m_flRestartRoundTime, // The global time when the round is supposed to end, if this is not 0 (deprecated name m_fTeamCount) m_flCheckWinConditions, m_fRoundStartTime, // Time round has started (deprecated name m_fRoundCount) m_iRoundTime, // (From mp_roundtime) - How many seconds long this round is. m_iRoundTimeSecs, m_iIntroRoundTime, // (From mp_freezetime) - How many seconds long the intro round (when players are frozen) is. - m_fRoundStartTimeReal, // The global time when the intro round ends and the real one starts - // wrote the original "m_flRoundTime" comment for this variable). + m_fRoundStartTimeReal, // The global time when the intro round ends and the real one starts + // wrote the original "m_flRoundTime" comment for this variable). m_iAccountTerrorist, m_iAccountCT, m_iNumTerrorist, // The number of terrorists on the team (this is generated at the end of a round) - m_iNumCT, // The number of CTs on the team (this is generated at the end of a round) + m_iNumCT, // The number of CTs on the team (this is generated at the end of a round) m_iNumSpawnableTerrorist, m_iNumSpawnableCT, - m_iSpawnPointCount_Terrorist, // Number of Terrorist spawn points + m_iSpawnPointCount_Terrorist, // Number of Terrorist spawn points m_iSpawnPointCount_CT, // Number of CT spawn points m_iHostagesRescued, m_iHostagesTouched, @@ -139,11 +172,11 @@ enum CSGameRules_Members m_bMapHasVIPSafetyZone, // 0 = uninitialized, 1 = has VIP safety zone, 2 = DOES not have VIP safetyzone m_bMapHasCameras, m_iC4Timer, - m_iC4Guy, // The current Terrorist who has the C4. - m_iLoserBonus, // the amount of money the losing team gets. This scales up as they lose more rounds in a row - m_iNumConsecutiveCTLoses, // the number of rounds the CTs have lost in a row. + m_iC4Guy, // The current Terrorist who has the C4. + m_iLoserBonus, // the amount of money the losing team gets. This scales up as they lose more rounds in a row + m_iNumConsecutiveCTLoses, // the number of rounds the CTs have lost in a row. m_iNumConsecutiveTerroristLoses, // the number of rounds the Terrorists have lost in a row. - m_fMaxIdlePeriod, // For the idle kick functionality. This is tha max amount of time that the player has to be idle before being kicked + m_fMaxIdlePeriod, // For the idle kick functionality. This is tha max amount of time that the player has to be idle before being kicked m_iLimitTeams, m_bLevelInitialized, m_bRoundTerminating, @@ -158,7 +191,7 @@ enum CSGameRules_Members m_iTotalGunCount, m_iTotalGrenadeCount, m_iTotalArmourCount, - m_iUnBalancedRounds, // keeps track of the # of consecutive rounds that have gone by where one team outnumbers the other team by more than 2 + m_iUnBalancedRounds, // keeps track of the # of consecutive rounds that have gone by where one team outnumbers the other team by more than 2 m_iNumEscapeRounds, // keeps track of the # of consecutive rounds of escape played.. Teams will be swapped after 8 rounds m_iMapVotes, m_iLastPick, @@ -629,9 +662,9 @@ enum PlayerMove pm_numphysent, /* physent_t physents[MAX_PHYSENTS]; - pm_nummoveent; // Number of momvement entities (ladders) + pm_nummoveent; // Number of momvement entities (ladders) physent_t moveents[MAX_MOVEENTS]; // just a list of ladders - pm_numvisent; // All things being rendered, for tracing against things you don't actually collide with + pm_numvisent; // All things being rendered, for tracing against things you don't actually collide with physent_t visents[MAX_PHYSENTS];*/ pm_cmd, @@ -771,3 +804,239 @@ enum CArmoury_Members m_Armoury_iInitialCount, m_Armoury_bAlreadyCounted, }; + +enum CGrenade_Members +{ + m_Grenade_bStartDefuse = BEGIN_MEMBER_REGION(grenade), + m_Grenade_bIsC4, + m_Grenade_pBombDefuser, + m_Grenade_flDefuseCountDown, + m_Grenade_flC4Blow, + m_Grenade_flNextFreqInterval, + m_Grenade_flNextBeep, + m_Grenade_flNextFreq, + m_Grenade_sBeepName, + m_Grenade_fAttenu, + m_Grenade_flNextBlink, + m_Grenade_fNextDefuse, + m_Grenade_bJustBlew, + m_Grenade_iTeam, + m_Grenade_iCurWave, + m_Grenade_pentCurBombTarget, + m_Grenade_SGSmoke, + m_Grenade_angle, + m_Grenade_usEvent, + m_Grenade_bLightSmoke, + m_Grenade_bDetonated, + m_Grenade_vSmokeDetonate, + m_Grenade_iBounceCount, + m_Grenade_fRegisteredSound, +}; + +enum CP228_Members +{ + m_P228_iShell = BEGIN_MEMBER_REGION(p228), + m_P228_usFire, +}; + +enum CSCOUT_Members +{ + m_SCOUT_iShell = BEGIN_MEMBER_REGION(scout), + m_SCOUT_usFire, +}; + +enum CHEGrenade_Members +{ + m_HEGrenade_usCreate = BEGIN_MEMBER_REGION(hegrenade), +}; + +enum CXM1014_Members +{ + m_XM1014_iShell = BEGIN_MEMBER_REGION(xm1014), + m_XM1014_flPumpTime, + m_XM1014_usFire, +}; + +enum CC4_Members +{ + m_C4_bStartedArming = BEGIN_MEMBER_REGION(c4), + m_C4_bBombPlacedAnimation, + m_C4_fArmedTime, + m_C4_bHasShield, +}; + +enum CMAC10_Members +{ + m_MAC10_iShell = BEGIN_MEMBER_REGION(mac10), + m_MAC10_iShellOn, + m_MAC10_usFire, +}; + +enum CAUG_Members +{ + m_AUG_iShell = BEGIN_MEMBER_REGION(aug), + m_AUG_iShellOn, + m_AUG_usFire, +}; + +enum CSmokeGrenade_Members +{ + m_SmokeGrenade_usCreate = BEGIN_MEMBER_REGION(smokegrenade), +}; + +enum CELITE_Members +{ + m_ELITE_iShell = BEGIN_MEMBER_REGION(elite), + m_ELITE_usFire_LEFT, + m_ELITE_usFire_RIGHT, +}; + +enum CFiveSeven_Members +{ + m_FiveSeven_iShell = BEGIN_MEMBER_REGION(fiveseven), + m_FiveSeven_usFire, +}; + +enum CUMP45_Members +{ + m_UMP45_iShell = BEGIN_MEMBER_REGION(ump45), + m_UMP45_iShellOn, + m_UMP45_usFire, +}; + +enum CSG550_Members +{ + m_SG550_iShell = BEGIN_MEMBER_REGION(sg550), + m_SG550_usFire, +}; + +enum CGalil_Members +{ + m_Galil_iShell = BEGIN_MEMBER_REGION(galil), + m_Galil_iShellOn, + m_Galil_usFire, +}; + +enum CFamas_Members +{ + m_Famas_iShell = BEGIN_MEMBER_REGION(famas), + m_Famas_iShellOn, +}; + +enum CUSP_Members +{ + m_USP_iShell = BEGIN_MEMBER_REGION(usp), + m_USP_usFire, +}; + +enum CGLOCK18_Members +{ + m_GLOCK18_iShell = BEGIN_MEMBER_REGION(glock18), + m_GLOCK18_bBurstFire, +}; + +enum CAWP_Members +{ + m_AWP_iShell = BEGIN_MEMBER_REGION(awp), + m_AWP_usFire, +}; + +enum CMP5N_Members +{ + m_MP5N_iShell = BEGIN_MEMBER_REGION(mp5n), + m_MP5N_iShellOn, + m_MP5N_usFire, +}; + +enum CM249_Members +{ + m_M249_iShell = BEGIN_MEMBER_REGION(m249), + m_M249_iShellOn, + m_M249_usFire, +}; + +enum CM3_Members +{ + m_M3_iShell = BEGIN_MEMBER_REGION(m3), + m_M3_flPumpTime, + m_M3_usFire, +}; + +enum CM4A1_Members +{ + m_M4A1_iShell = BEGIN_MEMBER_REGION(m4a1), + m_M4A1_iShellOn, + m_M4A1_usFire, +}; + +enum CTMP_Members +{ + m_TMP_iShell = BEGIN_MEMBER_REGION(tmp), + m_TMP_iShellOn, + m_TMP_usFire, +}; + +enum CG3SG1_Members +{ + m_G3SG1_iShell = BEGIN_MEMBER_REGION(g3sg1), + m_G3SG1_usFire, +}; + +enum CDEAGLE_Members +{ + m_DEAGLE_iShell = BEGIN_MEMBER_REGION(deagle), + m_DEAGLE_usFire, +}; + +enum CSG552_Members +{ + m_SG552_iShell = BEGIN_MEMBER_REGION(sg552), + m_SG552_iShellOn, + m_SG552_usFire, +}; + +enum CAK47_Members +{ + m_AK47_iShell = BEGIN_MEMBER_REGION(ak47), + m_AK47_iShellOn, + m_AK47_usFire, +}; + +enum CKnife_Members +{ + m_Knife_trHit = BEGIN_MEMBER_REGION(knife), + m_Knife_usKnife, +}; + +enum CP90_Members +{ + m_P90_iShell = BEGIN_MEMBER_REGION(p90), + m_P90_iShellOn, + m_P90_usFire, +}; + +enum CShield_Members +{ + m_Shield_hEntToIgnoreTouchesFrom = BEGIN_MEMBER_REGION(shield), + m_Shield_flTimeToIgnoreTouches, +}; + +enum RebuyStruct_Members +{ + m_primaryWeapon = BEGIN_MEMBER_REGION(rebuystruct), + m_primaryAmmo, + m_secondaryWeapon, + m_secondaryAmmo, + m_heGrenade, + m_flashbang, + m_smokeGrenade, + m_defuser, + m_nightVision, + m_armor, +}; + +enum MapInfo_Members +{ + m_MapInfo_iBuyingStatus = BEGIN_MEMBER_REGION(mapinfo), + m_MapInfo_flBombRadius, +}; diff --git a/reapi/src/natives/natives_common.cpp b/reapi/src/natives/natives_common.cpp index 8bb77cc..aa381b1 100644 --- a/reapi/src/natives/natives_common.cpp +++ b/reapi/src/natives/natives_common.cpp @@ -4,7 +4,7 @@ * Compares the entity to specified a classname. * @note This native also checks the validity of an entity. * -* @return true/false +* @return true/false * * native bool:FClassnameIs(const entityIndex, const className[]); */ @@ -196,7 +196,7 @@ AMX_NATIVE_INFO Natives_Common[] = /* * Check if the entity is valid * -* @return true/false +* @return true/false * * native bool:is_entity(const entityIndex); */ @@ -225,7 +225,7 @@ cell AMX_NATIVE_CALL is_entity(AMX *amx, cell *params) /* * Check if the rehlds is available * -* @return true/false +* @return true/false * * native bool:is_rehlds(); */ @@ -237,7 +237,7 @@ cell AMX_NATIVE_CALL is_rehlds(AMX *amx, cell *params) /* * Check if the regamedll is available * -* @return true/false +* @return true/false * * native bool:is_regamedll(); */ @@ -249,7 +249,7 @@ cell AMX_NATIVE_CALL is_regamedll(AMX *amx, cell *params) /* * Check if the reunion is available * -* @return true/false +* @return true/false * * native bool:has_reunion(); */ @@ -261,7 +261,7 @@ cell AMX_NATIVE_CALL has_reunion(AMX *amx, cell *params) /* * Check if the vtc is available * -* @return true/false +* @return true/false * * native bool:has_vtc(); */ @@ -273,7 +273,7 @@ cell AMX_NATIVE_CALL has_vtc(AMX *amx, cell *params) /* * Check if the rechecker is available * -* @return true/false +* @return true/false * * native bool:has_rechecker(); */ diff --git a/reapi/src/natives/natives_hookchains.cpp b/reapi/src/natives/natives_hookchains.cpp index e69f796..b6212eb 100644 --- a/reapi/src/natives/natives_hookchains.cpp +++ b/reapi/src/natives/natives_hookchains.cpp @@ -1,15 +1,16 @@ #include "precompiled.h" /* -* Hook API function that are available into enum -* Look at the enum's for parameter lists. +* Hook API function that are available into enum. +* Look at the enums for parameter lists. * -* @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. +* @param function The function to hook +* @param callback The forward to call +* @param post Whether or not to forward this in post * -* native RegisterHookChain(any:function_id, const callback[], post = 0); +* @return Returns a hook handle. Use EnableHookChain/DisableHookChain to toggle the forward on or off +* +* native HookChain:RegisterHookChain(any:function_id, const callback[], post = 0); */ cell AMX_NATIVE_CALL RegisterHookChain(AMX *amx, cell *params) { @@ -50,13 +51,14 @@ cell AMX_NATIVE_CALL RegisterHookChain(AMX *amx, cell *params) } /* -* Enable hook by handle. +* Starts a hook back up. * 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 +* @param hook The hook to re-enable * -* native bool:EnableHookChain(any:fwd); +* @return Returns true if the function is successfully executed, otherwise false +* +* native bool:EnableHookChain(HookChain:hook); */ cell AMX_NATIVE_CALL EnableHookChain(AMX *amx, cell *params) { @@ -75,12 +77,12 @@ cell AMX_NATIVE_CALL EnableHookChain(AMX *amx, cell *params) } /* -* Disable hook by handle. +* Stops a hook from triggering. * Use the return value from RegisterHookChain as the parameter here! * -* @param fwd The hook to stop. +* @param hook The hook to stop * -* native bool:DisableHookChain(any:fwd); +* native bool:DisableHookChain(HookChain:hook); */ cell AMX_NATIVE_CALL DisableHookChain(AMX *amx, cell *params) { @@ -101,8 +103,8 @@ cell AMX_NATIVE_CALL DisableHookChain(AMX *amx, cell *params) /* * Sets the return value of a hookchain. * -* @param type To specify the type ATYPE_*, look at the enum AType -* @param value The value to set the return to. +* @param type To specify the ATYPE_* parameter, look at the enum AType +* @param value The value to set the return to * * native SetHookChainReturn(AType:type, any:...); */ @@ -163,9 +165,10 @@ cell AMX_NATIVE_CALL SetHookChainReturn(AMX *amx, cell *params) * Gets the return value of the current hookchain. * This has no effect in pre hookchain. * -* @param type To specify the type ATYPE_*, look at the enum AType -* @param [maxlen] Max length of string (optional) -* @return If an integer or boolean or one byte or float, array or everything else is passed via 1rd argument and more +* @param type To specify the ATYPE_* parameter, look at the enum AType +* @param [maxlen] Max length of string (optional) +* +* @return If an integer or boolean or one byte or float, array or everything else is passed via 1st argument and more * * native any:GetHookChainReturn(AType:type, any:...); */ @@ -224,10 +227,11 @@ cell AMX_NATIVE_CALL GetHookChainReturn(AMX *amx, cell *params) * Set hookchain argument. * This has no effect in post hookchain. * -* @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 +* @param number Number of argument +* @param value New value +* @param [maxlen] Max length of string (optional) +* +* @return Returns true if the function is successfully executed, otherwise false * * native SetHookChainArg(number, AType:type, any:...); */ diff --git a/reapi/src/natives/natives_members.cpp b/reapi/src/natives/natives_members.cpp index 260ac7e..677dd97 100644 --- a/reapi/src/natives/natives_members.cpp +++ b/reapi/src/natives/natives_members.cpp @@ -1,6 +1,14 @@ #include "precompiled.h" -// native set_member(_index, any:_member, any:...); +/* +* Sets a value to an entity's member. +* +* @param index Entity index +* @param member The specified member, look at the enums with name *_Members +* +* @return 1 on success. +* native set_member(const index, any:member, any:...); +*/ cell AMX_NATIVE_CALL set_member(AMX *amx, cell *params) { enum args_e { arg_count, arg_index, arg_member, arg_value, arg_elem }; @@ -32,7 +40,16 @@ cell AMX_NATIVE_CALL set_member(AMX *amx, cell *params) return set_member(pEdict->pvPrivateData, member, value, element); } -// native any:get_member(_index, any:_member, any:...); +/* +* Returns a value from an entity's member. +* +* @param index Entity index +* @param member The specified member, look at the enums with name *_Members +* +* @return If an integer or boolean or one byte, array or everything else is passed via the 3rd argument and more, look at the argument list for the specified member +* +* native any:get_member(const index, any:member, any:...); +*/ cell AMX_NATIVE_CALL get_member(AMX *amx, cell *params) { enum args_e { arg_count, arg_index, arg_member, arg_3, arg_4, arg_5 }; @@ -98,7 +115,15 @@ cell AMX_NATIVE_CALL get_member(AMX *amx, cell *params) return get_member(pEdict->pvPrivateData, member, dest, element, length); } -// native set_member_game(any:_member, any:...); +/* +* Sets a value to CSGameRules_Members members. +* +* @param member The specified member, look at the enums with name CSGameRules_Members +* +* @return 1 on success. +* +* native set_member_game(CSGameRules_Members:member, any:...); +*/ cell AMX_NATIVE_CALL set_member_game(AMX *amx, cell *params) { enum args_e { arg_count, arg_member, arg_value, arg_elem }; @@ -117,7 +142,15 @@ cell AMX_NATIVE_CALL set_member_game(AMX *amx, cell *params) return set_member(g_pGameRules, member, value, element); } -// native get_member_game(any:_member, any:...); +/* +* Returns a value from CSGameRules_Members members +* +* @param member The specified member, look at the enums with name CSGameRules_Members +* +* @return If an integer or boolean or one byte, array or everything else is passed via the 3rd argument and more, look at the argument list for the specified member +* +* native any:get_member_game(CSGameRules_Members:member, any:...); +*/ cell AMX_NATIVE_CALL get_member_game(AMX *amx, cell *params) { enum args_e { arg_count, arg_member, arg_2 }; @@ -155,7 +188,12 @@ cell AMX_NATIVE_CALL get_member_game(AMX *amx, cell *params) return get_member(g_pGameRules, member, dest, element, length); } -// native set_entvar(const index, const EntVars:var, any:...); +/* +* Sets entvars data for an entity. +* Use the var_* EntVars enum +* +* 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 }; @@ -179,7 +217,12 @@ cell AMX_NATIVE_CALL set_entvar(AMX *amx, cell *params) return set_member(&pEdict->v, member, value, element); } -// native any:get_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:...); +*/ cell AMX_NATIVE_CALL get_entvar(AMX *amx, cell *params) { enum args_e { arg_count, arg_index, arg_var, arg_3, arg_4 }; @@ -236,7 +279,15 @@ cell AMX_NATIVE_CALL get_entvar(AMX *amx, cell *params) return get_member(&pEdict->v, member, dest, element, length); } -// native set_pmove(const PlayerMove:pmove, any:...); +/* +* Sets playermove var. +* +* @param var The specified playermove, look at the enum PlayerMove +* +* @return 1 on success. +* +* native set_pmove(const PlayerMove:var, any:...); +*/ cell AMX_NATIVE_CALL set_pmove(AMX *amx, cell *params) { enum args_e { arg_count, arg_var, arg_value, arg_elem }; @@ -253,7 +304,15 @@ cell AMX_NATIVE_CALL set_pmove(AMX *amx, cell *params) return set_member(g_pMove, member, value, element); } -// native any:get_pmove(const PlayerMove:pmove, any:...); +/* +* Returns a playermove var. +* +* @param var The specified playermove var, look at the enums PlayerMove +* +* @return If an integer or boolean or one byte, array or everything else is passed via the 3rd argument and more, look at the argument list for the specified mvar +* +* native any:get_pmove(const PlayerMove:var, any:...); +*/ cell AMX_NATIVE_CALL get_pmove(AMX *amx, cell *params) { enum args_e { arg_count, arg_var, arg_2, arg_3 }; @@ -288,7 +347,15 @@ cell AMX_NATIVE_CALL get_pmove(AMX *amx, cell *params) return get_member(g_pMove, member, dest, element, length); } -// native set_movevar(const MoveVars:var, any:...); +/* +* Sets a movevar value to a playermove. +* +* @param var The specified mvar, look at the enum MoveVars +* +* @return 1 on success. +* +* native set_movevar(const MoveVars:var, any:...); +*/ cell AMX_NATIVE_CALL set_movevar(AMX *amx, cell *params) { enum args_e { arg_count, arg_var, arg_value }; @@ -303,7 +370,15 @@ cell AMX_NATIVE_CALL set_movevar(AMX *amx, cell *params) return set_member(g_pMove->movevars, member, value, 0); } -// native any:get_movevar(const MoveVars:var, any:...); +/* +* Returns a movevar value from a playermove. +* +* @param var The specified mvar, look at the enum MoveVars +* +* @return If an integer or boolean or one byte, array or everything else is passed via the 3rd argument and more, look at the argument list for the specified mvar +* +* native any:get_movevar(const MoveVars:var, any:...); +*/ cell AMX_NATIVE_CALL get_movevar(AMX *amx, cell *params) { enum args_e { arg_count, arg_var, arg_2, arg_3 }; @@ -332,7 +407,12 @@ cell AMX_NATIVE_CALL get_movevar(AMX *amx, cell *params) return get_member(g_pMove->movevars, member, dest, element, length); } -// native set_ucmd(const cmd, const UserCmd:var, any:...); +/* +* Sets usercmd data. +* Use the ucmd_* UCmd enum +* +* native set_ucmd(const ucmd, const UCmd:var, any:...); +*/ cell AMX_NATIVE_CALL set_ucmd(AMX *amx, cell *params) { enum args_e { arg_count, arg_cmd, arg_var, arg_value }; @@ -348,7 +428,12 @@ cell AMX_NATIVE_CALL set_ucmd(AMX *amx, cell *params) return set_member(cmd, member, value, 0); } -// native any:get_ucmd(const cmd, const UserCmd:var, any:...); +/* +* Returns entvar data from an entity. +* Use the ucmd_* UCmd enum +* +* native any:get_ucmd(const ucmd, const UCmd:var, any:...); +*/ cell AMX_NATIVE_CALL get_ucmd(AMX *amx, cell *params) { enum args_e { arg_count, arg_cmd, arg_var, arg_3, arg_4 }; @@ -375,7 +460,15 @@ cell AMX_NATIVE_CALL get_ucmd(AMX *amx, cell *params) return get_member(cmd, member, dest, element); } -// native set_pmtrace(const tr, const PMTrace:var, any:...); +/* +* Sets a pmtrace var. +* +* @param var The specified mvar, look at the enum PMTrace +* +* @return 1 on success. +* +* native set_pmtrace(const tracehandle, const PMTrace:var, any:...); +*/ cell AMX_NATIVE_CALL set_pmtrace(AMX *amx, cell *params) { enum args_e { arg_count, arg_tr, arg_var, arg_value }; @@ -391,7 +484,15 @@ cell AMX_NATIVE_CALL set_pmtrace(AMX *amx, cell *params) return set_member(tr, member, value, 0); } -// native any:get_pmtrace(const tr, const PMTrace:var, any:...); +/* +* Returns a pmtrace var +* +* @param var The specified mvar, look at the enum PMTrace +* +* @return If an integer or boolean or one byte, array or everything else is passed via the 3rd argument and more, look at the argument list for the specified mvar +* +* native any:get_pmtrace(const tracehandle, const PMTrace:var, any:...); +*/ cell AMX_NATIVE_CALL get_pmtrace(AMX *amx, cell *params) { enum args_e { arg_count, arg_tr, arg_var, arg_3, arg_4 }; @@ -418,6 +519,62 @@ cell AMX_NATIVE_CALL get_pmtrace(AMX *amx, cell *params) return get_member(tr, member, dest, element); } +/* +* Sets a RebuyStruct member. +* +* @param var The specified RebuyStruct, look at the enum RebuyStruct +* +* @return 1 on success. +* +* native set_rebuy(const rebuyhandle, const RebuyStruct:member, value); +*/ +cell AMX_NATIVE_CALL set_rebuy(AMX *amx, cell *params) +{ + enum args_e { arg_count, arg_handle, arg_member, arg_value }; + + member_t *member = memberlist[params[arg_member]]; + if (unlikely(member == nullptr)) { + MF_LogError(amx, AMX_ERR_NATIVE, "%s: unknown member id %i", __FUNCTION__, params[arg_member]); + return FALSE; + } + + cell *handle = (cell *)params[arg_handle]; + if (unlikely(handle == nullptr)) { + MF_LogError(amx, AMX_ERR_NATIVE, "%s: invalid rebuy handle", __FUNCTION__); + return FALSE; + } + + return set_member(handle, member, ¶ms[arg_value], 0); +} + +/* +* Returns a RebuyStruct member +* +* @param var The specified RebuyStruct, look at the enum RebuyStruct +* +* @return If an integer or boolean or one byte, array or everything else is passed via the 3rd argument and more, look at the argument list for the specified RebuyStruct +* +* native get_rebuy(const rebuyhandle, RebuyStruct:member); +*/ +cell AMX_NATIVE_CALL get_rebuy(AMX *amx, cell *params) +{ + enum args_e { arg_count, arg_handle, arg_member }; + + member_t *member = memberlist[params[arg_member]]; + if (unlikely(member == nullptr)) { + MF_LogError(amx, AMX_ERR_NATIVE, "%s: unknown member id %i", __FUNCTION__, params[arg_member]); + return FALSE; + } + + cell *handle = (cell *)params[arg_handle]; + if (unlikely(handle == nullptr)) { + MF_LogError(amx, AMX_ERR_NATIVE, "%s: invalid rebuy handle", __FUNCTION__); + return FALSE; + } + + return get_member(handle, member, nullptr, 0); +} + AMX_NATIVE_INFO EngineVars_Natives[] = { { "set_entvar", set_entvar }, @@ -426,6 +583,9 @@ AMX_NATIVE_INFO EngineVars_Natives[] = { "set_ucmd", set_ucmd }, { "get_ucmd", get_ucmd }, + { "set_rebuy", set_rebuy }, + { "get_rebuy", get_rebuy }, + { nullptr, nullptr } }; @@ -560,6 +720,12 @@ BOOL set_member(void* pdata, const member_t *member, cell* value, size_t element set_member(pdata, member->offset, *(float *)value, element); return TRUE; } + case MEMBER_TRACERESULT: + { + // native set_member(_index, any:_member, any:_value, _elem); + set_member(pdata, member->offset, *(TraceResult *)value, element); + return TRUE; + } case MEMBER_ENTITY: case MEMBER_EVARS: @@ -582,20 +748,20 @@ cell get_member(void* pdata, const member_t *member, cell* dest, size_t element, { // native any:get_member(_index, any:_member, element); auto& pEntity = get_member(pdata, member->offset, element); - return pEntity ? indexOfEdict(pEntity->pev) : -1; + return pEntity ? indexOfEdict(pEntity->pev) : AMX_NULLENT; } case MEMBER_EHANDLE: { // native any:get_member(_index, any:_member, element); EHANDLE ehandle = get_member(pdata, member->offset, element); edict_t *pEntity = ehandle.Get(); - return pEntity ? indexOfEdict(pEntity) : -1; + return pEntity ? indexOfEdict(pEntity) : AMX_NULLENT; } case MEMBER_EDICT: { // native any:get_member(_index, any:_member, element); edict_t *pEntity = get_member(pdata, member->offset, element); - return pEntity ? indexOfEdict(pEntity) : -1; + return pEntity ? indexOfEdict(pEntity) : AMX_NULLENT; } case MEMBER_VECTOR: { @@ -684,16 +850,15 @@ cell get_member(void* pdata, const member_t *member, cell* dest, size_t element, case MEMBER_ENTITY: case MEMBER_EVARS: - case MEBMER_REBUYSTRUCT: return 0; - + case MEMBER_TRACERESULT: + return (cell)get_member_direct(pdata, member->offset, element); + case MEBMER_REBUYSTRUCT: + return (cell)get_member_direct(pdata, member->offset, element); case MEMBER_PMTRACE: - // native any:get_member(_index, any:_member, element); return (cell)get_member_direct(pdata, member->offset, element); case MEBMER_USERCMD: - // native any:get_member(_index, any:_member, element); return (cell)get_member_direct(pdata, member->offset, element); - default: break; } diff --git a/reapi/src/natives/natives_misc.cpp b/reapi/src/natives/natives_misc.cpp index c1528d7..59d2d03 100644 --- a/reapi/src/natives/natives_misc.cpp +++ b/reapi/src/natives/natives_misc.cpp @@ -1,14 +1,14 @@ #include "precompiled.h" /* -* Assign the number of the player animations. +* Assign the number of the player's animation. * -* @param index Client index -* @param playerAnim Specific the number animation +* @param index Client index +* @param playerAnim Specific animation number * * @noreturn * -* native rg_set_animation(index, PLAYER_ANIM:playerAnim); +* native rg_set_animation(const index, PLAYER_ANIM:playerAnim); */ cell AMX_NATIVE_CALL rg_set_animation(AMX *amx, cell *params) { @@ -28,13 +28,13 @@ enum AccountSet { AS_SET, AS_ADD }; /* * Adds money to player's account. * -* @param index Client index -* @param amount The amount of money -* @param bTrackChange If the bTrackChange is 1, the amount of money added will also be displayed. +* @param index Client index +* @param amount The amount of money +* @param bTrackChange If bTrackChange is 1, the amount of money added will also be displayed. * * @noreturn * -* native rg_add_account(index, amount, AccountSet:typeSet = AS_ADD, const bool:bTrackChange = true); +* native rg_add_account(const index, amount, AccountSet:typeSet = AS_ADD, const bool:bTrackChange = true); */ cell AMX_NATIVE_CALL rg_add_account(AMX *amx, cell *params) { @@ -56,15 +56,15 @@ cell AMX_NATIVE_CALL rg_add_account(AMX *amx, cell *params) enum GiveType { GT_APPEND, GT_REPLACE, GT_DROP_AND_REPLACE }; /* -* Gives item to player +* Gives the player an item. * -* @param index Client index -* @param pszName Classname item -* @param type Look at the enum's with name GiveType +* @param index Client index +* @param pszName Item classname +* @param type Look at the enums with name GiveType * -* @return Index of entity if successfully, -1 otherwise +* @return Index of entity if successfull, -1 otherwise * -* native rg_give_item(index, const pszName[], GiveType:type = GT_APPEND); +* native rg_give_item(const index, const pszName[], GiveType:type = GT_APPEND); */ cell AMX_NATIVE_CALL rg_give_item(AMX *amx, cell *params) { @@ -78,29 +78,26 @@ cell AMX_NATIVE_CALL rg_give_item(AMX *amx, cell *params) GiveType type = static_cast(params[arg_type]); const char *itemName = getAmxString(amx, params[arg_item]); - if (type > GT_APPEND) { - + if (type > GT_APPEND) + { auto pInfo = g_ReGameApi->GetWeaponSlot(itemName); if (pInfo) { pPlayer->ForEachItem(pInfo->slot, [pPlayer, pInfo, type](CBasePlayerItem *pItem) { - if (pItem->m_iId != pInfo->id) + switch (type) { - switch (type) - { - case GT_DROP_AND_REPLACE: - pPlayer->CSPlayer()->DropPlayerItem(STRING(pItem->pev->classname)); - break; - case GT_REPLACE: - pPlayer->pev->weapons &= ~(1 << pItem->m_iId); - pPlayer->RemovePlayerItem(pItem); - pItem->Kill(); - break; - case GT_APPEND: - default: - break; - } + case GT_DROP_AND_REPLACE: + pPlayer->CSPlayer()->DropPlayerItem(STRING(pItem->pev->classname)); + break; + case GT_REPLACE: + pPlayer->pev->weapons &= ~(1 << pItem->m_iId); + pPlayer->RemovePlayerItem(pItem); + pItem->Kill(); + break; + case GT_APPEND: + default: + break; } return false; @@ -116,13 +113,72 @@ cell AMX_NATIVE_CALL rg_give_item(AMX *amx, cell *params) } /* -* Give the player default items +* Gives the player an custom item, this means that don't handled API things. * -* @param index Client index +* @example rg_give_custom_item(id, "weapon_c4"); doesn't sets the member m_bHasC4 to true, as the rg_give_item does. +* +* @param index Client index +* @param pszName Item classname +* @param type Look at the enums with name GiveType +* +* @return Index of entity if successfull, -1 otherwise +* +* native rg_give_custom_item(const index, const pszName[], GiveType:type = GT_APPEND); +*/ +cell AMX_NATIVE_CALL rg_give_custom_item(AMX *amx, cell *params) +{ + enum args_e { arg_count, arg_index, arg_item, arg_type }; + + CHECK_ISPLAYER(arg_index); + + CBasePlayer *pPlayer = UTIL_PlayerByIndex(params[arg_index]); + CHECK_CONNECTED(pPlayer, arg_index); + + GiveType type = static_cast(params[arg_type]); + const char *itemName = getAmxString(amx, params[arg_item]); + + if (type > GT_APPEND) + { + auto pInfo = g_ReGameApi->GetWeaponSlot(itemName); + if (pInfo) + { + pPlayer->ForEachItem(pInfo->slot, [pPlayer, pInfo, type](CBasePlayerItem *pItem) + { + switch (type) + { + case GT_DROP_AND_REPLACE: + pPlayer->CSPlayer()->DropPlayerItem(STRING(pItem->pev->classname)); + break; + case GT_REPLACE: + pPlayer->pev->weapons &= ~(1 << pItem->m_iId); + pPlayer->RemovePlayerItem(pItem); + pItem->Kill(); + break; + case GT_APPEND: + default: + break; + } + + return false; + }); + } + } + + auto pEntity = GiveNamedItemInternal(amx, pPlayer, itemName); + if (pEntity) + return indexOfPDataAmx(pEntity); + + return AMX_NULLENT; +} + +/* +* Give the default items to a player. +* +* @param index Client index * * @noreturn * -* native rg_give_default_items(index); +* native rg_give_default_items(const index); */ cell AMX_NATIVE_CALL rg_give_default_items(AMX *amx, cell *params) { @@ -138,14 +194,14 @@ cell AMX_NATIVE_CALL rg_give_default_items(AMX *amx, cell *params) } /* -* Give the player shield +* Gives the player a shield * -* @param index Client index -* @param bDeploy to get shield from holster +* @param index Client index +* @param bDeploy To deploy the shield * * @noreturn * -* native rg_give_shield(index, const bool:bDeploy = true); +* native rg_give_shield(const index, const bool:bDeploy = true); */ cell AMX_NATIVE_CALL rg_give_shield(AMX *amx, cell *params) { @@ -161,19 +217,19 @@ cell AMX_NATIVE_CALL rg_give_shield(AMX *amx, cell *params) } /* -* Inflicts in a radius from the source position. +* Inflicts damage in a radius from the source position. * -* @param vecSrc The source position -* @param inflictor Inflictor is the entity that caused the damage (such as a gun) -* @param attacker Attacker is the entity that tirggered the damage (such as the gun's owner). -* @param flDamage The amount of damage -* @param flRadius Radius damage -* @param iClassIgnore To specify classes that are immune to damage. -* @param bitsDamageType Damage type DMG_* +* @param vecSrc The source position +* @param inflictor Inflictor is the entity that caused the damage (such as a gun) +* @param attacker Attacker is the entity that triggered the damage (such as the gun's owner) +* @param flDamage The amount of damage +* @param flRadius Damage radius +* @param iClassIgnore To specify classes that are immune to damage +* @param bitsDamageType Damage type DMG_* * * @noreturn * -* native rg_dmg_radius(Float:vecSrc[3], inflictor, attacker, Float:flDamage, Float:flRadius, iClassIgnore, bitsDamageType); +* native rg_dmg_radius(Float:vecSrc[3], const inflictor, const attacker, const Float:flDamage, const Float:flRadius, const iClassIgnore, const bitsDamageType); */ cell AMX_NATIVE_CALL rg_dmg_radius(AMX *amx, cell *params) { @@ -189,7 +245,7 @@ cell AMX_NATIVE_CALL rg_dmg_radius(AMX *amx, cell *params) } /* -* Resets the global multi damage accumulator +* Resets the global multi damage accumulator. * * @noreturn * @@ -202,14 +258,14 @@ cell AMX_NATIVE_CALL rg_multidmg_clear(AMX *amx, cell *params) } /* -* Inflicts contents of global multi damage register on victim +* Inflicts contents of global multi damage registered on victim. * -* @param inflictor Inflictor is the entity that caused the damage (such as a gun) -* @param attacker Attacker is the entity that tirggered the damage (such as the gun's owner). +* @param inflictor Inflictor is the entity that caused the damage (such as a gun) +* @param attacker Attacker is the entity that triggered the damage (such as the gun's owner) * * @noreturn * -* native rg_multidmg_apply(inflictor, attacker); +* native rg_multidmg_apply(const inflictor, const attacker); */ cell AMX_NATIVE_CALL rg_multidmg_apply(AMX *amx, cell *params) { @@ -225,16 +281,16 @@ cell AMX_NATIVE_CALL rg_multidmg_apply(AMX *amx, cell *params) } /* -* Adds damage the accumulator +* Adds damage to the accumulator. * -* @param inflictor Inflictor is the entity that caused the damage (such as a gun) -* @param victim A victim that takes damage -* @param flDamage The amount of damage -* @param bitsDamageType Damage type DMG_* +* @param inflictor Inflictor is the entity that caused the damage (such as a gun) +* @param victim The victim that takes damage +* @param flDamage The amount of damage +* @param bitsDamageType Damage type DMG_* * * @noreturn * -* native rg_multidmg_add(inflictor, victim, Float:flDamage, bitsDamageType); +* native rg_multidmg_add(const inflictor, const victim, const Float:flDamage, const bitsDamageType); */ cell AMX_NATIVE_CALL rg_multidmg_add(AMX *amx, cell *params) { @@ -255,22 +311,22 @@ cell AMX_NATIVE_CALL rg_multidmg_add(AMX *amx, cell *params) } /* -* Fire bullets from entity +* Fires bullets from entity. * -* @param inflictor Inflictor is the entity that caused the damage (such as a gun) -* @param attacker Attacker is the entity that tirggered the damage (such as the gun's owner). -* @param shots The number of shots -* @param vecSrc The source position of the barrel -* @param vecDirShooting Direction shooting -* @param vecSpread Spread -* @param flDistance Max shot distance -* @param iBulletType Bullet type -* @param iTracerFreq Tracer frequancy -* @param iDamage Damage amount +* @param inflictor Inflictor is the entity that caused the damage (such as a gun) +* @param attacker Attacker is the entity that tirggered the damage (such as the gun's owner) +* @param shots The number of shots +* @param vecSrc The source position of the barrel +* @param vecDirShooting Shooting direction +* @param vecSpread Spread +* @param flDistance Max shot distance +* @param iBulletType Bullet type, look at the enum with name Bullet in cssdk_const.inc +* @param iTracerFreq Tracer frequency +* @param iDamage Damage amount * * @noreturn * -* native rg_fire_bullets(inflictor, attacker, shots, Float:vecSrc[3], Float:vecDirShooting[3], Float::vecSpread[3], Float:flDistance, iBulletType, iTracerFreq, iDamage); +* native rg_fire_bullets(const inflictor, const attacker, const shots, Float:vecSrc[3], Float:vecDirShooting[3], Float:vecSpread[3], const Float:flDistance, const Bullet:iBulletType, const iTracerFreq, const iDamage); */ cell AMX_NATIVE_CALL rg_fire_bullets(AMX *amx, cell *params) { @@ -299,22 +355,22 @@ cell AMX_NATIVE_CALL rg_fire_bullets(AMX *amx, cell *params) } /* -* Fire bullets from player's weapon +* Fires bullets from player's weapon. * -* @param inflictor Inflictor is the entity that caused the damage (such as a gun) -* @param attacker Attacker is the entity that tirggered the damage (such as the gun's owner). -* @param vecSrc The source position of the barrel -* @param vecDirShooting Direction shooting -* @param vecSpread Spread -* @param flDistance Max shot distance -* @param iPenetration The number of penetration -* @param iBulletType Bullet type -* @param iDamage Damage amount -* @param flRangeModifier Damage range modifier -* @param bPistol Pistol shot -* @param shared_rand Use player's random seed, get circular gaussian spread +* @param inflictor Inflictor is the entity that caused the damage (such as a gun) +* @param attacker Attacker is the entity that tirggered the damage (such as the gun's owner) +* @param vecSrc The source position of the barrel +* @param vecDirShooting Shooting direction +* @param vecSpread Spread +* @param flDistance Max shot distance +* @param iPenetration The amount of penetration +* @param iBulletType Bullet type, look at the enum with name Bullet in cssdk_const.inc +* @param iDamage Damage amount +* @param flRangeModifier Damage range modifier +* @param bPistol Pistol shot +* @param shared_rand Use player's random seed, get circular gaussian spread * -* @return Float:[3] The result spread +* @return Float:[3] The spread result * * native Float:[3] rg_fire_bullets3(const inflictor, const attacker, Float:vecSrc[3], Float:vecDirShooting[3], const Float:vecSpread, const Float:flDistance, const iPenetration, const Bullet:iBulletType, const iDamage, const Float:flRangeModifier, const bool:bPistol, const shared_rand); */ @@ -372,17 +428,16 @@ struct { }; /* -* Complete the round +* Forces the round to end. * -* @param tmDelay Delay before the onset of a new round. -* @param st Which team won -* @param event The event is the end of the round -* @param message The message on round end -* @param sentence The sound at the end of the round +* @param tmDelay Delay before the onset of a new round +* @param st Which team won +* @param event The event is the end of the round +* @param message The message on round end +* @param sentence The sound at the end of the round * * @noreturn -* -* native rg_round_end(Float:tmDelay, WinStatus:st, ScenarioEventEndRound:event = ROUND_NONE, const message[] = "default", const sentence[] = "default"); +* native rg_round_end(const Float:tmDelay, const WinStatus:st, const ScenarioEventEndRound:event = ROUND_NONE, const message[] = "default", const sentence[] = "default"); */ cell AMX_NATIVE_CALL rg_round_end(AMX *amx, cell *params) { @@ -424,14 +479,13 @@ cell AMX_NATIVE_CALL rg_round_end(AMX *amx, cell *params) } /* -* Update current scores +* Updates current scores. * -* @param iCtsWins The amount of wins to won -* @param iTsWins The amount of wins to won -* @param bAdd Adds the score to the current amount wins. +* @param iCtsWins The amount of wins for counter-terrorists +* @param iTsWins The amount of wins for terrorists +* @param bAdd Adds the score to the current amount * * @noreturn -* * native rg_update_teamscores(const iCtsWins = 0, const iTsWins = 0, const bool:bAdd = true); */ cell AMX_NATIVE_CALL rg_update_teamscores(AMX *amx, cell *params) @@ -450,11 +504,12 @@ cell AMX_NATIVE_CALL rg_update_teamscores(AMX *amx, cell *params) /* * Creates an entity using Counter-Strike's custom CreateNamedEntity wrapper. * -* @param classname Entity classname -* @param useHashTable Use this only for known game entities. -* NOTE: Do not use this if you use a custom classname. +* @param classname Entity classname +* @param useHashTable Use this only for known game entities * -* @return Index of the created entity or 0 otherwise +* @note: Do not use this if you use a custom classname +* +* @return Index of the created entity or 0 otherwise * * native rg_create_entity(const classname[], const bool:useHashTable = false); */ @@ -480,12 +535,13 @@ cell AMX_NATIVE_CALL rg_create_entity(AMX *amx, cell *params) /* * Finds an entity in the world using Counter-Strike's custom FindEntityByString wrapper. * -* @param start_index Entity index to start searching from. -1 to start from the first entity -* @param classname Classname to search for -* @param useHashTable Use this only for known game entities. -* NOTE: Do not use this if you use a custom classname. +* @param start_index Entity index to start searching from. -1 to start from the first entity +* @param classname Classname to search for +* @param useHashTable Use this only for known game entities * -* @return Entity index > 0 if found, 0 otherwise +* @note: Do not use this if you use a custom classname +* +* @return Entity index > 0 if found, 0 otherwise * * native rg_find_ent_by_class(start_index, const classname[], const bool:useHashTable = false); */ @@ -518,10 +574,10 @@ cell AMX_NATIVE_CALL rg_find_ent_by_class(AMX *amx, cell *params) /* * Finds an entity in the world using Counter-Strike's custom FindEntityByString wrapper, matching by owner. * -* @param start_index Entity index to start searching from. -1 to start from the first entity -* @param classname Classname to search for +* @param start_index Entity index to start searching from. -1 to start from the first entity +* @param classname Classname to search for * -* @return 1 if found, 0 otherwise +* @return 1 if found, 0 otherwise * * native rg_find_ent_by_owner(&start_index, const classname[], owner); */ @@ -556,12 +612,12 @@ cell AMX_NATIVE_CALL rg_find_ent_by_owner(AMX *amx, cell *params) } /* -* Find the weapon by name in the player's inventory. +* Finds the weapon by name in the player's inventory. * -* @param index Client index -* @param weapon Weapon name +* @param index Client index +* @param weapon Weapon name * -* @return Entity-index of weapon, 0 otherwise +* @return Weapon's entity index, 0 otherwise * * native rg_find_weapon_bpack_by_name(const index, const weapon[]); */ @@ -596,20 +652,20 @@ struct { const char* pszItemName; bool(*hasItem)(CBasePlayer* pl); } itemInfoStruct[] = { - { "item_thighpack", [](CBasePlayer* pl) -> bool { return pl->m_bHasDefuser; } }, - { "item_longjump", [](CBasePlayer* pl) -> bool { return pl->m_fLongJump == TRUE; } }, - { "item_assaultsuit", [](CBasePlayer* pl) -> bool { return pl->m_iKevlar == ARMOR_VESTHELM; } }, - { "item_kevlar", [](CBasePlayer* pl) -> bool { return pl->m_iKevlar == ARMOR_KEVLAR; } }, - { "weapon_shield", [](CBasePlayer* pl) -> bool { return pl->m_bOwnsShield; } }, + { "item_thighpack", [](CBasePlayer* pl) -> bool { return pl->m_bHasDefuser; } }, + { "item_longjump", [](CBasePlayer* pl) -> bool { return pl->m_fLongJump == TRUE; } }, + { "item_assaultsuit", [](CBasePlayer* pl) -> bool { return pl->m_iKevlar == ARMOR_VESTHELM; } }, + { "item_kevlar", [](CBasePlayer* pl) -> bool { return pl->m_iKevlar == ARMOR_KEVLAR; } }, + { "weapon_shield", [](CBasePlayer* pl) -> bool { return pl->m_bOwnsShield; } }, }; /* -* Check if the player already have this item. +* Checks if the player has the item. * -* @param index Client index -* @param item Item name +* @param index Client index +* @param item Item name * -* @return 1 if successfully, 0 otherwise +* @return true if he does, false otherwise * * native bool:rg_has_item_by_name(const index, const item[]); */ @@ -632,7 +688,7 @@ cell AMX_NATIVE_CALL rg_has_item_by_name(AMX *amx, cell *params) // weapon_* auto pInfo = g_ReGameApi->GetWeaponSlot(pszItemName); - if (pInfo != nullptr) + if (pInfo) { auto pItem = pPlayer->m_rgpPlayerItems[ pInfo->slot ]; while (pItem) @@ -649,13 +705,13 @@ cell AMX_NATIVE_CALL rg_has_item_by_name(AMX *amx, cell *params) } /* -* Returns some information about a weapon. +* Returns specific information about the weapon. * -* @param weapon name or id Weapon id, see WEAPON_* constants or weapon_* name -* @param WpnInfo:type Info type, see WI_* constants +* @param weapon name or id Weapon id, see WEAPON_* constants, WeaponIdType or weapon_* name +* @param WpnInfo:type Info type, see WI_* constants * -* @return Weapon information value -* @error If weapon_id and type are out of bound, an error will be thrown. +* @return Weapon information +* @error If weapon_id or type are out of bounds, an error will be thrown * * native any:rg_get_weapon_info(any:...); */ @@ -663,16 +719,16 @@ cell AMX_NATIVE_CALL rg_get_weapon_info(AMX *amx, cell *params) { enum args_e { arg_count, arg_weapon_id, arg_type, arg_3, arg_4 }; - WeaponIdType weaponID = static_cast(*getAmxAddr(amx, params[arg_weapon_id])); + WeaponIdType weaponId = static_cast(*getAmxAddr(amx, params[arg_weapon_id])); WpnInfo info_type = static_cast(*getAmxAddr(amx, params[arg_type])); - if (!GetWeaponInfoRange(weaponID, false) && info_type != WI_ID) + if (!GetWeaponInfoRange(weaponId, false) && info_type != WI_ID) { - MF_LogError(amx, AMX_ERR_NATIVE, "%s: invalid weapon id %i", __FUNCTION__, weaponID); + MF_LogError(amx, AMX_ERR_NATIVE, "%s: invalid weapon id %i", __FUNCTION__, weaponId); return 0; } - WeaponInfoStruct* info = g_ReGameApi->GetWeaponInfo(weaponID); + WeaponInfoStruct* info = g_ReGameApi->GetWeaponInfo(weaponId); char* szWeaponName = getAmxString(amx, params[arg_weapon_id]); switch (info_type) @@ -743,12 +799,12 @@ cell AMX_NATIVE_CALL rg_get_weapon_info(AMX *amx, cell *params) } /* -* Sets specific values of weapons info. +* Sets specific weapon info values. * -* @param weapon_id Weapon id, see WEAPON_* constants -* @param type Info type, see WI_* constants +* @param weapon_id Weapon id, see WEAPON_* constants +* @param type Info type, see WI_* constants * -* @return 1 if successfully, 0 otherwise +* @return 1 on success, 0 otherwise * * native rg_set_weapon_info(const {WeaponIdType,_}:weapon_id, WpnInfo:type, any:...); */ @@ -756,15 +812,15 @@ cell AMX_NATIVE_CALL rg_set_weapon_info(AMX *amx, cell *params) { enum args_e { arg_count, arg_weapon_id, arg_type, arg_value }; - WeaponIdType weaponID = static_cast(params[arg_weapon_id]); - if (!GetWeaponInfoRange(weaponID, true)) + WeaponIdType weaponId = static_cast(params[arg_weapon_id]); + if (!GetWeaponInfoRange(weaponId, true)) { - MF_LogError(amx, AMX_ERR_NATIVE, "%s: invalid weapon id %i", __FUNCTION__, weaponID); + MF_LogError(amx, AMX_ERR_NATIVE, "%s: invalid weapon id %i", __FUNCTION__, weaponId); return 0; } cell* value = getAmxAddr(amx, params[arg_value]); - WeaponInfoStruct *info = g_ReGameApi->GetWeaponInfo(weaponID); + WeaponInfoStruct *info = g_ReGameApi->GetWeaponInfo(weaponId); WpnInfo info_type = static_cast(params[arg_type]); switch (info_type) @@ -776,9 +832,17 @@ cell AMX_NATIVE_CALL rg_set_weapon_info(AMX *amx, cell *params) info->clipCost = *value; break; case WI_BUY_CLIP_SIZE: + info->buyClipSize = *value; + break; case WI_GUN_CLIP_SIZE: + info->gunClipSize= *value; + break; case WI_MAX_ROUNDS: + info->maxRounds = *value; + break; case WI_AMMO_TYPE: + info->ammoType = *value; + break; case WI_AMMO_NAME: case WI_NAME: MF_LogError(amx, AMX_ERR_NATIVE, "%s: this change will have no effect, type statement %i", __FUNCTION__, info_type); @@ -792,12 +856,12 @@ cell AMX_NATIVE_CALL rg_set_weapon_info(AMX *amx, cell *params) } /* -* Remove all the player's stuff by specific slot. +* Remove all the player's stuff in a specific slot. * -* @param index Client index -* @param slot Specific slot for remove of each item. +* @param index Client index +* @param slot The slot that will be emptied * -* @return 1 if successfully, 0 otherwise +* @return 1 on success, 0 otherwise * * native rg_remove_items_by_slot(const index, const InventorySlotType:slot); */ @@ -838,10 +902,10 @@ cell AMX_NATIVE_CALL rg_remove_items_by_slot(AMX *amx, cell *params) /* * Drop to floor all the player's stuff by specific slot. * -* @param index Client index -* @param slot Specific slot for remove of each item. +* @param index Client index +* @param slot Specific slot for remove of each item. * -* @return 1 if successfully, 0 otherwise +* @return 1 on success, 0 otherwise * * native rg_drop_items_by_slot(const index, const InventorySlotType:slot); */ @@ -863,12 +927,12 @@ cell AMX_NATIVE_CALL rg_drop_items_by_slot(AMX *amx, cell *params) } /* -* Remove all the player's stuff +* Remove all of the player's items. * -* @param index Client index -* @param removeSuit Remove suit +* @param index Client index +* @param removeSuit Remove suit * -* @return 1 if successfully, 0 otherwise +* @return 1 on success, 0 otherwise * * native rg_remove_all_items(const index, const bool:removeSuit = false); */ @@ -886,12 +950,12 @@ cell AMX_NATIVE_CALL rg_remove_all_items(AMX *amx, cell *params) } /* -* Drop specifed the player's item by classname. +* Forces the player to drop the specified item classname. * -* @param index Client index -* @param item_name Classname of item +* @param index Client index +* @param item_name Item classname * -* @return 1 if successfully, 0 otherwise +* @return 1 on success, 0 otherwise * * native rg_drop_item(const index, const item_name[]); */ @@ -909,13 +973,13 @@ cell AMX_NATIVE_CALL rg_drop_item(AMX *amx, cell *params) } /* -* Execute a client command on the gamedll side. +* Executes a client command on the gamedll side. * -* @param index Client index -* @param command Client command to execute on -* @param arg Optional command arguments +* @param index Client index +* @param command Client command to execute +* @param arg Optional command arguments * -* @return 1 if successfully, 0 otherwise +* @return 1 on success, 0 otherwise * * native rg_internal_cmd(const index, const cmd[], const arg[] = ""); */ @@ -937,12 +1001,12 @@ cell AMX_NATIVE_CALL rg_internal_cmd(AMX *amx, cell *params) } /* -* Remove specifed the player's item by classname. +* Removes the specified item classname from the player * -* @param index Client index -* @param item_name Classname of item +* @param index Client index +* @param item_name Item classname * -* @return 1 if successfully, 0 otherwise +* @return 1 if found and remove, 0 otherwise * * native rg_remove_item(const index, const item_name[]); */ @@ -964,48 +1028,11 @@ cell AMX_NATIVE_CALL rg_remove_item(AMX *amx, cell *params) } /* -* Returns amount of ammo in the client's backpack for a specific weapon. +* Sets the 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 = UTIL_PlayerByIndex(params[arg_index]); - CHECK_CONNECTED(pPlayer, arg_index); - - WeaponIdType weaponId = static_cast(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; - } - - auto itemFound = (CBasePlayerWeapon *)pPlayer->ForEachItem([pPlayer, weaponId](CBasePlayerItem *pItem) { - return pItem->m_iId == weaponId; - }); - - if (itemFound) { - return (cell)pPlayer->m_rgAmmo[ itemFound->m_iPrimaryAmmoType ]; - } - - 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 +* @param index Client index +* @param weapon Weapon id +* @param amount New backpack ammo amount to set * * @noreturn * @@ -1013,40 +1040,145 @@ cell AMX_NATIVE_CALL rg_get_user_bpammo(AMX *amx, cell *params) */ cell AMX_NATIVE_CALL rg_set_user_bpammo(AMX *amx, cell *params) { - enum args_e { arg_count, arg_index, arg_weapon, arg_amount }; + enum args_e { arg_count, arg_index, arg_weapon_id, arg_amount }; CHECK_ISPLAYER(arg_index); CBasePlayer *pPlayer = UTIL_PlayerByIndex(params[arg_index]); CHECK_CONNECTED(pPlayer, arg_index); - WeaponIdType weaponId = static_cast(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]); + auto pInfo = g_ReGameApi->GetWeaponSlot(static_cast(params[arg_weapon_id])); + if (!pInfo) { return FALSE; } - auto itemFound = (CBasePlayerWeapon *)pPlayer->ForEachItem([pPlayer, weaponId](CBasePlayerItem *pItem) { - return pItem->m_iId == weaponId; + auto pWeapon = pPlayer->ForEachItem([pPlayer, pInfo](CBasePlayerWeapon *pWeapon) { + return (pWeapon->IsWeapon() && pWeapon->m_iId == pInfo->id); }); - if (itemFound) { - pPlayer->m_rgAmmo[ itemFound->m_iPrimaryAmmoType ] = params[arg_amount]; + if (pWeapon) { + pPlayer->m_rgAmmo[ pWeapon->m_iPrimaryAmmoType ] = params[arg_amount]; return TRUE; } return FALSE; } +/* +* Returns the 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_id }; + + CHECK_ISPLAYER(arg_index); + + CBasePlayer *pPlayer = UTIL_PlayerByIndex(params[arg_index]); + CHECK_CONNECTED(pPlayer, arg_index); + + auto pInfo = g_ReGameApi->GetWeaponSlot(static_cast(params[arg_weapon_id])); + if (!pInfo) { + return FALSE; + } + + auto pWeapon = pPlayer->ForEachItem([pPlayer, pInfo](CBasePlayerWeapon *pWeapon) { + return (pWeapon->IsWeapon() && pWeapon->m_iId == pInfo->id); + }); + + if (pWeapon) { + return (cell)pPlayer->m_rgAmmo[ pWeapon->m_iPrimaryAmmoType ]; + } + + return FALSE; +} + +/* +* Sets the amount of clip ammo for a specific weapon. +* +* @param index Client index +* @param weapon Weapon id +* @param amount New clip ammo amount to set +* +* @noreturn +* +* native rg_set_user_ammo(const index, WeaponIdType:weapon, amount); +*/ +cell AMX_NATIVE_CALL rg_set_user_ammo(AMX *amx, cell *params) +{ + enum args_e { arg_count, arg_index, arg_weapon_id, arg_amount }; + + CHECK_ISPLAYER(arg_index); + + CBasePlayer *pPlayer = UTIL_PlayerByIndex(params[arg_index]); + CHECK_CONNECTED(pPlayer, arg_index); + + auto pInfo = g_ReGameApi->GetWeaponSlot(static_cast(params[arg_weapon_id])); + if (!pInfo) { + return FALSE; + } + + auto pWeapon = pPlayer->ForEachItem(pInfo->slot, [pPlayer, pInfo](CBasePlayerWeapon *pWeapon) { + return (pWeapon->IsWeapon() && pWeapon->m_iId == pInfo->id); + }); + + if (pWeapon) { + pWeapon->m_iClip = params[arg_amount]; + return TRUE; + } + + return FALSE; +} + +/* +* Returns the amount of clip ammo for a specific weapon. +* +* @param index Client index +* @param weapon Weapon id +* +* @return Amount of clip ammo +* +* native rg_get_user_ammo(const index, WeaponIdType:weapon); +*/ +cell AMX_NATIVE_CALL rg_get_user_ammo(AMX *amx, cell *params) +{ + enum args_e { arg_count, arg_index, arg_weapon_id, arg_amount }; + + CHECK_ISPLAYER(arg_index); + + CBasePlayer *pPlayer = UTIL_PlayerByIndex(params[arg_index]); + CHECK_CONNECTED(pPlayer, arg_index); + + auto pInfo = g_ReGameApi->GetWeaponSlot(static_cast(params[arg_weapon_id])); + if (!pInfo) { + return FALSE; + } + + auto pWeapon = pPlayer->ForEachItem(pInfo->slot, [pPlayer, pInfo](CBasePlayerWeapon *pWeapon) { + return (pWeapon->IsWeapon() && pWeapon->m_iId == pInfo->id); + }); + + if (pWeapon) { + return (cell)pWeapon->m_iClip; + } + + 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 +* @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 an icon +* @param flash If nonzero the icon will flash red * * @noreturn * @@ -1096,12 +1228,12 @@ cell AMX_NATIVE_CALL rg_give_defusekit(AMX *amx, cell *params) /* * Returns the client's armor value and retrieves the type of armor. * -* @param index Client index -* @param armortype Variable to store armor type in +* @param index Client index +* @param armortype Variable to store armor type in * -* @return Amount of armor, 0 if client has no armor +* @return Amount of armor, 0 if the client has no armor * -* native rg_get_user_armor(const index, &ArmorType:armortype); +* native rg_get_user_armor(const index, &ArmorType:armortype = ARMOR_NONE); */ cell AMX_NATIVE_CALL rg_get_user_armor(AMX *amx, cell *params) { @@ -1117,11 +1249,11 @@ cell AMX_NATIVE_CALL rg_get_user_armor(AMX *amx, cell *params) } /* -* Sets the client's armor value the type of armor. +* Sets the client's armor value and the type of armor. * -* @param index Client index -* @param armorvalue Amount of armor to set -* @param armortype Armor type +* @param index Client index +* @param armorvalue Amount of armor to set +* @param armortype Armor type to set * * @noreturn * @@ -1151,17 +1283,17 @@ cell AMX_NATIVE_CALL rg_set_user_armor(AMX *amx, cell *params) } /* -* Sets the client's team without killing the player, and sets the client model. -* @note To obtain of TeamName use the following: -* new TeamName:team = get_member(id, m_iTeam); +* Sets the client's team without killing the player and sets the client's model. +* @note To obtain a TeamName use the following: +* new TeamName:team = get_member(id, m_iTeam); * -* @param index Client index -* @param team Team id -* @param model Internal model, use MODEL_AUTO for a random appearance or if MODEL_UNASSIGNED not update it. +* @param index Client index +* @param team Team id +* @param model Internal model, use MODEL_AUTO for a random appearance or MODEL_UNASSIGNED to not update it * -* @param send_teaminfo If true, a TeamInfo message will be sent +* @param send_teaminfo If true, a TeamInfo message will be sent * -* @return 1 if successfully, 0 otherwise +* @return 1 on success, 0 otherwise * * native rg_set_user_team(const index, {TeamName,_}:team, {ModelName,_}:model = MODEL_AUTO, const bool:send_teaminfo = true); */ @@ -1246,11 +1378,11 @@ cell AMX_NATIVE_CALL rg_set_user_team(AMX *amx, cell *params) /* * Sets the client's player model. * -* @param index Client index -* @param model Model name -* @param update_index If true, the modelindex is updated as well +* @param index Client index +* @param model Model name +* @param update_index If true, the modelindex is updated as well * -* @return 1 if successfully, 0 otherwise +* @return 1 on success, 0 otherwise * * native rg_set_user_model(const index, const model[], const bool:update_index = false); */ @@ -1283,12 +1415,12 @@ cell AMX_NATIVE_CALL rg_set_user_model(AMX *amx, cell *params) } /* -* Reset model user +* Resets the client's model. * -* @param index Client index -* @param update_index If true, the modelindex is reseted as well +* @param index Client index +* @param update_index If true, the modelindex is reset as well * -* @return 1 if successfully, 0 otherwise +* @return 1 on success, 0 otherwise * * native rg_reset_user_model(const index, const bool:update_index = false); */ @@ -1318,12 +1450,12 @@ cell AMX_NATIVE_CALL rg_reset_user_model(AMX *amx, cell *params) } /* -* Enable/Disable footsteps of the player. +* Enable/Disable player's footsteps. * -* @param index Client index -* @param silent To enable silent footsteps of player's +* @param index Client index +* @param silent To enable silent footsteps * -* @return 1 if successfully, 0 otherwise +* @return 1 on success, 0 otherwise * * native rg_set_user_footsteps(const index, bool:silent = false); */ @@ -1348,11 +1480,11 @@ cell AMX_NATIVE_CALL rg_set_user_footsteps(AMX *amx, cell *params) } /* -* Get the current state footsteps of the player. +* Get the current footsteps state of the player. * -* @param index Client index +* @param index Client index * -* @return 1 if have silent footsteps, 0 otherwise +* @return 1 if the player has silent footsteps, 0 otherwise * * native rg_get_user_footsteps(const index); */ @@ -1369,12 +1501,12 @@ cell AMX_NATIVE_CALL rg_get_user_footsteps(AMX *amx, cell *params) } /* -* Transfer C4 to player +* Transfers C4 from one player to another. * -* @param index Client index -* @param receiver Receiver index, if 0 so will transfer a random to player +* @param index Client index +* @param receiver Receiver index, if 0 it will transfer to a random player * -* @return 1 if successfully, 0 otherwise +* @return 1 on success, 0 otherwise * * native rg_transfer_c4(const index, const receiver = 0); */ @@ -1414,12 +1546,12 @@ cell AMX_NATIVE_CALL rg_transfer_c4(AMX *amx, cell *params) } /* -* Instant reload weapons +* Instantly reload client's weapons. * -* @param index Client index -* @param weapon Weapon entity-index, if 0 then all the weapons +* @param index Client index +* @param weapon Weapon entity-index, if 0 then all weapons will be reloaded * -* @return 1 if successfully, 0 otherwise +* @return 1 on success, 0 otherwise * * native rg_instant_reload_weapons(const index, const weapon = 0); */ @@ -1436,7 +1568,7 @@ cell AMX_NATIVE_CALL rg_instant_reload_weapons(AMX *amx, cell *params) if (params[arg_weapon] != 0) { pWeapon = getPrivate(params[arg_weapon]); - if (pWeapon == nullptr || !pWeapon->IsWeapon()) { + if (!pWeapon || !pWeapon->IsWeapon()) { MF_LogError(amx, AMX_ERR_NATIVE, "%s: Invalid entity weapon", __FUNCTION__); return FALSE; } @@ -1449,8 +1581,8 @@ cell AMX_NATIVE_CALL rg_instant_reload_weapons(AMX *amx, cell *params) /* * Sets the amount of reward in the game account for all players. * -* @param rules_index Look at the enum's with name RewardRules -* @param amount The amount money +* @param rules_index Look at the enum with name RewardRules +* @param amount The money amount * * @noreturn * @@ -1467,11 +1599,11 @@ cell AMX_NATIVE_CALL rg_set_account_rules(AMX *amx, cell *params) } /* -* Get the amount of reward from account +* Gets the specified reward rule's money amount. * -* @param rules_index Look at the enum's with name RewardRules +* @param rules_index Look at the enum with name RewardRules * -* @return The amount of reward from account +* @return The amount of reward * * native rg_get_account_rules(const RewardRules:rules_index); */ @@ -1485,9 +1617,9 @@ cell AMX_NATIVE_CALL rg_get_account_rules(AMX *amx, cell *params) } /* -* If the bomb is planted +* Checks if the bomb is planted. * -* @return true if bomb is planted, false otherwise +* @return true if the bomb is planted, false otherwise * * native bool:rg_is_bomb_planted(); */ @@ -1499,12 +1631,12 @@ cell AMX_NATIVE_CALL rg_is_bomb_planted(AMX *amx, cell *params) } /* -* Join team +* Forces a player to join a team. * -* @param index Client index -* @param team Team id +* @param index Client index +* @param team Team id * -* @return 1 if successfully joined the team, 0 otherwise +* @return 1 on success, 0 otherwise * * native rg_join_team(const index, const TeamName:team); */ @@ -1521,7 +1653,7 @@ cell AMX_NATIVE_CALL rg_join_team(AMX *amx, cell *params) } /* -* Instantly balances the team. +* Instantly balances the teams. * * @noreturn * @@ -1536,7 +1668,7 @@ cell AMX_NATIVE_CALL rg_balance_teams(AMX *amx, cell *params) } /* -* To swap players, without reset frags/deaths and the amount wins. +* Swaps players' teams without reseting frags, deaths and wins. * * @noreturn * @@ -1551,10 +1683,10 @@ cell AMX_NATIVE_CALL rg_swap_all_players(AMX *amx, cell *params) } /* -* Instantly switches to the opposite team for one player. -* @note Switch from CT to TERRORIST also opposite. +* Instantly switches the player to his opposite team. +* @note Switch from CT to TERRORIST is also opposite. * -* @param index Client index +* @param index Client index * * @noreturn * @@ -1574,12 +1706,12 @@ cell AMX_NATIVE_CALL rg_switch_team(AMX *amx, cell *params) } /* -* Switch to specific weapon +* Forces the player to switch to a specific weapon. * -* @param index Client index -* @param weapon Weapon entity-index +* @param index Client index +* @param weapon Weapon entity-index * -* @return 1 if successfully switched, 0 otherwise +* @return 1 on success, 0 otherwise * * native rg_switch_weapon(const index, const weapon); */ @@ -1602,9 +1734,9 @@ cell AMX_NATIVE_CALL rg_switch_weapon(AMX *amx, cell *params) } /* -* To get which team has a high priority to join. +* Gets which team has a higher join priority. * -* @return Returns the Team Name +* @return Returns the Team Name * * native TeamName:rg_get_join_team_priority(); */ @@ -1616,12 +1748,12 @@ cell AMX_NATIVE_CALL rg_get_join_team_priority(AMX *amx, cell *params) } /* -* Can this player take damage from this attacker? +* Checks whether the player can take damage from the attacker. * -* @param index Client index -* @param attacker Attacker index +* @param index Client index +* @param attacker Attacker index * -* @return true if can take a damage, false otherwise +* @return true if he can take damage, false otherwise * * native bool:rg_is_player_can_takedamage(const index, const attacker); */ @@ -1645,11 +1777,11 @@ cell AMX_NATIVE_CALL rg_is_player_can_takedamage(AMX *amx, cell *params) } /* -* To get WeaponIdType from weaponbox +* Gets WeaponIdType from weaponbox * -* @param entity Weaponbox entity +* @param entity Weaponbox entity * -* @return return enum's of WeaponIdType +* @return return enum of WeaponIdType * * native WeaponIdType:rg_get_weaponbox_id(const entity); */ @@ -1675,9 +1807,9 @@ cell AMX_NATIVE_CALL rg_get_weaponbox_id(AMX *amx, cell *params) } /* -* Respawn on round for players/bots +* Respawn on round for players/bots. * -* @param index Client index +* @param index Client index * * @noreturn * @@ -1695,9 +1827,9 @@ cell AMX_NATIVE_CALL rg_round_respawn(AMX *amx, cell *params) } /* -* Reset player maxspeed +* Resets player's maxspeed. * -* @param index Client index +* @param index Client index * * @noreturn * @@ -1715,12 +1847,12 @@ cell AMX_NATIVE_CALL rg_reset_maxspeed(AMX *amx, cell *params) } /* -* Draws a HUD progress bar which is fills from 0% to 100% for the time duration seconds. -* NOTE: Set Duration to 0 to hide the bar. +* Draws a HUD progress bar which fills from 0% to 100% for the time duration in seconds. +* @note: Set the duration to 0 to hide the bar. * -* @param index Client index -* @param time Duration -* @param observer Send for everyone observer player +* @param index Client index +* @param time Duration +* @param observer Send for everyone who is observing the player * * @noreturn * @@ -1748,10 +1880,10 @@ cell AMX_NATIVE_CALL rg_send_bartime(AMX *amx, cell *params) /* * Same as BarTime, but StartPercent specifies how much of the bar is (already) filled. * -* @param index Client index -* @param time Duration -* @param startPercent Start percent -* @param observer Send for everyone observer player +* @param index Client index +* @param time Duration +* @param startPercent Start percent +* @param observer Send for everyone who is observing the player * * @noreturn * @@ -1778,11 +1910,11 @@ cell AMX_NATIVE_CALL rg_send_bartime2(AMX *amx, cell *params) } /* -* Sends the message SendAudio - plays the specified audio +* Sends the SendAudio message - plays the specified audio. * -* @param index Receiver index or use 0 for everyone -* @param sample Sound file to play -* @param pitch Sound pitch +* @param index Receiver index or use 0 for everyone +* @param sample Sound file to play +* @param pitch Sound pitch * * @noreturn * @@ -1810,83 +1942,86 @@ cell AMX_NATIVE_CALL rg_send_audio(AMX *amx, cell *params) AMX_NATIVE_INFO Misc_Natives_RG[] = { - { "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_set_animation", rg_set_animation }, + { "rg_add_account", rg_add_account }, + { "rg_give_item", rg_give_item }, + { "rg_give_custom_item", rg_give_custom_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_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 }, + { "rg_fire_bullets", rg_fire_bullets }, + { "rg_fire_bullets3", rg_fire_bullets3 }, - { "rg_round_end", rg_round_end }, - { "rg_update_teamscores", rg_update_teamscores }, + { "rg_round_end", rg_round_end }, + { "rg_update_teamscores", rg_update_teamscores }, - { "rg_create_entity", rg_create_entity }, - { "rg_find_ent_by_class", rg_find_ent_by_class }, - { "rg_find_ent_by_owner", rg_find_ent_by_owner }, + { "rg_create_entity", rg_create_entity }, + { "rg_find_ent_by_class", rg_find_ent_by_class }, + { "rg_find_ent_by_owner", rg_find_ent_by_owner }, { "rg_find_weapon_bpack_by_name", rg_find_weapon_bpack_by_name }, - { "rg_has_item_by_name", rg_has_item_by_name }, + { "rg_has_item_by_name", rg_has_item_by_name }, - { "rg_get_weapon_info", rg_get_weapon_info }, - { "rg_set_weapon_info", rg_set_weapon_info }, + { "rg_get_weapon_info", rg_get_weapon_info }, + { "rg_set_weapon_info", rg_set_weapon_info }, - { "rg_remove_items_by_slot", rg_remove_items_by_slot }, - { "rg_drop_items_by_slot", rg_drop_items_by_slot }, + { "rg_remove_items_by_slot", rg_remove_items_by_slot }, + { "rg_drop_items_by_slot", rg_drop_items_by_slot }, - { "rg_remove_all_items", rg_remove_all_items }, - { "rg_remove_item", rg_remove_item }, - { "rg_drop_item", rg_drop_item }, - { "rg_internal_cmd", rg_internal_cmd }, + { "rg_remove_all_items", rg_remove_all_items }, + { "rg_remove_item", rg_remove_item }, + { "rg_drop_item", rg_drop_item }, + { "rg_internal_cmd", rg_internal_cmd }, - { "rg_give_defusekit", rg_give_defusekit }, + { "rg_give_defusekit", rg_give_defusekit }, - { "rg_get_user_bpammo", rg_get_user_bpammo }, - { "rg_set_user_bpammo", rg_set_user_bpammo }, + { "rg_set_user_bpammo", rg_set_user_bpammo }, + { "rg_get_user_bpammo", rg_get_user_bpammo }, + { "rg_set_user_ammo", rg_set_user_ammo }, + { "rg_get_user_ammo", rg_get_user_ammo }, - { "rg_get_user_armor", rg_get_user_armor }, - { "rg_set_user_armor", rg_set_user_armor }, - { "rg_set_user_team", rg_set_user_team }, - { "rg_set_user_model", rg_set_user_model }, - { "rg_reset_user_model", rg_reset_user_model }, + { "rg_get_user_armor", rg_get_user_armor }, + { "rg_set_user_armor", rg_set_user_armor }, + { "rg_set_user_team", rg_set_user_team }, + { "rg_set_user_model", rg_set_user_model }, + { "rg_reset_user_model", rg_reset_user_model }, - { "rg_set_user_footsteps", rg_set_user_footsteps }, - { "rg_get_user_footsteps", rg_get_user_footsteps }, + { "rg_set_user_footsteps", rg_set_user_footsteps }, + { "rg_get_user_footsteps", rg_get_user_footsteps }, - { "rg_transfer_c4", rg_transfer_c4 }, - { "rg_instant_reload_weapons", rg_instant_reload_weapons }, + { "rg_transfer_c4", rg_transfer_c4 }, + { "rg_instant_reload_weapons", rg_instant_reload_weapons }, - { "rg_set_account_rules", rg_set_account_rules }, - { "rg_get_account_rules", rg_get_account_rules }, + { "rg_set_account_rules", rg_set_account_rules }, + { "rg_get_account_rules", rg_get_account_rules }, - { "rg_is_bomb_planted", rg_is_bomb_planted }, - { "rg_join_team", rg_join_team }, - { "rg_balance_teams", rg_balance_teams }, - { "rg_swap_all_players", rg_swap_all_players }, - { "rg_switch_team", rg_switch_team }, - { "rg_switch_weapon", rg_switch_weapon }, - { "rg_get_join_team_priority", rg_get_join_team_priority }, - { "rg_is_player_can_takedamage", rg_is_player_can_takedamage }, - { "rg_get_weaponbox_id", rg_get_weaponbox_id }, - { "rg_round_respawn", rg_round_respawn }, - { "rg_reset_maxspeed", rg_reset_maxspeed }, + { "rg_is_bomb_planted", rg_is_bomb_planted }, + { "rg_join_team", rg_join_team }, + { "rg_balance_teams", rg_balance_teams }, + { "rg_swap_all_players", rg_swap_all_players }, + { "rg_switch_team", rg_switch_team }, + { "rg_switch_weapon", rg_switch_weapon }, + { "rg_get_join_team_priority", rg_get_join_team_priority }, + { "rg_is_player_can_takedamage", rg_is_player_can_takedamage }, + { "rg_get_weaponbox_id", rg_get_weaponbox_id }, + { "rg_round_respawn", rg_round_respawn }, + { "rg_reset_maxspeed", rg_reset_maxspeed }, - { "rg_send_bartime", rg_send_bartime }, - { "rg_send_bartime2", rg_send_bartime2 }, - { "rg_send_audio", rg_send_audio }, + { "rg_send_bartime", rg_send_bartime }, + { "rg_send_bartime2", rg_send_bartime2 }, + { "rg_send_audio", rg_send_audio }, { nullptr, nullptr } }; /* -* Set name of the map +* Sets the name of the map. * -* @param mapname Change the name of the map. +* @param mapname New map name. * * @noreturn * @@ -1905,12 +2040,12 @@ cell AMX_NATIVE_CALL rh_set_mapname(AMX *amx, cell *params) enum MapNameType { MNT_TRUE, MNT_SET }; /* -* Get name of the map +* Gets the name of the map. * -* @param output Buffer to copy mapname to -* @param len Maximum buffer size -* @param type MNT_SET return the name of the current map -* MNT_TRUE return true the name of the current map independently of the set via rh_set_mapname +* @param output Buffer to copy map name to +* @param len Maximum buffer size +* @param type MNT_SET will return the name of the current map +* MNT_TRUE will return the original map name independant of the name set with via rh_set_mapname * * @noreturn * @@ -1937,7 +2072,7 @@ cell AMX_NATIVE_CALL rh_get_mapname(AMX *amx, cell *params) } /* -* Reset to true map name +* Reverts back the original map name. * * @noreturn * @@ -1953,20 +2088,20 @@ cell AMX_NATIVE_CALL rh_reset_mapname(AMX *amx, cell *params) /* * Emits a sound from an entity from the engine. * -* @param entity Entity index or use 0 to emit from worldspawn at the specified position -* @param recipients Recipient index or use 0 to heard for all clients -* @param channel Channel to emit from -* @param sample Sound file to emit -* @param vol Volume in percent -* @param attn Sound attenuation -* @param flags Emit flags -* @param pitch Sound pitch -* @param emitFlags Additional Emit2 flags, look at the defines like SND_EMIT2_* -* @param origin Specify origin and only on "param" entity worldspawn that is 0 +* @param entity Entity index or use 0 to emit from worldspawn at the specified position +* @param recipient Recipient index or use 0 to make all clients hear it +* @param channel Channel to emit from +* @param sample Sound file to emit +* @param vol Volume in percents +* @param attn Sound attenuation +* @param flags Emit flags +* @param pitch Sound pitch +* @param emitFlags Additional Emit2 flags, look at the defines like SND_EMIT2_* +* @param origin Specify origin and only on "param" entity worldspawn that is 0 * -* @return 1 if successfully sounds are emitted, 0 otherwise +* @return true if the emission was successfull, false otherwise * -* native rh_emit_sound2(const entity, const recipient, const channel, const sample[], Float:vol = VOL_NORM, Float:attn = ATTN_NORM, const flags = 0, const pitch = PITCH_NORM, emitFlags = 0, const Float:origin[3] = {0.0,0.0,0.0}); +* native bool:rh_emit_sound2(const entity, const recipient, const channel, const sample[], Float:vol = VOL_NORM, Float:attn = ATTN_NORM, const flags = 0, const pitch = PITCH_NORM, emitFlags = 0, const Float:origin[3] = {0.0,0.0,0.0}); */ cell AMX_NATIVE_CALL rh_emit_sound2(AMX *amx, cell *params) { @@ -1985,16 +2120,16 @@ cell AMX_NATIVE_CALL rh_emit_sound2(AMX *amx, cell *params) return (cell)g_RehldsFuncs->SV_EmitSound2 ( - args[arg_entity], // entity + args[arg_entity], // entity args[arg_recipient], // recipient - args[arg_channel], // channel - sample, // sample - args[arg_vol], // volume - args[arg_attn], // attn - args[arg_flags], // flags - args[arg_pitch], // pitch + args[arg_channel], // channel + sample, // sample + args[arg_vol], // volume + args[arg_attn], // attn + args[arg_flags], // flags + args[arg_pitch], // pitch args[arg_emitFlags], // emitFlags - args[arg_origin] // pOrigin + args[arg_origin] // pOrigin ); } @@ -2014,10 +2149,10 @@ cell AMX_NATIVE_CALL rh_update_user_info(AMX *amx, cell *params) AMX_NATIVE_INFO Misc_Natives_RH[] = { - { "rh_set_mapname", rh_set_mapname }, - { "rh_get_mapname", rh_get_mapname }, - { "rh_reset_mapname", rh_reset_mapname }, - { "rh_emit_sound2", rh_emit_sound2 }, + { "rh_set_mapname", rh_set_mapname }, + { "rh_get_mapname", rh_get_mapname }, + { "rh_reset_mapname", rh_reset_mapname }, + { "rh_emit_sound2", rh_emit_sound2 }, { "rh_update_user_info", rh_update_user_info }, { nullptr, nullptr } diff --git a/reapi/src/natives/natives_reunion.cpp b/reapi/src/natives/natives_reunion.cpp index 4012e2a..40d9425 100644 --- a/reapi/src/natives/natives_reunion.cpp +++ b/reapi/src/natives/natives_reunion.cpp @@ -3,8 +3,9 @@ /* * Get client protocol * -* @param index Client index -* @return client protocol +* @param index Client index +* +* @return Client protocol * * native REU_GetProtocol(const index); */ @@ -20,8 +21,9 @@ cell AMX_NATIVE_CALL REU_GetProtocol(AMX *amx, cell *params) /* * Get client auth type * -* @param index Client index -* @return client auth type +* @param index Client index +* +* @return Client auth type * * native REU_GetAuthtype(const index); */ @@ -35,10 +37,11 @@ cell AMX_NATIVE_CALL REU_GetAuthtype(AMX *amx, cell *params) } /* -* Check if client running RevEmu with limited user rights +* Check if the client is running RevEmu with limited user rights. * -* @param index Client index -* @return 1/0 +* @param index Client index +* +* @return 1/0 * * native REU_IsRevemuWithoutAdminRights(const index); */ diff --git a/reapi/src/natives/natives_vtc.cpp b/reapi/src/natives/natives_vtc.cpp index 701ab5d..f148eee 100644 --- a/reapi/src/natives/natives_vtc.cpp +++ b/reapi/src/natives/natives_vtc.cpp @@ -1,10 +1,11 @@ #include "precompiled.h" /* -* Checks whether the player is talking at this moment +* Checks whether the player is talking at the moment. * -* @param index Client index -* @return true if client is speaking, false otherwise +* @param index Client index +* +* @return true if client is speaking, false otherwise * * native bool:VTC_IsClientSpeaking(const index); */ @@ -18,9 +19,10 @@ cell AMX_NATIVE_CALL VTC_IsClientSpeaking(AMX *amx, cell *params) } /* -* Mutes this player +* Mutes the player. +* +* @param index Client index * -* @param index Client index * @noreturn * * native VTC_MuteClient(const index); @@ -36,9 +38,10 @@ cell AMX_NATIVE_CALL VTC_MuteClient(AMX *amx, cell *params) } /* -* Unmutes this player +* Unmutes the player. +* +* @param index Client index * -* @param index Client index * @noreturn * * native VTC_UnmuteClient(const index); @@ -54,10 +57,11 @@ cell AMX_NATIVE_CALL VTC_UnmuteClient(AMX *amx, cell *params) } /* -* Checks whether the player is muted at this moment +* Checks whether the player is muted at the moment. * -* @param index Client index -* @return true if client is muted, false otherwise +* @param index Client index +* +* @return true if client is muted, false otherwise * * native bool:VTC_IsClientMuted(const index); */ @@ -71,10 +75,10 @@ cell AMX_NATIVE_CALL VTC_IsClientMuted(AMX *amx, cell *params) } /* -* To play the audio file via the voice stream. +* Play the audio file via the voice stream. * * @param receiver Receiver index -* @param soundFilePath The path to the sound file. +* @param soundFilePath The path to the sound file * * @note Usage example: * VTC_PlaySound(id, "sound/ambience/Opera.wav"); diff --git a/reapi/src/precompiled.h b/reapi/src/precompiled.h index c780735..82ff883 100644 --- a/reapi/src/precompiled.h +++ b/reapi/src/precompiled.h @@ -25,6 +25,7 @@ #include #include #include +#include // metamod SDK #include diff --git a/reapi/src/reapi_utils.cpp b/reapi/src/reapi_utils.cpp index 83f3c90..5c5e032 100644 --- a/reapi/src/reapi_utils.cpp +++ b/reapi/src/reapi_utils.cpp @@ -63,3 +63,32 @@ void CTempStrings::pop(size_t count) { m_current -= count; } + +CBaseEntity *GiveNamedItemInternal(AMX *amx, CBasePlayer *pPlayer, const char *pszItemName) +{ + edict_t *pEdict = CREATE_NAMED_ENTITY(ALLOC_STRING(pszItemName)); + if (FNullEnt(pEdict)) + { + MF_LogError(amx, AMX_ERR_NATIVE, "%s: Item \"%s\" failed to create!\n", __FUNCTION__, pszItemName); + return nullptr; + } + + pEdict->v.origin = pPlayer->pev->origin; + pEdict->v.spawnflags |= SF_NORESPAWN; + + MDLL_Spawn(pEdict); + MDLL_Touch(pEdict, ENT(pPlayer->pev)); + + CBaseEntity *pEntity = getPrivate(pEdict); + + // not allow the item to fall to the ground. + if (FNullEnt(pEntity->pev->owner) || pEntity->pev->owner != pPlayer->edict()) + { + pEntity->pev->targetname = iStringNull; + pEntity->pev->flags |= FL_KILLME; + + return nullptr; + } + + return pEntity; +} diff --git a/reapi/src/reapi_utils.h b/reapi/src/reapi_utils.h index 96403c6..b9d760e 100644 --- a/reapi/src/reapi_utils.h +++ b/reapi/src/reapi_utils.h @@ -18,15 +18,11 @@ inline void EWRITE_COORD(float flValue) { (*g_pengfuncsTable->pfnWriteCoord)(flV inline void EWRITE_STRING(const char *sz) { (*g_pengfuncsTable->pfnWriteString)(sz); } inline void EWRITE_ENTITY(int iValue) { (*g_pengfuncsTable->pfnWriteEntity)(iValue); } -#ifndef _WIN32 -#define _strlwr(p) for (int i = 0; p[i] != 0; i++) p[i] = tolower(p[i]); -#endif - -inline bool GetWeaponInfoRange(WeaponIdType wpnid, bool set_info) +inline bool GetWeaponInfoRange(WeaponIdType wpnid, bool set_info = false) { if (wpnid == WEAPON_SHIELDGUN) return true; - + if (set_info && (wpnid == WEAPON_KNIFE || wpnid == WEAPON_C4)) return false; @@ -55,5 +51,6 @@ void Broadcast(const char *sentence); void UpdateTeamScores(); ModelName GetModelAuto(TeamName team); void UTIL_ServerPrint(const char *fmt, ...); +CBaseEntity *GiveNamedItemInternal(AMX *amx, CBasePlayer *pPlayer, const char *pszItemName); extern void __declspec(noreturn) UTIL_SysError(const char *fmt, ...);