Em data/creaturescripts/creaturescripts.xml adicione a seguinte tag:
<event type="death" name="LevelProtect" event="script" value="levelprotect.lua" />
Agora em data/creaturescripts/scripts crie o arquivo levelprotect.lua com o seguinte conteúdo:
local level = 50 -- até que level o script irá proteger o player
function onDeath(cid, lastHitKiller, mostDamageKiller)
if isPlayer(cid) and isPlayer(mostDamageKiller) and getCreatureSkullType(cid) == SKULL_NONE then
if getPlayerLevel(cid) <= level the
doPlayerSetLossPercent(cid, 0, 0)
doCreatureSetDropLoot(cid, false)
return true
end
end
return true
end
Ainda em scripts, abra o arquivo login.lua e registre o evento:
registerCreatureEvent(cid, "LevelProtect")
Atenciosamente,
Bruno Minervino
Tibia Clients - Downloads Window