2
0
mirror of https://github.com/rehlds/reapi.git synced 2025-04-06 17:49:13 +03:00

Implementation of new Natives

This commit is contained in:
Celio Lozatto 2024-08-16 11:16:59 -03:00
commit 6b8d529d43
2 changed files with 90 additions and 10 deletions

View File

@ -1223,7 +1223,7 @@ native rg_player_relationship(const player, const target);
native rg_send_death_message(const pKiller, const pVictim, const pAssister, const pevInflictor, const killerWeaponName[], const DeathMessageFlags:iDeathMessageFlags, const KillRarity:iRarityOfKill);
/*
* -
* Usually called whenever an entity gets attacked by a hitscan (such as a gun) weapon.
*
* @param index Client index
* @param attacker Attacker index
@ -1237,7 +1237,7 @@ native rg_send_death_message(const pKiller, const pVictim, const pAssister, cons
native rg_player_traceattack(const index, const attacker, const Float:flDamage, Float:vecDir[3], const ptr, const bitsDamageType);
/*
* -
* Usually called whenever an entity takes any kind of damage.
*
* @param index Client index
* @param inflictor Inflictor index
@ -1250,7 +1250,7 @@ native rg_player_traceattack(const index, const attacker, const Float:flDamage,
native rg_player_takedamage(const index, const inflictor, const attacker, const Float:flDamage, const bitsDamageType);
/*
* -
* Usually called whenever an entity gets a form of a heal.
*
* @param index Client index
* @param flHealth The amount of health
@ -1261,7 +1261,7 @@ native rg_player_takedamage(const index, const inflictor, const attacker, const
native rg_player_takehealth(const index, const Float:flHealth, const bitsDamageType);
/*
* -
* Normally called whenever an entity dies.
*
* @param index Client index
* @param attacker Attacker index
@ -1269,10 +1269,10 @@ native rg_player_takehealth(const index, const Float:flHealth, const bitsDamageT
*
* @noreturn
*/
native rg_player_killed(const index, const attacker, const gibs);
native rg_player_killed(const index, const attacker, const gib);
/*
* -
* Typically adds points to the entity.
*
* @param index Client index
* @param score Adds the score to the current amount
@ -1283,7 +1283,8 @@ native rg_player_killed(const index, const attacker, const gibs);
native rg_player_addpoints(const index, const score, const bool:allowNegativeScore);
/*
* -
* This will never return true if a client is not connected. If you need
* to know whether a client is alive, an additional call to is_user_connected() is unnecessary.
*
* @param index Client index
*
@ -1292,7 +1293,7 @@ native rg_player_addpoints(const index, const score, const bool:allowNegativeSco
native rg_is_player_alive(const index);
/*
* -
* Whether or not the entity is a net client.
*
* @param index Client index
*
@ -1301,7 +1302,7 @@ native rg_is_player_alive(const index);
native rg_is_player_net_client(const index);
/*
* -
* returns the position in vector the exact position of the weapon in which the player is located
*
* @param index Client index
*
@ -1310,7 +1311,7 @@ native rg_is_player_net_client(const index);
native Float:[3] rg_get_player_gun_position(const index);
/*
* -
* Returns if the client is a bot.
*
* @param index Client index
*

View File

@ -3345,6 +3345,18 @@ cell AMX_NATIVE_CALL rg_send_death_message(AMX *amx, cell *params)
return TRUE;
}
/*
* Usually called whenever an entity gets attacked by a hitscan (such as a gun) weapon.
*
* @param index Client index
* @param attacker Attacker index
* @param flDamage The amount of damage
* @param vecDir Direction
* @param ptr Traceresult pointer
* @param bitsDamageType Damage type DMG_*
*
* @noreturn
*/
cell AMX_NATIVE_CALL rg_player_traceattack(AMX* amx, cell* params)
{
enum args_e { arg_count, arg_index, arg_attacker, arg_damage, arg_dir, arg_trace, arg_dmg_type };
@ -3360,6 +3372,17 @@ cell AMX_NATIVE_CALL rg_player_traceattack(AMX* amx, cell* params)
return TRUE;
}
/*
* Usually called whenever an entity takes any kind of damage.
*
* @param index Client index
* @param inflictor Inflictor index
* @param attacker Attacker index
* @param flDamage The amount of damage
* @param bitsDamageType Damage type DMG_*
*
* @return 1 on success, 0 otherwise
*/
cell AMX_NATIVE_CALL rg_player_takedamage(AMX* amx, cell* params)
{
enum args_e { arg_count, arg_index, arg_inflictor, arg_attacker, arg_damage, arg_dmg_type };
@ -3375,6 +3398,15 @@ cell AMX_NATIVE_CALL rg_player_takedamage(AMX* amx, cell* params)
return pPlayer->TakeDamage(args[arg_attacker], args[arg_inflictor], args[arg_damage], args[arg_dmg_type]);
}
/*
* Usually called whenever an entity gets a form of a heal.
*
* @param index Client index
* @param flHealth The amount of health
* @param bitsDamageType Damage type DMG_*
*
* @return 1 on success, 0 otherwise
*/
cell AMX_NATIVE_CALL rg_player_takehealth(AMX* amx, cell* params)
{
enum args_e { arg_count, arg_index, arg_health, arg_dmg_type };
@ -3388,6 +3420,15 @@ cell AMX_NATIVE_CALL rg_player_takehealth(AMX* amx, cell* params)
return pPlayer->TakeHealth(args[arg_health], args[arg_dmg_type]);
}
/*
* Normally called whenever an entity dies.
*
* @param index Client index
* @param attacker Attacker index
* @param gibs Use DMG_NEVERGIB or DMG_ALWAYSGIB
*
* @noreturn
*/
cell AMX_NATIVE_CALL rg_player_killed(AMX* amx, cell* params)
{
enum args_e { arg_count, arg_index, arg_attacker, arg_gib };
@ -3403,6 +3444,15 @@ cell AMX_NATIVE_CALL rg_player_killed(AMX* amx, cell* params)
return TRUE;
}
/*
* Typically adds points to the entity.
*
* @param index Client index
* @param score Adds the score to the current amount
* @param allowNegativeScore Allow Negative Score
*
* @noreturn
*/
cell AMX_NATIVE_CALL rg_player_addpoints(AMX* amx, cell* params)
{
enum args_e { arg_count, arg_index, arg_score, arg_allow_negative_score };
@ -3417,6 +3467,14 @@ cell AMX_NATIVE_CALL rg_player_addpoints(AMX* amx, cell* params)
return TRUE;
}
/*
* This will never return true if a client is not connected. If you need
* to know whether a client is alive, an additional call to is_user_connected() is unnecessary.
*
* @param index Client index
*
* @return 1 on success, 0 otherwise
*/
cell AMX_NATIVE_CALL rg_is_player_alive(AMX* amx, cell* params)
{
enum args_e { arg_count, arg_index };
@ -3429,6 +3487,13 @@ cell AMX_NATIVE_CALL rg_is_player_alive(AMX* amx, cell* params)
return pPlayer->IsAlive();
}
/*
* Whether or not the entity is a net client.
*
* @param index Client index
*
* @return 1 on success, 0 otherwise
*/
cell AMX_NATIVE_CALL rg_is_player_net_client(AMX* amx, cell* params)
{
enum args_e { arg_count, arg_index };
@ -3441,6 +3506,13 @@ cell AMX_NATIVE_CALL rg_is_player_net_client(AMX* amx, cell* params)
return pPlayer->IsNetClient();
}
/*
* returns the position in vector the exact position of the weapon in which the player is located
*
* @param index Client index
*
* @return Float:[3] The source position
*/
cell AMX_NATIVE_CALL rg_get_player_gun_position(AMX* amx, cell* params)
{
enum args_e { arg_count, arg_index, arg_out };
@ -3455,6 +3527,13 @@ cell AMX_NATIVE_CALL rg_get_player_gun_position(AMX* amx, cell* params)
return TRUE;
}
/*
* Returns if the client is a bot.
*
* @param index Client index
*
* @return 1 on success, 0 otherwise
*/
cell AMX_NATIVE_CALL rg_is_player_bot(AMX* amx, cell* params)
{
enum args_e { arg_count, arg_index };