public Damage(id) { if (is_user_connected(id)) { new damage = read_data(2) new bodypart new attacker_id = get_user_attacker(id,weapon,bodypart) if (is_user_connected(attacker_id) && attacker_id != id) { add_damage_bonus(id,damage,attacker_id) add_deagle_bonus(id,damage,attacker_id) add_vampire_bonus(id,damage,attacker_id) add_grenade_bonus(id,attacker_id,weapon) add_theif_bonus(id,attacker_id) add_bonus_blind(id,attacker_id,weapon,damage) add_bonus_redirect(id) add_bonus_necromancer(attacker_id,id) add_bonus_scoutdamage(attacker_id,id,weapon) add_bonus_assassin(attacker_id,id,weapon) add_bonus_darksteel(attacker_id,id,damage) add_bonus_illusion(attacker_id,id,weapon) item_take_damage(id,damage) if (player_class[attacker_id] == Paladyn){ new Float:VOLWO[3] new Float:Volvo[3] entity_get_vector(id,EV_VEC_velocity,VOLWO) entity_get_vector(attacker_id,EV_VEC_velocity,Volvo) for(new i=0;i<2;i++) VOLWO[i]+=(Volvo[i]*3.15) entity_set_vector(id,EV_VEC_velocity,VOLWO) } if(player_sword[attacker_id] == 1 && weapon==CSW_KNIFE ){ Hurt_Entity(attacker_id,id,35.0) } if (HasFlag(attacker_id,Flag_Ignite)) RemoveFlag(attacker_id,Flag_Ignite) if((HasFlag(id,Flag_Illusion) || HasFlag(id,Flag_Teamshield))&& get_user_health(id) - damage > 0) { new weaponname[32]; get_weaponname( weapon, weaponname, 31 ); replace(weaponname, 31, "weapon_", "") UTIL_Kill(attacker_id,id,weaponname) } if (HasFlag(id,Flag_Moneyshield)) { if (get_user_health(id)+damage/2 < race_heal[player_class[id]]+player_strength[id]) set_user_health(id,get_user_health(id)+damage/2) } //Add the agility damage reduction, around 45% the curve flattens if (damage > 0 && player_agility[id] > 0) { new heal = floatround(player_damreduction[id]*damage) if (is_user_alive(id)) set_user_health(id,get_user_health(id)+heal) } if (HasFlag(id,Flag_Teamshield_Target)) { //Find the owner of the shield new owner = find_owner_by_euser(id,"Effect_Teamshield") new weaponname[32]; get_weaponname( weapon, weaponname, 31 ); replace(weaponname, 31, "weapon_", "") if (is_user_alive(owner)) { if(get_user_health(attacker_id)-damage<1) UTIL_Kill(owner,attacker_id,weaponname) else set_user_health(attacker_id,get_user_health(attacker_id)-damage) set_user_health(id,get_user_health(id)+damage/2) } } }
A więc chodzi mi o przeróbkę tego kodu:
if (damage > 0 && player_agility[id] > 0)
{
new heal = floatround(player_damreduction[id]*damage)
if (is_user_alive(id)) set_user_health(id,get_user_health(id)+heal)
}}
Powiem tak na diablo jest niby redukcja obrażeń ale:
Pierw graczowi odejmuje hp a później je dodaje tj. jeśli mamy 100hp i 45% redukcji to z m4 powinniśmy wyrwać gdzieś za 60-70 a giniemy :<
I chcę spytać jak przetobić ten kod aby takjakby damage był równy zero a odejmowało tyle co przy redukcji
Tu kod który ja próbowałem i nie działa
if (damage > 0 && player_agility[id] > 0) { new zycie = get_user_health(id) new dmg = damage-floatround(player_damreduction[id]*damage) if ((is_user_alive(id)) && (damage >= zycie) && (dmg < zycie) && (dmg < damage)) set_user_health(id,zycie-dmg) }