Serve para que o jogador até determinado level não perca Skill,Exp,Loot ao morrer(configurável)
creaturescript/script
levelprotection.lua
V1 é uma versão totalmente configurável,magic,exp,skills!
function onDeath(cid, corpse, deathList) local config = { onlypremium = true, -- se precisa ser premium para não perder nada exp = true, -- se ao morrer o jogador irá perder exp skills = false, -- se ao morrer vai perder skills magic = false, -- se vai perder magic level loot = false, -- se ao morrer o jogador irá perder o loot level = 50 -- até que level irá proteger o player } if isPlayer(cid) and getPlayerLevel(cid) <= config.level then if config.onlypremium == true and not isPremium(cid) then return TRUE end if config.loot == false then doCreatureSetDropLoot(cid, false) end if config.magic == false then doPlayerSetLossPercent(cid, PLAYERLOSS_MANA, 0) end if config.skills == false then doPlayerSetLossPercent(cid, PLAYERLOSS_SKILLS, 0) end if config.exp == false then doPlayerSetLossPercent(cid, PLAYERLOSS_EXPERIENCE, 0) end return TRUE end return TRUE end
V2 -- é uma versão já configurada, false para não perder skills e level e true vai perder tudo.
function onDeath(cid, corpse, deathList) local config = { onlypremium = true, -- se precisa ser premium para não perder nada levelandskills = false, -- se ao morrer o jogador irá perder level e skill loot = false, -- se ao morrer o jogador irá perder o loot level = 50 -- até que level irá proteger o player } if isPlayer(cid) and getPlayerLevel(cid) <= config.level then if config.onlypremium == true and not isPremium(cid) then return TRUE end if config.loot == false then doCreatureSetDropLoot(cid, false) end if config.levelandskills == false then doPlayerSetLossSkill(cid, 0) end return TRUE end return TRUE end
creaturescript.xml
<event type="death" name="ProtectLevel" event="script" value="levelprotection.lua"/>
creaturescript/script/login.lua adicione:
registerCreatureEvent(cid, "ProtectLevel")