Fire Element
Member
Based: http://otland.net/f81/reset-system-82456/
I added stages and look.
Thanks for fix conde2.
1-4 reborns, level 350
5-9 reborns, level 355
10-14 reborns, level 360
lib/050-function.lua
talkactions/talkactions.xml
talkactions/scripts/reset.lua
creaturescripts/scripts/reborn.lua
creautrescripts/creaturescripts.xml
I added stages and look.
Thanks for fix conde2.
Lua:
stage = {
{level = 350, reborn = 4},
{level = 355, reborn = 9},
{level = 360, reborn = 14}
}
5-9 reborns, level 355
10-14 reborns, level 360
lib/050-function.lua
Lua:
function getReborns(cid)
local reborn = getPlayerStorageValue(cid, 1020)
return reborn < 0 and 0 or reborn
end
talkactions/talkactions.xml
Code:
<talkaction words="!reborn" event="script" value="reborn.lua"/>
talkactions/scripts/reset.lua
Lua:
function onSay(cid, words, param)
config = {
RemainingLvl = 8, -- That level will be reborn after.
exp = 4200, -- Experience that will be reborn after.
pid = getPlayerGUID(cid),
skull = true, -- Players with white skull can reborn? (true or false).
redskull = true, -- Players with red skull can reborn? (true or false).
prot = true, -- Players need to be in protection zone to reborn? (true or false).
bat = true, -- Players must be no fight to reborn (true or false).
vip = true -- Vip system (true or false).
}
stage = {
{level = 350, reborn = 4},
{level = 355, reborn = 9},
{level = 360, reborn = 14}
}
if(config.skull == false) and (getCreatureSkullType(cid) == 3) then
doPlayerSendTextMessage(cid, 22, "Only players without white skull can reborn.")
return true
end
if(config.redskull == false) and (getCreatureSkullType(cid) == 4) then
doPlayerSendTextMessage(cid, 22, "Only player without red skull can reborn.")
return true
end
if(config.prot == true) and (getTilePzInfo(getCreaturePosition(cid)) == false) then
doPlayerSendTextMessage(cid, 22, "You need stay in PZ to reborn.")
return true
end
if(config.bat == true) and (getCreatureCondition(cid, CONDITION_INFIGHT) == true) then
doPlayerSendTextMessage(cid, 22, "Players without battle can reborn.")
return true
end
for _, k in ipairs(stage) do
if getReborns(cid) <= k.reborn then
if getPlayerLevel(cid) >= k.level then
setPlayerStorageValue(cid, 1020, getReborns(cid)+1)
doPlayerPopupFYI(cid, "You now was reborn, you have "..getReborns(cid)+(1).." reborn\'s.")
doTeleportThing(cid, getTownTemplePosition(getPlayerTown(cid)))
doRemoveCreature(cid)
db.executeQuery("UPDATE `players` SET `level` = "..config.RemainingLvl..", `experience` = "..config.exp.." WHERE `id` = "..config.pid)
else
doPlayerSendCancel(cid, "You need to have level "..k.level.." or more you may be reborn.")
doSendMagicEffect(getPlayerPosition(cid), CONST_ME_POFF)
end
end
end
return true
end
creaturescripts/scripts/reborn.lua
Lua:
function onLook(cid, thing, position, lookDistance)
if(not isPlayer(thing.uid)) then
return true
end
if (isPlayer(thing.uid) == true) then
doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "You see "..getCreatureName(thing.uid).."(Level "..getPlayerLevel(thing.uid)..") [Reset "..getReborns(thing.uid).."]. "..(getPlayerSex(thing.uid) == 0 and "She" or "He").." is a "..getVocationInfo(getPlayerVocation(thing.uid)).name..".")
end
return false
end
creautrescripts/creaturescripts.xml
Code:
<event type="look" name="reborn" event="script" value="reborn.lua"/>
Last edited: