it depends on what kill it
dont think it should live if a car step on it
function onKill(cid, target)
local monsters = {
["Cat"] = {
text = {"The cat lost her 7 lives! :D", "This sucker have lost his lives! :D"},
emotes = {"MjaaaUUU1!!", "LoL sucker"},
effect = 49,
lives = 7
},
["Trainer"] = {
text = {}, -- No message after death needed, the Trainer can't die.
emotes = {"You can't kill me!!!??", "I'm a training monk!"},
effect = 0, -- 0 for no effects.
lives = 0 -- 0 for imortality
}
}
local select = monsters[getCreatureName(target)]
if select ~= nil then
local id = getGlobalStorageValue(target)
if id >= select.lives and select.lives ~= 0 then
if select.text[1] ~= nil then
doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, select.text[math.random[1, #select.text]])
end
else
setGlobalStorageValue(target,((lives ~= nil and (id == -1 and 1) or id+1) or -1))
doCreatureAddHealth(target, getCreatureMaxHealth(target), 1)
doSendMagicEffect(getCreaturePosition(target), select.effect)
if select.emotes[1] ~= nil then
doPlayerSendTextMessage(target, select.emotes[math.random[1, #select.emotes]], TALKTYPE_ORANGE_1)
end
return false
end
end
return true
end
I do say good sir, what country are you from?
Where I come from the cars have wheels and tires.. you must be from that transformers show,
what brings you to our forums?
local monsters = {
["cat"] = {lives = 9, emotes = {"Meeeow!", ":3"}, effect = CONST_ME_STUN},
["rat"] = {emotes = {"Pff!", "Noob :("}},
["ferumbras"] = {lives = 3, texts = {"I'm the greatest mage!", "You won't kill me, haha!"}, effect = CONST_ME_BIGCLOUDS}
}
function onKill(cid, target, lastHit)
if (not lastHit or not isPlayer(cid) or not isMonster(target)) then
return true
end
local now = monsters[getCreatureName(target):lower()]
if (not now) then return true end
local val = getGlobalStorageValue(target)
setGlobalStorageValue(target, val - 1)
if (now.emotes and type(now.emotes) == "table") then doCreatureSay(target, now.emotes[math.random(#now.emotes)], TALKTYPE_MONSTER) end
if (now.texts and type(now.texts) == "table") then doPlayerSendTextMessage(cid, MESSAGE_STATUS_ADVANCE, now.texts[math.random(#now.texts)])
if (now.effect and type(now.effect) == "number") then doSendMagicEffect(getCreaturePosition(target), now.effect) end
if (val == -1) then setGlobalStorageValue(target, now.lives) else setGlobalStorageValue(target, val - 1) end
return (val > 1 or -1) and doCreatureAddHealth(target, getCreatureMaxHealth(target), true), true or false
end
According to a myth in many cultures, cats have multiple lives. In many countries, they are believed to have nine lives, but in Germany and some Spanish-speaking regions they are said to have seven lives,[SUP][202][/SUP] while in Turkish and Arabic traditions the number of lives is six.[SUP][203][/SUP]
Wiki
better creature storage