Hi, i have a problem, i have done a resistance elemental script that seem work correctly but i have a problem, when other player attack you and you have low hp, the player who attack u dont get killing you, you are with 1 hp and no never die, this is my script help me pls:
Sorry for my english and thank you
Lua:
local TimStr = 398931
local element = {
-- [Tipo de daño] = {porcentaje de daño},
[COMBAT_PHYSICALDAMAGE] = 40, -- Físico.
[COMBAT_ICEDAMAGE] = 10, -- Mágico.
[COMBAT_FIREDAMAGE] = 90, -- Mágico.
[COMBAT_EARTHDAMAGE] = 10, -- Mágico.
[COMBAT_ENERGYDAMAGE] = 90, -- Mágico.
[COMBAT_HOLYDAMAGE] = 10, -- ¿Mágico?
[COMBAT_DEATHDAMAGE] = 10, -- ¿Mágico?
}
function onStatsChange(cid, attacker, type, combat, value)
local v = element[combat]
if isPlayer(cid) and getPlayerStorageValue(cid, TimStr+1) ~= 1 and v and (type == STATSCHANGE_HEALTHLOSS or type == STATSCHANGE_MANALOSS) then
local newValue = (value * v) / 100
setPlayerStorageValue(cid, TimStr+1, 1)
doTargetCombatHealth(attacker, cid, combat, math.floor(newValue - value), math.floor(newValue - value), CONST_ME_NONE)
setPlayerStorageValue(cid, TimStr+1, -1)
return
end
end
return true
end
Sorry for my english and thank you
Last edited: