Lua:
local resetSys = TalkAction("!reset")
local config = {
storageResets = 364214,
backToLevel = 8,
redskull = true, -- need to be without redskull to reset?
battle = true, -- need to be without battle to reset?
pz = true, -- need to be in protect zone to reset?
stages = {
{resets = math.huge, level = 1000, premium = 1000}
}
}
local function getExperienceForLevel(lv)
lv = lv - 1
return ((50 * lv * lv * lv) - (150 * lv * lv) + (400 * lv)) / 3
end
local vocations = {
[5] = 1,
[6] = 2,
[7] = 3,
[8] = 4,
}
function resetSys.onSay(player, words, param)
local vocation = player:getVocation()
local vocID = vocation:getId()
if player:getStorageValue(config.storageResets) == -1 then
player:setStorageValue(config.storageResets,0)
return false
end
if config.redskull and player:getSkull() == 4 then
player:sendCancelMessage("You need to be without red skull to reset.")
return false
elseif config.pz and not getTilePzInfo(player:getPosition()) then
player:sendCancelMessage("You need to be in protection zone to reset.")
return false
elseif config.battle and player:getCondition(CONDITION_INFIGHT) then
player:sendCancelMessage("You need to be without battle to reset.")
return false
end
local playerResets = math.max(0, player:getStorageValue(config.storageResets))
local stage = nil
for _, _stage in pairs(config.stages) do
if playerResets <= _stage.resets then
stage = _stage
break
end
end
if not stage then
print("[Warning - ResetSystem::onSay] Stage not found for player: " .. player:getName())
return false
end
local resetLevel = player:isPremium() and stage.premium or stage.level
local playerLevel = player:getLevel()
if playerLevel < resetLevel then
player:sendCancelMessage("You need level " .. resetLevel .. " or more to reset.")
return false
end
if vocations[vocID] then
player:setVocation(Vocation(vocations[vocID]))
end
player:removeExperience(getExperienceForLevel(playerLevel) - getExperienceForLevel(config.backToLevel))
player:setMaxHealth(185)
player:setMaxMana(90)
player:addHealth(185)
player:addMana(90)
return false
end
resetSys:register()
I'm using this script more when the player uses level 1000 or more he is not returning to level 8 he is getting his life sometimes 0/0 and the level sometimes gets 80 others 100 but never level 8
Attachments
-
1668046563018.png18.4 KB · Views: 10 · VirusTotal
Last edited: