local config = {
onlyPremium = true,
requiredLevel = 330,
newLevel = 8,
newExp = 4200,
}
function onSay(cid, words, param, channel)
local player = Player(cid)
local resets = player:getStorageValue(1020)
if ((player:getCondition(CONDITION_INFIGHT, CONDITIONID_DEFAULT)) or (player:isPzLocked())) then
player:sendTextMessage(MESSAGE_EVENT_ADVANCE, "You cannot be in battle, please go to some protected zone.")
return false
end
if ((config.onlyPremium) and (player:getPremiumDays() >= 1)) then
if player:getLevel() >= config.requiredLevel then
if player:getStorageValue(resets) < 0 then
player:setStorageValue(resets, 0)
end
if player:getStorageValue(resets) >= 0 then
player:setPlayerStorageValue(resets, (resets) + 1)
player:sendTextMessage(MESSAGE_EVENT_ADVANCE,
"Congratulations! Your character has been reseted. Now you have " .. resets .. " resets.")
db.query("UPDATE `players` SET `level` = " ..
config.newLevel ..
", `experience` = " ..
config.newExp .. ", `resets` = " .. ((resets) + 1) .. " WHERE `id` = " .. player:getGuid())
player:remove()
end
else
player:sendTextMessage(MESSAGE_EVENT_ADVANCE, "You need to be level " .. config.requiredLevel ..
" or higher.")
end
else
player:sendTextMessage(MESSAGE_EVENT_ADVANCE, "You need to be premium account.")
end
return true
end