[INC/STOCK] Calculate Player TakeDamage

For scripting examples for learning how to use AMXX.
User avatar
Archive-Poster
Posts: 1267
Gender:
United States of America

[INC/STOCK] Calculate Player TakeDamage

Post by Archive-Poster »

Calculate Player TakeDamage
- last updated : 03 may 2017

Ever wanted to know what is the final Player TakeDamage on CS before the damage is actually applied ?
This stock mimic the player.cpp TakeDamage way of calculation of damage Before the damage is actually applied.

Code: Select all

Calculate_Player_TakeDamage(Victim, Inflictor, Attacker, Float:flDamage, bitsDamageType, &Float:flCalcDamage = 0.0, &Float:flCalcArmorHit = 0.0)
This is useful if you want to do something depending of the real damage before it's actually applied.
If flCalcDamage is >= player health, the player will die, if flCalcArmorHit >= player float armorvalue, the player will lost all his armor.

This stock respects the player.cpp calls, in order to keep the calls as close as possible of the game way.

If the damage is blocked (IE friendlyfire) Calculate_Player_TakeDamage will return false and calc values will be zero, otherwise the function will return true and the real calc values.

This stock support mp_freeforall cvar from CSDM and ReGameDll bugfixed.

Note: This stock only work with amxmodx 1.8.3
Attachments
test_player_takedamage.sma.zip
(746 Bytes) Downloaded 5 times
player_takedamage.inc.zip
(1.99 KiB) Downloaded 5 times

Who is online

Users browsing this forum: No registered users and 1 guest