2
0
mirror of https://github.com/rehlds/reapi.git synced 2024-12-27 23:25:30 +03:00

Add API check if is player can respawn (#174)

This commit is contained in:
fl0werD 2020-11-30 12:37:03 +04:00 committed by GitHub
parent 623a4f2236
commit 9e16f2769a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 35 additions and 3 deletions

View File

@ -1,3 +1,3 @@
majorVersion=5
minorVersion=16
minorVersion=17
maintenanceVersion=0

View File

@ -741,10 +741,19 @@ native TeamName:rg_get_join_team_priority();
* @param index Client index
* @param attacker Attacker index
*
* @return true if he can take damage, false otherwise
* @return true if player can take damage, false otherwise
*/
native bool:rg_is_player_can_takedamage(const index, const attacker);
/*
* Checks whether the player can respawn.
*
* @param index Client index
*
* @return true if player can respawn, false otherwise
*/
native bool:rg_is_player_can_respawn(const index);
/*
* Gets WeaponIdType from weaponbox
*

View File

@ -1775,7 +1775,7 @@ cell AMX_NATIVE_CALL rg_get_join_team_priority(AMX *amx, cell *params)
* @param index Client index
* @param attacker Attacker index
*
* @return true if he can take damage, false otherwise
* @return true if player can take damage, false otherwise
*
* native bool:rg_is_player_can_takedamage(const index, const attacker);
*/
@ -1798,6 +1798,28 @@ cell AMX_NATIVE_CALL rg_is_player_can_takedamage(AMX *amx, cell *params)
return CSGameRules()->FPlayerCanTakeDamage(pPlayer, pAttacker);
}
/*
* Checks whether the player can respawn.
*
* @param index Client index
*
* @return true if player can respawn, false otherwise
*
* native bool:rg_is_player_can_respawn(const index);
*/
cell AMX_NATIVE_CALL rg_is_player_can_respawn(AMX *amx, cell *params)
{
enum args_e { arg_count, arg_index };
CHECK_GAMERULES();
CHECK_ISPLAYER(arg_index);
CBasePlayer *pPlayer = UTIL_PlayerByIndex(params[arg_index]);
CHECK_CONNECTED(pPlayer, arg_index);
return CSGameRules()->FPlayerCanRespawn(pPlayer);
}
/*
* Gets WeaponIdType from weaponbox
*
@ -2361,6 +2383,7 @@ AMX_NATIVE_INFO Misc_Natives_RG[] =
{ "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_is_player_can_respawn", rg_is_player_can_respawn },
{ "rg_get_weaponbox_id", rg_get_weaponbox_id },
{ "rg_round_respawn", rg_round_respawn },
{ "rg_reset_maxspeed", rg_reset_maxspeed },