marcryzius
New Member
- Joined
- Mar 22, 2009
- Messages
- 61
- Reaction score
- 0
just an adaptation of my old system "reset" now included the use of "stages".
Lua:
--[[( Marcryzius D'evil )]]--
function onSay(cid, words, param)
local C ={
level = 8, -- LVL need to first reset.
RemainingLvl = 8, --LVL that will remain after reset.
pid = getPlayerGUID(cid), -- not fuse.
stages = 3, -- resets needed to add more tier levels.
nivel = 2, -- more to add per reset stage.
skull = "yes", --players with white skull can reset? ("yes" or "no").
redskull = "yes", -- players with red skull can reset? ("yes" or "no").
prot = "no", --needs to be in a protected area? ("yes" or "no").
bat = "no" --not battler to reset? ("yes" or "no").
}
function getResets(cid) return getPlayerStorageValue(cid,1020) < 0 and 0 or getPlayerStorageValue(cid,1020)end
if(C.skull == "no") and (getCreatureSkullType(cid) == 3) then
doPlayerSendTextMessage(cid,22,"Only players without white skull can reset.")
elseif(C.redskull == "no") and (getCreatureSkullType(cid) == 4) then
doPlayerSendTextMessage(cid,22,"Only players without red skull can reset.")
elseif(C.prot == "yes") and (getTilePzInfo(getCreaturePosition(cid)) == FALSE) then
doPlayerSendTextMessage(cid,22,"you need to be in a protected zone so I can reset.")
elseif(C.bat == "yes") and (getCreatureCondition(cid, CONDITION_INFIGHT) == TRUE) then
doPlayerSendTextMessage(cid,22,"you must be without battler so I can reset.")
else
local get = math.floor(getResets(cid)/C.stages)
if(getPlayerLevel(cid) >= (get*C.nivel)+C.level)then
setPlayerStorageValue(cid,1020,getResets(cid)+1)
doPlayerPopupFYI(cid,"you now was reset, you have "..getResets(cid).." reset\'s.")
doTeleportThing(cid, getTownTemplePosition(getPlayerTown(cid)))
doRemoveCreature(cid)
db.executeQuery("UPDATE `players` SET `level` = "..C.RemainingLvl..", `experience` = "..getExperienceForLevel(C.RemainingLvl).." WHERE `id` = "..C.pid)
else
doPlayerSendCancel(cid, "You need to have level "..(get*C.nivel)+C.level.." or more you may be reset.")
doSendMagicEffect(getCreaturePosition(cid), CONST_ME_POFF)
end
end
return TRUE
end
Last edited: