mirror of
https://github.com/rehlds/reapi.git
synced 2025-03-15 15:00:27 +03:00
Natives without the dependencies moved in natives_common.
Closes #43 and some typo in amxx include files Add native FClassnameIs is_nullent will now check for the index 0 (behavior like FNullEnt) (Related #42)
This commit is contained in:
parent
799f0f8f82
commit
681f1a3cd7
@ -42,7 +42,7 @@ enum members_tables_e
|
|||||||
};
|
};
|
||||||
|
|
||||||
// is like FNullEnt
|
// is like FNullEnt
|
||||||
#define is_nullent(%0) (is_entity(%0) == false)
|
#define is_nullent(%0) (%0 != 0 && is_entity(%0) == false)
|
||||||
|
|
||||||
#define MAX_REGION_RANGE 1024
|
#define MAX_REGION_RANGE 1024
|
||||||
|
|
||||||
@ -148,6 +148,15 @@ native any:GetHookChainReturn(AType:type, any:...);
|
|||||||
*/
|
*/
|
||||||
native SetHookChainArg(number, AType:type, any:...);
|
native SetHookChainArg(number, AType:type, any:...);
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Compares the entity to specified a classname.
|
||||||
|
* @note This native also checks the validity of an entity.
|
||||||
|
*
|
||||||
|
* @return true/false
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
native bool:FClassnameIs(const entityIndex, const className[]);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Check if the entity is valid
|
* Check if the entity is valid
|
||||||
*
|
*
|
||||||
|
@ -672,7 +672,7 @@ native rg_reset_maxspeed(const index);
|
|||||||
* @noreturn
|
* @noreturn
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
native rg_send_bartime(const index, const Float:duration, const bool:observer = true);
|
native rg_send_bartime(const index, const duration, const bool:observer = true);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Same as BarTime, but StartPercent specifies how much of the bar is (already) filled.
|
* Same as BarTime, but StartPercent specifies how much of the bar is (already) filled.
|
||||||
@ -685,7 +685,7 @@ native rg_send_bartime(const index, const Float:duration, const bool:observer =
|
|||||||
* @noreturn
|
* @noreturn
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
native rg_send_bartime2(const index, const Float:duration, const Float:startPercent, const bool:observer = true);
|
native rg_send_bartime2(const index, const duration, const startPercent, const bool:observer = true);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Sends the message SendAudio - plays the specified audio
|
* Sends the message SendAudio - plays the specified audio
|
||||||
|
@ -452,7 +452,7 @@ enum GamedllFunc_CBasePlayer
|
|||||||
/*
|
/*
|
||||||
* Description: The player uses a radio message.
|
* Description: The player uses a radio message.
|
||||||
* It is called self-uses radio or throw grenades or on freeze the period end.
|
* It is called self-uses radio or throw grenades or on freeze the period end.
|
||||||
* Params: (const this, const msg_id[], const char msg_verbose[], pitch, bool:showIcon)
|
* Params: (const this, const msg_id[], const msg_verbose[], pitch, bool:showIcon)
|
||||||
*/
|
*/
|
||||||
RG_CBasePlayer_Radio,
|
RG_CBasePlayer_Radio,
|
||||||
|
|
||||||
|
@ -208,6 +208,7 @@
|
|||||||
<ClInclude Include="..\src\mods\mod_rehlds_api.h" />
|
<ClInclude Include="..\src\mods\mod_rehlds_api.h" />
|
||||||
<ClInclude Include="..\src\mods\mod_reunion_api.h" />
|
<ClInclude Include="..\src\mods\mod_reunion_api.h" />
|
||||||
<ClInclude Include="..\src\mods\mod_vtc_api.h" />
|
<ClInclude Include="..\src\mods\mod_vtc_api.h" />
|
||||||
|
<ClInclude Include="..\src\natives\natives_common.h" />
|
||||||
<ClInclude Include="..\src\natives\natives_helper.h" />
|
<ClInclude Include="..\src\natives\natives_helper.h" />
|
||||||
<ClInclude Include="..\src\natives\natives_hookchains.h" />
|
<ClInclude Include="..\src\natives\natives_hookchains.h" />
|
||||||
<ClInclude Include="..\src\natives\natives_members.h" />
|
<ClInclude Include="..\src\natives\natives_members.h" />
|
||||||
@ -250,6 +251,7 @@
|
|||||||
<ClCompile Include="..\src\mods\mod_rehlds_api.cpp" />
|
<ClCompile Include="..\src\mods\mod_rehlds_api.cpp" />
|
||||||
<ClCompile Include="..\src\mods\mod_reunion_api.cpp" />
|
<ClCompile Include="..\src\mods\mod_reunion_api.cpp" />
|
||||||
<ClCompile Include="..\src\mods\mod_vtc_api.cpp" />
|
<ClCompile Include="..\src\mods\mod_vtc_api.cpp" />
|
||||||
|
<ClCompile Include="..\src\natives\natives_common.cpp" />
|
||||||
<ClCompile Include="..\src\natives\natives_hookchains.cpp" />
|
<ClCompile Include="..\src\natives\natives_hookchains.cpp" />
|
||||||
<ClCompile Include="..\src\natives\natives_members.cpp" />
|
<ClCompile Include="..\src\natives\natives_members.cpp" />
|
||||||
<ClCompile Include="..\src\natives\natives_misc.cpp" />
|
<ClCompile Include="..\src\natives\natives_misc.cpp" />
|
||||||
|
@ -666,6 +666,9 @@
|
|||||||
<ClInclude Include="..\version\appversion.h">
|
<ClInclude Include="..\version\appversion.h">
|
||||||
<Filter>version</Filter>
|
<Filter>version</Filter>
|
||||||
</ClInclude>
|
</ClInclude>
|
||||||
|
<ClInclude Include="..\src\natives\natives_common.h">
|
||||||
|
<Filter>src\natives</Filter>
|
||||||
|
</ClInclude>
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<ClCompile Include="..\include\cssdk\common\parsemsg.cpp">
|
<ClCompile Include="..\include\cssdk\common\parsemsg.cpp">
|
||||||
@ -749,6 +752,9 @@
|
|||||||
<ClCompile Include="..\version\version.cpp">
|
<ClCompile Include="..\version\version.cpp">
|
||||||
<Filter>version</Filter>
|
<Filter>version</Filter>
|
||||||
</ClCompile>
|
</ClCompile>
|
||||||
|
<ClCompile Include="..\src\natives\natives_common.cpp">
|
||||||
|
<Filter>src\natives</Filter>
|
||||||
|
</ClCompile>
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<None Include="..\extra\amxmodx\scripting\include\reapi.inc">
|
<None Include="..\extra\amxmodx\scripting\include\reapi.inc">
|
||||||
|
@ -165,6 +165,7 @@ C_DLLEXPORT int AMXX_Attach(PFN_REQ_FNPTR reqFnptrFunc)
|
|||||||
RegisterNatives_Members();
|
RegisterNatives_Members();
|
||||||
RegisterNatives_Misc();
|
RegisterNatives_Misc();
|
||||||
RegisterNatives_Addons();
|
RegisterNatives_Addons();
|
||||||
|
RegisterNatives_Common();
|
||||||
|
|
||||||
return AMXX_OK;
|
return AMXX_OK;
|
||||||
}
|
}
|
||||||
|
@ -8,24 +8,24 @@
|
|||||||
#define decltypefx(cx, pref, dt, mx) decltype(cx::pref##mx)
|
#define decltypefx(cx, pref, dt, mx) decltype(cx::pref##mx)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#define CLASS_MEMBERS(cx, mx, postf, pref, mtbl) ((!(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;ptr->table = memberlist_t::members_tables_e::mtbl;}) : regmember(#pref#mx)
|
#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, , mt_gamerules)
|
#define GM_MEMBERS(mx) CLASS_MEMBERS(CHalfLifeMultiplay, mx, mx,)
|
||||||
#define GM_VOICE_MEMBERS(mx) CLASS_MEMBERS(CHalfLifeMultiplay, mx, mx, m_VoiceGameMgr., mt_gamerules)
|
#define GM_VOICE_MEMBERS(mx) CLASS_MEMBERS(CHalfLifeMultiplay, mx, mx, m_VoiceGameMgr.)
|
||||||
#define BASE_MEMBERS(mx) CLASS_MEMBERS(CBaseEntity, mx, mx, , mt_base)
|
#define BASE_MEMBERS(mx) CLASS_MEMBERS(CBaseEntity, mx, mx,)
|
||||||
#define ANIM_MEMBERS(mx) CLASS_MEMBERS(CBaseAnimating, mx, mx, , mt_animating)
|
#define ANIM_MEMBERS(mx) CLASS_MEMBERS(CBaseAnimating, mx, mx,)
|
||||||
#define MONST_MEMBERS(mx) CLASS_MEMBERS(CBaseMonster, mx, mx, , mt_basemonster)
|
#define MONST_MEMBERS(mx) CLASS_MEMBERS(CBaseMonster, mx, mx,)
|
||||||
#define PL_MEMBERS(mx) CLASS_MEMBERS(CBasePlayer, mx, mx, , mt_player)
|
#define PL_MEMBERS(mx) CLASS_MEMBERS(CBasePlayer, mx, mx,)
|
||||||
#define EVAR_MEMBERS(mx) CLASS_MEMBERS(com_entvars, mx, var_##mx, , mt_entvars)
|
#define EVAR_MEMBERS(mx) CLASS_MEMBERS(com_entvars, mx, var_##mx,)
|
||||||
#define PMOVE_MEMBERS(mx) CLASS_MEMBERS(com_playermove, mx, pm_##mx, , mt_playermove)
|
#define PMOVE_MEMBERS(mx) CLASS_MEMBERS(com_playermove, mx, pm_##mx,)
|
||||||
#define MOVEVAR_MEMBERS(mx) CLASS_MEMBERS(movevars_t, mx, mv_##mx, , mt_movevars)
|
#define MOVEVAR_MEMBERS(mx) CLASS_MEMBERS(movevars_t, mx, mv_##mx,)
|
||||||
#define UCMD_MEMBERS(mx) CLASS_MEMBERS(usercmd_s, mx, ucmd_##mx, , mt_usercmd)
|
#define UCMD_MEMBERS(mx) CLASS_MEMBERS(usercmd_s, mx, ucmd_##mx,)
|
||||||
#define PMTRACE_MEMBERS(mx) CLASS_MEMBERS(pmtrace_s, mx, pmt_##mx, , mt_pmtrace)
|
#define PMTRACE_MEMBERS(mx) CLASS_MEMBERS(pmtrace_s, mx, pmt_##mx,)
|
||||||
#define CSPL_MEMBERS(mx) CLASS_MEMBERS(CCSPlayer, mx, mx, , mt_csplayer)
|
#define CSPL_MEMBERS(mx) CLASS_MEMBERS(CCSPlayer, mx, mx,)
|
||||||
#define BASEITEM_MEMBERS(mx) CLASS_MEMBERS(CBasePlayerItem, mx, mx, , mt_baseitem)
|
#define BASEITEM_MEMBERS(mx) CLASS_MEMBERS(CBasePlayerItem, mx, mx,)
|
||||||
#define BASEWPN_MEMBERS(mx) CLASS_MEMBERS(CBasePlayerWeapon, mx, m_Weapon_##mx, m_, mt_baseweapon)
|
#define BASEWPN_MEMBERS(mx) CLASS_MEMBERS(CBasePlayerWeapon, mx, m_Weapon_##mx, m_)
|
||||||
#define WPNBOX_MEMBERS(mx) CLASS_MEMBERS(CWeaponBox_COM, mx, m_WeaponBox_##mx, m_, mt_weaponbox)
|
#define WPNBOX_MEMBERS(mx) CLASS_MEMBERS(CWeaponBox_COM, mx, m_WeaponBox_##mx, m_)
|
||||||
#define ARMOURY_MEMBERS(mx) CLASS_MEMBERS(CArmoury, mx, m_Armoury_##mx, m_, mt_armoury)
|
#define ARMOURY_MEMBERS(mx) CLASS_MEMBERS(CArmoury, mx, m_Armoury_##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; }
|
||||||
|
@ -52,7 +52,7 @@ struct memberlist_t
|
|||||||
|
|
||||||
struct member_t
|
struct member_t
|
||||||
{
|
{
|
||||||
bool hasTable(memberlist_t::members_tables_e tbl) const;
|
bool hasTable(size_t members, memberlist_t::members_tables_e tbl) const;
|
||||||
bool isTypeReturnable() const;
|
bool isTypeReturnable() const;
|
||||||
|
|
||||||
uint16 size;
|
uint16 size;
|
||||||
@ -60,11 +60,11 @@ struct member_t
|
|||||||
uint32 offset;
|
uint32 offset;
|
||||||
const char *name;
|
const char *name;
|
||||||
MType type;
|
MType type;
|
||||||
memberlist_t::members_tables_e table;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
inline bool member_t::hasTable(memberlist_t::members_tables_e tbl) const
|
inline bool member_t::hasTable(size_t members, memberlist_t::members_tables_e tbl) const
|
||||||
{
|
{
|
||||||
|
const auto table = memberlist_t::members_tables_e(members / MAX_REGION_RANGE);
|
||||||
if (likely(table != tbl))
|
if (likely(table != tbl))
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
|
125
reapi/src/natives/natives_common.cpp
Normal file
125
reapi/src/natives/natives_common.cpp
Normal file
@ -0,0 +1,125 @@
|
|||||||
|
#include "precompiled.h"
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Compares the entity to specified a classname.
|
||||||
|
* @note This native also checks the validity of an entity.
|
||||||
|
*
|
||||||
|
* @return true/false
|
||||||
|
*
|
||||||
|
* native bool:FClassnameIs(const entityIndex, const className[]);
|
||||||
|
*/
|
||||||
|
cell AMX_NATIVE_CALL amx_FClassnameIs(AMX *amx, cell *params)
|
||||||
|
{
|
||||||
|
enum args_e { arg_count, arg_index, arg_classname };
|
||||||
|
|
||||||
|
int nEntityIndex = params[arg_index];
|
||||||
|
if (nEntityIndex < 0 || nEntityIndex > gpGlobals->maxEntities) {
|
||||||
|
return FALSE;
|
||||||
|
}
|
||||||
|
|
||||||
|
edict_t *pEdict = edictByIndex(nEntityIndex);
|
||||||
|
if (pEdict && FClassnameIs(pEdict, getAmxString(amx, params[arg_classname]))) {
|
||||||
|
return TRUE;
|
||||||
|
}
|
||||||
|
|
||||||
|
return FALSE;
|
||||||
|
}
|
||||||
|
|
||||||
|
AMX_NATIVE_INFO Natives_Common[] =
|
||||||
|
{
|
||||||
|
{ "FClassnameIs", amx_FClassnameIs },
|
||||||
|
|
||||||
|
{ nullptr, nullptr }
|
||||||
|
};
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Check if the entity is valid
|
||||||
|
*
|
||||||
|
* @return true/false
|
||||||
|
*
|
||||||
|
* native bool:is_entity(const entityIndex);
|
||||||
|
*/
|
||||||
|
cell AMX_NATIVE_CALL is_entity(AMX *amx, cell *params)
|
||||||
|
{
|
||||||
|
enum args_e { arg_count, arg_index };
|
||||||
|
|
||||||
|
int nIndex = params[arg_index];
|
||||||
|
if (nIndex < 0 || nIndex > gpGlobals->maxEntities) {
|
||||||
|
return FALSE;
|
||||||
|
}
|
||||||
|
|
||||||
|
auto pEntity = getPrivate<CBaseEntity>(nIndex);
|
||||||
|
if (!pEntity) {
|
||||||
|
return FALSE;
|
||||||
|
}
|
||||||
|
|
||||||
|
// if it is the index of the player
|
||||||
|
if (pEntity->IsPlayer() && pEntity->has_disconnected) {
|
||||||
|
return FALSE;
|
||||||
|
}
|
||||||
|
|
||||||
|
return TRUE;
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Check if the rehlds is available
|
||||||
|
*
|
||||||
|
* @return true/false
|
||||||
|
*
|
||||||
|
* native bool:is_rehlds();
|
||||||
|
*/
|
||||||
|
cell AMX_NATIVE_CALL is_rehlds(AMX *amx, cell *params)
|
||||||
|
{
|
||||||
|
return (cell)api_cfg.hasReHLDS();
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Check if the regamedll is available
|
||||||
|
*
|
||||||
|
* @return true/false
|
||||||
|
*
|
||||||
|
* native bool:is_regamedll();
|
||||||
|
*/
|
||||||
|
cell AMX_NATIVE_CALL is_regamedll(AMX *amx, cell *params)
|
||||||
|
{
|
||||||
|
return (cell)api_cfg.hasReGameDLL();
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Check if the reunion is available
|
||||||
|
*
|
||||||
|
* @return true/false
|
||||||
|
*
|
||||||
|
* native bool:is_has_reunion();
|
||||||
|
*/
|
||||||
|
cell AMX_NATIVE_CALL has_reunion(AMX *amx, cell *params)
|
||||||
|
{
|
||||||
|
return (cell)api_cfg.hasReunion();
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Check if the vtc is available
|
||||||
|
*
|
||||||
|
* @return true/false
|
||||||
|
*
|
||||||
|
* native bool:is_has_vtc();
|
||||||
|
*/
|
||||||
|
cell AMX_NATIVE_CALL has_vtc(AMX *amx, cell *params)
|
||||||
|
{
|
||||||
|
return (cell)api_cfg.hasVTC();
|
||||||
|
}
|
||||||
|
|
||||||
|
AMX_NATIVE_INFO Natives_Checks[] =
|
||||||
|
{
|
||||||
|
{ "is_entity", is_entity },
|
||||||
|
{ "is_rehlds", is_rehlds },
|
||||||
|
{ "is_regamedll", is_regamedll },
|
||||||
|
{ "has_reunion", has_reunion },
|
||||||
|
{ "has_vtc", has_vtc }
|
||||||
|
};
|
||||||
|
|
||||||
|
void RegisterNatives_Common()
|
||||||
|
{
|
||||||
|
g_amxxapi.AddNatives(Natives_Common);
|
||||||
|
g_amxxapi.AddNatives(Natives_Checks);
|
||||||
|
}
|
3
reapi/src/natives/natives_common.h
Normal file
3
reapi/src/natives/natives_common.h
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
#pragma once
|
||||||
|
|
||||||
|
void RegisterNatives_Common();
|
@ -20,7 +20,7 @@ cell AMX_NATIVE_CALL set_member(AMX *amx, cell *params)
|
|||||||
cell* value = getAmxAddr(amx, params[arg_value]);
|
cell* value = getAmxAddr(amx, params[arg_value]);
|
||||||
size_t element = (PARAMS_COUNT == 4) ? *getAmxAddr(amx, params[arg_elem]) : 0;
|
size_t element = (PARAMS_COUNT == 4) ? *getAmxAddr(amx, params[arg_elem]) : 0;
|
||||||
|
|
||||||
if (member->hasTable(memberlist_t::mt_csplayer)) {
|
if (member->hasTable(params[arg_member], memberlist_t::mt_csplayer)) {
|
||||||
CBasePlayer *pPlayer = (CBasePlayer *)pEdict->pvPrivateData;
|
CBasePlayer *pPlayer = (CBasePlayer *)pEdict->pvPrivateData;
|
||||||
if (unlikely(pPlayer->CSPlayer() == nullptr)) {
|
if (unlikely(pPlayer->CSPlayer() == nullptr)) {
|
||||||
return FALSE;
|
return FALSE;
|
||||||
@ -86,7 +86,7 @@ cell AMX_NATIVE_CALL get_member(AMX *amx, cell *params)
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (member->hasTable(memberlist_t::mt_csplayer)) {
|
if (member->hasTable(params[arg_member], memberlist_t::mt_csplayer)) {
|
||||||
CBasePlayer *pPlayer = (CBasePlayer *)pEdict->pvPrivateData;
|
CBasePlayer *pPlayer = (CBasePlayer *)pEdict->pvPrivateData;
|
||||||
if (unlikely(pPlayer->CSPlayer() == nullptr)) {
|
if (unlikely(pPlayer->CSPlayer() == nullptr)) {
|
||||||
return FALSE;
|
return FALSE;
|
||||||
|
@ -1338,10 +1338,9 @@ cell AMX_NATIVE_CALL rg_transfer_c4(AMX *amx, cell *params)
|
|||||||
CBasePlayer *pReceiver = UTIL_PlayerByIndex(params[arg_receiver]);
|
CBasePlayer *pReceiver = UTIL_PlayerByIndex(params[arg_receiver]);
|
||||||
CHECK_CONNECTED(pReceiver, arg_receiver);
|
CHECK_CONNECTED(pReceiver, arg_receiver);
|
||||||
|
|
||||||
pReceiver->m_bHasC4 = true;
|
if (!pReceiver->CSPlayer()->MakeBomber())
|
||||||
pReceiver->CSPlayer()->GiveNamedItemEx("weapon_c4");
|
return FALSE;
|
||||||
pReceiver->CSPlayer()->SetBombIcon();
|
|
||||||
pReceiver->pev->body = 1;
|
|
||||||
} else {
|
} else {
|
||||||
auto flags = pPlayer->pev->flags;
|
auto flags = pPlayer->pev->flags;
|
||||||
pPlayer->pev->flags |= FL_DORMANT;
|
pPlayer->pev->flags |= FL_DORMANT;
|
||||||
@ -1663,7 +1662,7 @@ cell AMX_NATIVE_CALL rg_reset_maxspeed(AMX *amx, cell *params)
|
|||||||
*
|
*
|
||||||
* @noreturn
|
* @noreturn
|
||||||
*
|
*
|
||||||
* native rg_send_bartime(const index, const Float:duration, const bool:observer = true);
|
* native rg_send_bartime(const index, const duration, const bool:observer = true);
|
||||||
*/
|
*/
|
||||||
cell AMX_NATIVE_CALL rg_send_bartime(AMX *amx, cell *params)
|
cell AMX_NATIVE_CALL rg_send_bartime(AMX *amx, cell *params)
|
||||||
{
|
{
|
||||||
@ -1694,7 +1693,7 @@ cell AMX_NATIVE_CALL rg_send_bartime(AMX *amx, cell *params)
|
|||||||
*
|
*
|
||||||
* @noreturn
|
* @noreturn
|
||||||
*
|
*
|
||||||
* native rg_send_bartime2(const index, const Float:duration, const Float:startPercent, const bool:observer = true);
|
* native rg_send_bartime2(const index, const duration, const startPercent, const bool:observer = true);
|
||||||
*/
|
*/
|
||||||
cell AMX_NATIVE_CALL rg_send_bartime2(AMX *amx, cell *params)
|
cell AMX_NATIVE_CALL rg_send_bartime2(AMX *amx, cell *params)
|
||||||
{
|
{
|
||||||
@ -1960,92 +1959,6 @@ AMX_NATIVE_INFO Misc_Natives_RH[] =
|
|||||||
{ nullptr, nullptr }
|
{ nullptr, nullptr }
|
||||||
};
|
};
|
||||||
|
|
||||||
/*
|
|
||||||
* Check if the entity is valid
|
|
||||||
*
|
|
||||||
* @return true/false
|
|
||||||
*
|
|
||||||
* native bool:is_entity(const entityIndex);
|
|
||||||
*/
|
|
||||||
cell AMX_NATIVE_CALL is_entity(AMX *amx, cell *params)
|
|
||||||
{
|
|
||||||
enum args_e { arg_count, arg_index };
|
|
||||||
|
|
||||||
int nIndex = params[arg_index];
|
|
||||||
if (nIndex < 0 || nIndex > gpGlobals->maxEntities) {
|
|
||||||
return FALSE;
|
|
||||||
}
|
|
||||||
|
|
||||||
auto pEntity = getPrivate<CBaseEntity>(nIndex);
|
|
||||||
if (!pEntity) {
|
|
||||||
return FALSE;
|
|
||||||
}
|
|
||||||
|
|
||||||
// if it is the index of the player
|
|
||||||
if (pEntity->IsPlayer() && pEntity->has_disconnected) {
|
|
||||||
return FALSE;
|
|
||||||
}
|
|
||||||
|
|
||||||
return TRUE;
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Check if the rehlds is available
|
|
||||||
*
|
|
||||||
* @return true/false
|
|
||||||
*
|
|
||||||
* native bool:is_rehlds();
|
|
||||||
*/
|
|
||||||
cell AMX_NATIVE_CALL is_rehlds(AMX *amx, cell *params)
|
|
||||||
{
|
|
||||||
return (cell)api_cfg.hasReHLDS();
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Check if the regamedll is available
|
|
||||||
*
|
|
||||||
* @return true/false
|
|
||||||
*
|
|
||||||
* native bool:is_regamedll();
|
|
||||||
*/
|
|
||||||
cell AMX_NATIVE_CALL is_regamedll(AMX *amx, cell *params)
|
|
||||||
{
|
|
||||||
return (cell)api_cfg.hasReGameDLL();
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Check if the reunion is available
|
|
||||||
*
|
|
||||||
* @return true/false
|
|
||||||
*
|
|
||||||
* native bool:is_has_reunion();
|
|
||||||
*/
|
|
||||||
cell AMX_NATIVE_CALL has_reunion(AMX *amx, cell *params)
|
|
||||||
{
|
|
||||||
return (cell)api_cfg.hasReunion();
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Check if the vtc is available
|
|
||||||
*
|
|
||||||
* @return true/false
|
|
||||||
*
|
|
||||||
* native bool:is_has_vtc();
|
|
||||||
*/
|
|
||||||
cell AMX_NATIVE_CALL has_vtc(AMX *amx, cell *params)
|
|
||||||
{
|
|
||||||
return (cell)api_cfg.hasVTC();
|
|
||||||
}
|
|
||||||
|
|
||||||
AMX_NATIVE_INFO Misc_Natives_Checks[] =
|
|
||||||
{
|
|
||||||
{ "is_entity", is_entity },
|
|
||||||
{ "is_rehlds", is_rehlds },
|
|
||||||
{ "is_regamedll", is_regamedll },
|
|
||||||
{ "has_reunion", has_reunion },
|
|
||||||
{ "has_vtc", has_vtc }
|
|
||||||
};
|
|
||||||
|
|
||||||
void RegisterNatives_Misc()
|
void RegisterNatives_Misc()
|
||||||
{
|
{
|
||||||
if (!api_cfg.hasReGameDLL())
|
if (!api_cfg.hasReGameDLL())
|
||||||
@ -2056,5 +1969,4 @@ void RegisterNatives_Misc()
|
|||||||
|
|
||||||
g_amxxapi.AddNatives(Misc_Natives_RG);
|
g_amxxapi.AddNatives(Misc_Natives_RG);
|
||||||
g_amxxapi.AddNatives(Misc_Natives_RH);
|
g_amxxapi.AddNatives(Misc_Natives_RH);
|
||||||
g_amxxapi.AddNatives(Misc_Natives_Checks);
|
|
||||||
}
|
}
|
||||||
|
@ -60,5 +60,6 @@
|
|||||||
#include "natives_hookchains.h"
|
#include "natives_hookchains.h"
|
||||||
#include "natives_members.h"
|
#include "natives_members.h"
|
||||||
#include "natives_misc.h"
|
#include "natives_misc.h"
|
||||||
|
#include "natives_common.h"
|
||||||
#include "natives_addons.h"
|
#include "natives_addons.h"
|
||||||
#include "natives_helper.h"
|
#include "natives_helper.h"
|
||||||
|
Loading…
x
Reference in New Issue
Block a user