Fiz um aqui, mas foi meio corrido e nao testei:
local keywordHandler = KeywordHandler:new()
local npcHandler = NpcHandler:new(keywordHandler)
NpcSystem.parseParameters(npcHandler)
local talkState = {}
function onCreatureAppear(cid) npcHandler:onCreatureAppear(cid) end
function onCreatureDisappear(cid) npcHandler:onCreatureDisappear(cid) end
function onCreatureSay(cid, type, msg) npcHandler:onCreatureSay(cid, type, msg) end
function onThink() npcHandler:onThink() end
function creatureSayCallback(cid, type, msg)
if(not npcHandler:isFocused(cid)) then
return false
end
local talkUser = NPCHANDLER_CONVbehavior == CONVERSATION_DEFAULT and 0 or cid
local config = {
vocations = {1}, -- IDs das vocation que poderao resetar, caso mais de 1, adicionar virgulas dentro da tabela
minLevel = 100, -- level minimo para resetar
newLevel = 5, -- level após reset
newVoc = 2, -- ID da vocation que ira ganhar ao resetar
maxResets = 1, -- máximo de resets
storage = 1020, -- storage do reset
outfit = 229, -- outfit que ira ganhar ao resetar
}
if msgcontains(msg, "resetar") then
if not isInArray(config.vocations, getPlayerVocation(cid)) then
selfSay("Voce nao pode resetar.", cid)
return true
end
if getPlayerStorageValue(cid,config.storage) < config.maxResets then
selfSay("Voce deseja resetar seu char?", cid)
talkState[talkUser] = 1
else
selfSay("Você nao pode resetar mais!", cid)
end
elseif msgcontains(msg, "no") and talkState[talkUser] == 1 then
selfSay("Ok.", cid)
talkState[talkUser] = 0
elseif msgcontains(msg, "yes") and talkState[talkUser] == 1 then
if getPlayerLevel(cid) >= config.minLevel then
if getPlayerStorageValue(cid,config.storage) < 0 then
setPlayerStorageValue(cid,config.storage,1)
else
setPlayerStorageValue(cid,config.storage,getPlayerStorageValue(cid,config.storage)+1)
end
doCreatureChangeOutfit(cid, {lookType = config.outfit})
doPlayerSetVocation(cid, config.newVoc)
npcHandler:releaseFocus(cid)
local GUID = getPlayerGUID(cid)
doRemoveCreature(cid)
db.executeQuery("UPDATE players SET level = "..config.newLevel.." WHERE id = "..GUID)
else
selfSay("O level minimo necessario para resetar é "..config.minLevel.."!", cid)
end
end
return true
end
npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback)
npcHandler:addModule(FocusModule:new())





info
Grupo: Campones
Registrado: 21/07/13
Posts: 55
Reputação: +2
Char no Tibia: Kavaskiva
olá gente , assim eu tenho uma script e gostaria assim , sempre ue um player reseta-se mudasse de vocação , exemplo , sou um goku , e após resetar viro GOKU GT .. eu uso essa script
-- config local minlevel = 100 -- level inical para resetar local price = 0 -- preço inicial para resetar local newlevel = 15 -- level após reset local newexp = 4200 -- nova experiencia após reset local lvlByReset = 5 -- level acrescentado por reset local priceByReset = 100 -- preço acrescentado por reset local maxResets = 1 -- máximo de resets -- end config function addReset(cid) resets = getResets(cid) setPlayerStorageValue(cid,1020,resets+1) return true end function getResets(cid) resets = getPlayerStorageValue(cid,1020) if resets <= 0 then resets = 0 end return resets end local keywordHandler = KeywordHandler:new() local npcHandler = NpcHandler:new(keywordHandler) NpcSystem.parseParameters(npcHandler) local talkState = {} function onCreatureAppear(cid) npcHandler:onCreatureAppear(cid) end function onCreatureDisappear(cid) npcHandler:onCreatureDisappear(cid) end function onCreatureSay(cid, type, msg) npcHandler:onCreatureSay(cid, type, msg) end function onThink() npcHandler:onThink() end function creatureSayCallback(cid, type, msg) if(not npcHandler:isFocused(cid)) then return false end local talkUser = NPCHANDLER_CONVbehavior == CONVERSATION_DEFAULT and 0 or cid local needlvl = minlevel + (getResets(cid) * lvlByReset) local newPrice = price + (getResets(cid) * priceByReset) if msgcontains(msg, 'resetar') then if getResets(cid) <= maxResets then selfSay('Voce deseja reset seu char? Isto custará '..newPrice..' gp\'s!', cid) talkState[talkUser] = 1 else selfSay('Você ja alcançou seu limite de resets!', cid) end elseif(msgcontains(msg, 'yes') and talkState[talkUser] == 1) then if getPlayerMoney(cid) <= newPrice then selfSay('É Necessario ter '..newPrice..' gp\'s para resetar!', cid) elseif getPlayerLevel(cid) <= needlvl then selfSay('O level minimo para reset é '..needlvl..'!', cid) else doPlayerRemoveMoney(cid,newPrice) if isInArray(vocs, getPlayerVocation(cid)) then doPlayerSetVocation(cid, getPlayerVocation(cid)+4) end addReset(cid) playerid = getPlayerGUID(cid) doRemoveCreature(cid) db.executeQuery("UPDATE `players` SET `level`="..newlevel..",`experience`="..newexp.." WHERE `players`.`id`= ".. playerid .."") end talkState[talkUser] = 0 elseif(msgcontains(msg, 'no') and isInArray({1}, talkState[talkUser]) == TRUE) then talkState[talkUser] = 0 selfSay('Ok.', cid) elseif msgcontains(msg, 'quant') then selfSay('Voce tem um total de '..getResets(cid)..' reset(s).', cid) end return true end npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback) npcHandler:addModule(FocusModule:new())Editado Fevereiro 22 por kazaana