Hey all
I'm just trying to make someone invulnerable for a single shot (telling them they dodged it)... here's my code, not sure how it works. (I tried calling godmode from damageevent, but problem is they already do damage, then damageevent is not called again cuz they are god)
Code:
public client_PreThink(id)
{
if(entity_get_int(id, EV_INT_button) & ~IN_ATTACK)
{
new Enemy = id, Victim
new Float:Distance = get_user_aiming(id, Victim)
new EnemyName[34], VictimName[34]
get_user_name(Enemy, EnemyName, 33)
get_user_name(Victim, VictimName, 33)
//evade
new DodgeChance = random_num(0, 100)
new DodgeMod = (PlayerSkill[Victim][SKILL_DODGE] - PlayerSkill[Enemy][SKILL_TRUESHOT])
if(DodgeMod >= DodgeChance)
{
client_print(Victim, print_chat, "You dodged a shot by %s!", EnemyName)
client_print(0, print_console, "DodgeMod(%i)/DodgeChance(%i) = SUCCESS!", DodgeMod, DodgeChance)
client_print(Enemy, print_chat, "%s dodged your shot!", VictimName)
set_user_godmode (Victim, 1)
return PLUGIN_HANDLED
}
else
{
client_print(0, print_console, "Skill(%i)/DodgeChance(%i) = FAILURE!", PlayerSkill[Victim][SKILL_DODGE], DodgeChance)
set_user_godmode(Victim)
return PLUGIN_HANDLED
}
}
}
Any idea whats wrong/how i can fix it/ a better way to do this?
__________________
"What then is truth? Truths are illusions which we have forgotten are illusions - they are metaphors that have become worn out... this (truth) is the duty to lie according to a fixed convention.
-Friedrich Nietzsche