Postado Março 26, 2017 8 anos Autor 4 horas atrás, Semideus disse: Olá Wolf, seu script está perfeito, porém queria muito utiliza-lo no meu tfs 1.2, haveria uma versão atual dele? Enviado de meu XT1563 usando Tapatalk a versão 1.2 ta aqui: Spoiler local keywordHandler = KeywordHandler:new() local npcHandler = NpcHandler:new(keywordHandler) NpcSystem.parseParameters(npcHandler) 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 local config = { minlevel = 150, --- Level inical para resetar price = 10000, --- Preço inicial para resetar newlevel = 20, --- Level após reset priceByReset = 0, --- Preço acrescentado por reset percent = 10, ---- Porcentagem da vida/mana que você terá ao resetar (em relação à sua antiga vida total) maxresets = 50, ---- Maximo de resets levelbyreset = 0 --- Quanto de level vai precisar a mais no próximo reset } local function addReset(uid) local player = Player(uid) if player then local resets = player:getResets() local hp = player:getMaxHealth() local resethp = hp*(config.percent/100) player:setMaxHealth(resethp) local mana = player:getMaxMana() local resetmana = mana*(config.percent/100) player:setMaxMana(resetmana) local playerid = player:getGuid() player:remove() db.query("UPDATE `players` SET `resets`="..resets.. + 1",`experience`= 0 WHERE `players`.`id`= ".. playerid .."") db.query("UPDATE `players` SET `level`="..config.newlevel..",`experience`= 0 WHERE `players`.`id`= ".. playerid .."") end return true end local function getResets(uid) local player = Player(uid) local resets = 0 if player then resets = math.max(0, player:getStorageValue(378378)) end return resets end function creatureSayCallback(cid, type, msg) if not npcHandler:isFocused(cid) then return false end local player = Player(cid) local newPrice = config.price + (getResets(cid) * config.priceByReset) local newminlevel = config.minlevel + (getResets(cid) * config.levelbyreset) if msgcontains(msg, 'reset') then if getResets(cid) < config.maxresets then npcHandler:say('You want to reset your character? It will cost '..newPrice..' gp\'s!', cid) npcHandler.topic[cid] = 1 else npcHandler:say('You already reached the maximum reset level!', cid) end elseif msgcontains(msg, 'yes') and npcHandler.topic[cid] == 1 then if player:getLevel() > newminlevel then if player:removeMoney(newPrice) then addEvent(function() if isPlayer(cid) then addReset(cid) end end, 3000) local number = getResets(cid)+1 local msg ="---[Reset: "..number.."]-- You have reseted! You'll be disconnected in 3 seconds." player:popupFYI(msg) npcHandler.topic[cid] = 0 npcHandler:releaseFocus(cid) else npcHandler:say('Its necessary to have at least '..newPrice..' gp\'s for reseting!', cid) npcHandler.topic[cid] = 0 end else npcHandler:say('The minimum level for reseting is '..newminlevel..'!', cid) npcHandler.topic[cid] = 0 end elseif(msgcontains(msg, 'no')) and isInArray({1}, npcHandler.topic[cid]) then npcHandler.topic[cid] = 0 npcHandler:releaseFocus(cid) npcHandler:say('Ok.', cid) elseif msgcontains(msg, 'quantity') then npcHandler:say('You have a total of '..getResets(cid)..' reset(s).', cid) npcHandler.topic[cid] = 0 end return true end npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback) npcHandler:addModule(FocusModule:new()) Todos os meus trabalhos importantes estão na seção "Sobre mim" no meu perfil; Dá uma passada lá! "Há três caminhos para o fracasso: não ensinar o que se sabe, não praticar o que se ensina, e não perguntar o que se ignora." - São Beda (obg ao @Beeny por fazer essa linda sign <3)
Postado Março 27, 2017 8 anos Autor Em 3/25/2017 ás 21:40, Semideus disse: Valeeeeu mano, rep+ Se não for incômodo, existe alguma forma de com esse script, eu criar uma porta que só passe com tantos reset's? só fazer essa checagem aqui na porta: getPlayerStorageValue(uid, 378378) >= numero de resets no script da porta. Todos os meus trabalhos importantes estão na seção "Sobre mim" no meu perfil; Dá uma passada lá! "Há três caminhos para o fracasso: não ensinar o que se sabe, não praticar o que se ensina, e não perguntar o que se ignora." - São Beda (obg ao @Beeny por fazer essa linda sign <3)
Postado Março 27, 2017 8 anos Autor 1 hora atrás, Semideus disse: Deu esse bug aqui quando tentei ligar o ot com o npc spawnado. acho que agora vai Spoiler local keywordHandler = KeywordHandler:new() local npcHandler = NpcHandler:new(keywordHandler) NpcSystem.parseParameters(npcHandler) 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 local config = { minlevel = 150, --- Level inical para resetar price = 10000, --- Preço inicial para resetar newlevel = 20, --- Level após reset priceByReset = 0, --- Preço acrescentado por reset percent = 10, ---- Porcentagem da vida/mana que você terá ao resetar (em relação à sua antiga vida total) maxresets = 50, ---- Maximo de resets levelbyreset = 0 --- Quanto de level vai precisar a mais no próximo reset } local function addReset(uid) local player = Player(uid) if player then local resets = player:getResets() local hp = player:getMaxHealth() local resethp = hp*(config.percent/100) player:setMaxHealth(resethp) local mana = player:getMaxMana() local resetmana = mana*(config.percent/100) player:setMaxMana(resetmana) local playerid = player:getGuid() player:remove() db.query("UPDATE `players` SET `resets`=".. resets + 1 ..",`experience`= 0 WHERE `players`.`id`= ".. playerid .."") db.query("UPDATE `players` SET `level`="..config.newlevel..",`experience`= 0 WHERE `players`.`id`= ".. playerid .."") end return true end local function getResets(uid) local player = Player(uid) local resets = 0 if player then resets = math.max(0, player:getStorageValue(378378)) end return resets end function creatureSayCallback(cid, type, msg) if not npcHandler:isFocused(cid) then return false end local player = Player(cid) local newPrice = config.price + (getResets(cid) * config.priceByReset) local newminlevel = config.minlevel + (getResets(cid) * config.levelbyreset) if msgcontains(msg, 'reset') then if getResets(cid) < config.maxresets then npcHandler:say('You want to reset your character? It will cost '..newPrice..' gp\'s!', cid) npcHandler.topic[cid] = 1 else npcHandler:say('You already reached the maximum reset level!', cid) end elseif msgcontains(msg, 'yes') and npcHandler.topic[cid] == 1 then if player:getLevel() > newminlevel then if player:removeMoney(newPrice) then addEvent(function() if isPlayer(cid) then addReset(cid) end end, 3000) local number = getResets(cid)+1 local msg ="---[Reset: "..number.."]-- You have reseted! You'll be disconnected in 3 seconds." player:popupFYI(msg) npcHandler.topic[cid] = 0 npcHandler:releaseFocus(cid) else npcHandler:say('Its necessary to have at least '..newPrice..' gp\'s for reseting!', cid) npcHandler.topic[cid] = 0 end else npcHandler:say('The minimum level for reseting is '..newminlevel..'!', cid) npcHandler.topic[cid] = 0 end elseif(msgcontains(msg, 'no')) and isInArray({1}, npcHandler.topic[cid]) then npcHandler.topic[cid] = 0 npcHandler:releaseFocus(cid) npcHandler:say('Ok.', cid) elseif msgcontains(msg, 'quantity') then npcHandler:say('You have a total of '..getResets(cid)..' reset(s).', cid) npcHandler.topic[cid] = 0 end return true end npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback) npcHandler:addModule(FocusModule:new()) Todos os meus trabalhos importantes estão na seção "Sobre mim" no meu perfil; Dá uma passada lá! "Há três caminhos para o fracasso: não ensinar o que se sabe, não praticar o que se ensina, e não perguntar o que se ignora." - São Beda (obg ao @Beeny por fazer essa linda sign <3)
Postado Março 27, 2017 8 anos Autor 32 minutos atrás, Semideus disse: REP+ agora spawnou, porém quando dei reset, ele apareceu o modal que iria deslogar em 3 segundos mas não deslogou e deu esse erro na distro troca essa linha local resets = player:getResets() por local resets = getResets(uid) e deve estar resolvido :D Todos os meus trabalhos importantes estão na seção "Sobre mim" no meu perfil; Dá uma passada lá! "Há três caminhos para o fracasso: não ensinar o que se sabe, não praticar o que se ensina, e não perguntar o que se ignora." - São Beda (obg ao @Beeny por fazer essa linda sign <3)
Postado Março 27, 2017 8 anos Autor 46 minutos atrás, Semideus disse: infelizmente ainda não White, fui resetar e deu esse erro na distro pronto ahuauha Spoiler local keywordHandler = KeywordHandler:new() local npcHandler = NpcHandler:new(keywordHandler) NpcSystem.parseParameters(npcHandler) 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 local config = { minlevel = 150, --- Level inical para resetar price = 10000, --- Preço inicial para resetar newlevel = 20, --- Level após reset priceByReset = 0, --- Preço acrescentado por reset percent = 10, ---- Porcentagem da vida/mana que você terá ao resetar (em relação à sua antiga vida total) maxresets = 50, ---- Maximo de resets levelbyreset = 0 --- Quanto de level vai precisar a mais no próximo reset } local function getResets(uid) local player = Player(uid) local resets = 0 if player then resets = math.max(0, player:getStorageValue(378378)) end return resets end local function addReset(uid) local player = Player(uid) if player then local resets = getResets(uid) local hp = player:getMaxHealth() local resethp = hp*(config.percent/100) player:setMaxHealth(resethp) local mana = player:getMaxMana() local resetmana = mana*(config.percent/100) player:setMaxMana(resetmana) local playerid = player:getGuid() player:remove() db.query("UPDATE `players` SET `resets`=".. resets + 1 ..",`experience`= 0 WHERE `players`.`id`= ".. playerid .."") db.query("UPDATE `players` SET `level`="..config.newlevel..",`experience`= 0 WHERE `players`.`id`= ".. playerid .."") end return true end function creatureSayCallback(cid, type, msg) if not npcHandler:isFocused(cid) then return false end local player = Player(cid) local newPrice = config.price + (getResets(cid) * config.priceByReset) local newminlevel = config.minlevel + (getResets(cid) * config.levelbyreset) if msgcontains(msg, 'reset') then if getResets(cid) < config.maxresets then npcHandler:say('You want to reset your character? It will cost '..newPrice..' gp\'s!', cid) npcHandler.topic[cid] = 1 else npcHandler:say('You already reached the maximum reset level!', cid) end elseif msgcontains(msg, 'yes') and npcHandler.topic[cid] == 1 then if player:getLevel() > newminlevel then if player:removeMoney(newPrice) then addEvent(function() if isPlayer(cid) then addReset(cid) end end, 3000) local number = getResets(cid)+1 local msg ="---[Reset: "..number.."]-- You have reseted! You'll be disconnected in 3 seconds." player:popupFYI(msg) npcHandler.topic[cid] = 0 npcHandler:releaseFocus(cid) else npcHandler:say('Its necessary to have at least '..newPrice..' gp\'s for reseting!', cid) npcHandler.topic[cid] = 0 end else npcHandler:say('The minimum level for reseting is '..newminlevel..'!', cid) npcHandler.topic[cid] = 0 end elseif(msgcontains(msg, 'no')) and isInArray({1}, npcHandler.topic[cid]) then npcHandler.topic[cid] = 0 npcHandler:releaseFocus(cid) npcHandler:say('Ok.', cid) elseif msgcontains(msg, 'quantity') then npcHandler:say('You have a total of '..getResets(cid)..' reset(s).', cid) npcHandler.topic[cid] = 0 end return true end npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback) npcHandler:addModule(FocusModule:new()) Todos os meus trabalhos importantes estão na seção "Sobre mim" no meu perfil; Dá uma passada lá! "Há três caminhos para o fracasso: não ensinar o que se sabe, não praticar o que se ensina, e não perguntar o que se ignora." - São Beda (obg ao @Beeny por fazer essa linda sign <3)
Participe da conversa
Você pode postar agora e se cadastrar mais tarde. Se você tem uma conta, faça o login para postar com sua conta.