2
0
mirror of https://github.com/s1lentq/reapi.git synced 2024-10-16 15:27:06 +03:00

API: Added rg_player_relationship native (#304)

This commit is contained in:
肯定龙 2024-01-31 08:56:38 -04:00 committed by GitHub
parent 016a08a58a
commit 55151847af
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 47 additions and 0 deletions

View File

@ -1539,3 +1539,15 @@ enum Decal
DECAL_MOMMABIRTH, // Big momma birth splatter
DECAL_MOMMASPLAT,
};
/**
* Player relationship return codes
*/
enum
{
GR_NOTTEAMMATE = 0,
GR_TEAMMATE,
GR_ENEMY,
GR_ALLY,
GR_NEUTRAL,
};

View File

@ -1195,3 +1195,13 @@ native rg_set_observer_mode(const player, const mode);
* @noreturn
*/
native rg_death_notice(const pVictim, const pKiller, const pevInflictor);
/*
* Checks a player relationship with another reference
*
* @param player Player index
* @param target Target index
*
* @return Match player relationship, see GR_* constants in cssdk_const.inc
*/
native rg_player_relationship(const player, const target);

View File

@ -3225,6 +3225,30 @@ cell AMX_NATIVE_CALL rg_death_notice(AMX* amx, cell* params)
return TRUE;
}
/*
* Checks a player relationship with another reference
*
* @param player Player index
* @param target Target index
*
* @return Match player relationship, see GR_* constants in cssdk_const.inc
*/
cell AMX_NATIVE_CALL rg_player_relationship(AMX *amx, cell *params)
{
enum args_e { arg_count, arg_player, arg_target };
CHECK_GAMERULES();
CHECK_ISPLAYER(arg_player);
CHECK_ISENTITY(arg_target);
CBasePlayer *pPlayer = UTIL_PlayerByIndex(params[arg_player]);
CHECK_CONNECTED(pPlayer, arg_player);
CBaseEntity *pTarget = getPrivate<CBaseEntity>(params[arg_target]);
return CSGameRules()->PlayerRelationship(pPlayer, pTarget);
}
AMX_NATIVE_INFO Misc_Natives_RG[] =
{
{ "rg_set_animation", rg_set_animation },
@ -3336,6 +3360,7 @@ AMX_NATIVE_INFO Misc_Natives_RG[] =
{ "rg_disappear", rg_disappear },
{ "rg_set_observer_mode", rg_set_observer_mode },
{ "rg_death_notice", rg_death_notice },
{ "rg_player_relationship", rg_player_relationship },
{ nullptr, nullptr }
};