Thanks. Another question.
Code:
#include <amxmodx>
#include <fakemeta>
#include <hamsandwich>
new g_bCritHit[33];
public plugin_init()
{
RegisterHam(Ham_TakeDamage, "player", "hTakeDamagePre");
RegisterHam(Ham_TakeDamage, "player", "hTakeDamagePost", 1);
}
public hTakeDamagePre(iVictim, iInflictor, iAttacker, Float:fDmg)
{
new iRandom = random_num(0, 100);
if (iRandom < 15) // 15% of success
{
g_bCritHit[iAttacker] = true;
new fMultiplier = random_float(1.5, 2.5);
SetHamParamFloat(4, fDmg * fMultiplier);
}
}
public hTakeDamagePost(iVictim, iInflictor, iAttacker, Float:fDmg)
{
if (g_bCritHit[iAttacker])
{
pev(iVictim, pev_dmg_take, fDmg);
client_print(iAttacker, print_chat, "You've made a critical hit with %d damage", floatround(fDmg));
g_bCritHit[iAttacker] = false;
}
}
(example code, skipped connected/alive checks)
I want to print not only the total damage, but also the starting damage (which was multiplied) and multiplier. All in the same message.
Like this: You've made a critical hit: normal dmg: 10, dmg multiplier: 2, total dmg: 20
Of course I could do this with some global variables, but isn't there another way?
__________________