mirror of
https://github.com/rehlds/reapi.git
synced 2025-04-15 05:42:44 +03:00
Add new native rg_observer_find_next_player
(#345)
This commit is contained in:
parent
5fa7a8368e
commit
6dffaef1d5
@ -1185,6 +1185,18 @@ native rg_disappear(const player);
|
||||
*/
|
||||
native rg_set_observer_mode(const player, const mode);
|
||||
|
||||
/*
|
||||
* Call origin function CBasePlayer::Observer_FindNextPlayer()
|
||||
* @note Player must be a valid observer (m_afPhysicsFlags & PFLAG_OBSERVER).
|
||||
*
|
||||
* @param player Player index.
|
||||
* @param bReverse If bReverse is true, finding order will be reversed
|
||||
* @param name Player name to find.
|
||||
*
|
||||
* @noreturn
|
||||
*/
|
||||
native rg_observer_find_next_player(const player, const bool:bReverse = false, const name[] = "");
|
||||
|
||||
/*
|
||||
* Emits a death notice (logs, DeathMsg event, win conditions check)
|
||||
*
|
||||
|
@ -118,6 +118,7 @@ public:
|
||||
virtual void Reset() = 0;
|
||||
virtual void OnSpawnEquip(bool addDefault = true, bool equipGame = true) = 0;
|
||||
virtual void SetScoreboardAttributes(CBasePlayer *destination = nullptr) = 0;
|
||||
virtual void Observer_FindNextPlayer(bool bReverse, const char *name = nullptr) = 0;
|
||||
|
||||
CBasePlayer *BasePlayer() const;
|
||||
|
||||
|
@ -40,7 +40,7 @@
|
||||
#include <API/CSInterfaces.h>
|
||||
|
||||
#define REGAMEDLL_API_VERSION_MAJOR 5
|
||||
#define REGAMEDLL_API_VERSION_MINOR 27
|
||||
#define REGAMEDLL_API_VERSION_MINOR 29
|
||||
|
||||
// CBasePlayer::Spawn hook
|
||||
typedef IHookChainClass<void, class CBasePlayer> IReGameHook_CBasePlayer_Spawn;
|
||||
|
@ -3244,6 +3244,34 @@ cell AMX_NATIVE_CALL rg_set_observer_mode(AMX* amx, cell* params)
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
/*
|
||||
* Call origin function CBasePlayer::Observer_FindNextPlayer()
|
||||
* @note Player must be a valid observer (m_afPhysicsFlags & PFLAG_OBSERVER).
|
||||
*
|
||||
* @param player Player index.
|
||||
* @param bReverse If bReverse is true, finding order will be reversed
|
||||
* @param name Player name to find.
|
||||
*
|
||||
* @noreturn
|
||||
*/
|
||||
cell AMX_NATIVE_CALL rg_observer_find_next_player(AMX* amx, cell* params)
|
||||
{
|
||||
enum args_e { arg_count, arg_index, arg_bReverse, arg_name };
|
||||
|
||||
CHECK_ISPLAYER(arg_index)
|
||||
|
||||
CBasePlayer *pPlayer = UTIL_PlayerByIndex(params[arg_index]);
|
||||
CHECK_CONNECTED(pPlayer, arg_index);
|
||||
|
||||
char nameBuf[MAX_PLAYER_NAME_LENGTH];
|
||||
const char* name = getAmxString(amx, params[arg_name], nameBuf);
|
||||
if (strcmp(name, "") == 0)
|
||||
name = nullptr;
|
||||
|
||||
pPlayer->CSPlayer()->Observer_FindNextPlayer(params[arg_bReverse] != 0, name);
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
/*
|
||||
* Emits a death notice (logs, DeathMsg event, win conditions check)
|
||||
*
|
||||
@ -3457,6 +3485,7 @@ AMX_NATIVE_INFO Misc_Natives_RG[] =
|
||||
{ "rg_switch_best_weapon", rg_switch_best_weapon },
|
||||
{ "rg_disappear", rg_disappear },
|
||||
{ "rg_set_observer_mode", rg_set_observer_mode },
|
||||
{ "rg_observer_find_next_player", rg_observer_find_next_player },
|
||||
{ "rg_death_notice", rg_death_notice },
|
||||
{ "rg_player_relationship", rg_player_relationship },
|
||||
|
||||
|
@ -6,5 +6,5 @@
|
||||
#pragma once
|
||||
|
||||
#define VERSION_MAJOR 5
|
||||
#define VERSION_MINOR 26
|
||||
#define VERSION_MINOR 27
|
||||
#define VERSION_MAINTENANCE 0
|
||||
|
Loading…
x
Reference in New Issue
Block a user