Postado Fevereiro 23, 2017 8 anos Tem como substituir o valor gp por algum outro item? tipo pra resetar o npc pede uma scarab coin.
Postado Fevereiro 23, 2017 8 anos Autor 6 horas atrás, iTzBrHue3 disse: mais dessa maneira nao teria como salva quantos master reset o player tem, nao teria como eu cria um contador ? ai qnd resetar os resets vc tem que usar outra storage pra contar os master reset. Zera os resets com aquele comando e adiciona +1 no storage dos master reset. 2 horas atrás, shadauer disse: Tem como substituir o valor gp por algum outro item? tipo pra resetar o npc pede uma scarab coin. tem, troca a função que ele verifica e pede dinheiro pela função getPlayerItemCount(cid, id do item) >= quantidade que vc quer e a função doPlayerRemoveItem(cid, id do item, quantidade). 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 Fevereiro 23, 2017 8 anos 23 horas atrás, xWhiteWolf disse: ai qnd resetar os resets vc tem que usar outra storage pra contar os master reset. Zera os resets com aquele comando e adiciona +1 no storage dos master reset. tem, troca a função que ele verifica e pede dinheiro pela função getPlayerItemCount(cid, id do item) >= quantidade que vc quer e a função doPlayerRemoveItem(cid, id do item, quantidade). Fiz isto, de trocar a função que ele verifica, agora ele sumiu. veja, coloquei um steel helmet pra exemplo no item. --[[Script made 100% by Nogard and Night Wolf. You can feel free to edit anything you want, but don't remove the credits]] local config = { minlevel = 350, --- level inical para resetar price = 100000, --- preço inicial para resetar newlevel = 20, --- level após reset priceByReset = 10000, --- preço acrescentado por reset percent = 100, ---- porcentagem da vida/mana que você terá ao resetar (em relação à sua antiga vida total) maxresets = 5000, levelbyreset = 10 --- quanto de level vai precisar a mais no próximo reset } --- end config function getResets(uid) resets = getPlayerStorageValue(uid, 378378) 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 function addReset(cid) if(npcHandler:isFocused(cid)) then npcHandler:releaseFocus(cid) end talkState[talkUser] = 0 resets = getResets(cid) setPlayerStorageValue(cid, 378378, resets+1) doTeleportThing(cid, getTownTemplePosition(getPlayerTown(cid))) local hp = getCreatureMaxHealth(cid) local resethp = hp*(config.percent/100) setCreatureMaxHealth(cid, resethp) local differencehp = (hp - resethp) doCreatureAddHealth(cid, -differencehp) local mana = getCreatureMaxMana(cid) local resetmana = mana*(config.percent/100) setCreatureMaxMana(cid, resetmana) local differencemana = (mana - resetmana) doCreatureAddMana(cid, -differencemana) doRemoveCreature(cid) local description = resets+1 db.executeQuery("UPDATE `players` SET `description` = ' [Reset: "..description.."]' WHERE `players`.`id`= ".. playerid .."") db.executeQuery("UPDATE `players` SET `level`="..config.newlevel..",`experience`= 0 WHERE `players`.`id`= ".. playerid .."") return true end 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 selfSay('Deseja resetar? O Valor de Reset custa '..newPrice..' gp\'s! diga {Yes}', cid) talkState[talkUser] = 1 else selfSay('You already reached the maximum reset level!', cid) end elseif(msgcontains(msg, 'yes') and talkState[talkUser] == 1) then if getPlayerItemCount(cid, 2457) selfSay('Nao posso lhe resetar se voce nao tiver pelo menos '..newPrice..' gp\'s para Resetar...', cid) elseif getPlayerLevel(cid) < newminlevel then selfSay('O Nivel minimo para resetar e '..newminlevel..'!', cid) else doPlayerRemoveItem(cid, 2457, 1) playerid = getPlayerGUID(cid) addEvent(function() if isPlayer(cid) then addReset(cid) end end, 3000) local number = getResets(cid)+1 local msg ="---[Reset: "..number.."]-- Parabens, voce Resetou, Irei lhe desconectar para aplicar o efeito em 3 segundos, volte por favor." doPlayerPopupFYI(cid, msg) talkState[talkUser] = 0 npcHandler:releaseFocus(cid) end talkState[talkUser] = 0 elseif(msgcontains(msg, 'no')) and isInArray({1}, talkState[talkUser]) == TRUE then talkState[talkUser] = 0 npcHandler:releaseFocus(cid) selfSay('Ok.', cid) elseif msgcontains(msg, 'Quantidade') then selfSay('Voce possui no total '..getResets(cid)..' reset(s).', cid) talkState[talkUser] = 0 end return true end npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback) npcHandler:addModule(FocusModule:new()) Opa consegui, a syntaxe estava errada e ajeitei a verificação e coloquei algumas variaveis para ficar mais pratico pelo id do item. obrigado!
Postado Fevereiro 24, 2017 8 anos Autor 4 horas atrás, shadauer disse: Fiz isto, de trocar a função que ele verifica, agora ele sumiu. veja, coloquei um steel helmet pra exemplo no item. --[[Script made 100% by Nogard and Night Wolf. You can feel free to edit anything you want, but don't remove the credits]] local config = { minlevel = 350, --- level inical para resetar price = 100000, --- preço inicial para resetar newlevel = 20, --- level após reset priceByReset = 10000, --- preço acrescentado por reset percent = 100, ---- porcentagem da vida/mana que você terá ao resetar (em relação à sua antiga vida total) maxresets = 5000, levelbyreset = 10 --- quanto de level vai precisar a mais no próximo reset } --- end config function getResets(uid) resets = getPlayerStorageValue(uid, 378378) 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 function addReset(cid) if(npcHandler:isFocused(cid)) then npcHandler:releaseFocus(cid) end talkState[talkUser] = 0 resets = getResets(cid) setPlayerStorageValue(cid, 378378, resets+1) doTeleportThing(cid, getTownTemplePosition(getPlayerTown(cid))) local hp = getCreatureMaxHealth(cid) local resethp = hp*(config.percent/100) setCreatureMaxHealth(cid, resethp) local differencehp = (hp - resethp) doCreatureAddHealth(cid, -differencehp) local mana = getCreatureMaxMana(cid) local resetmana = mana*(config.percent/100) setCreatureMaxMana(cid, resetmana) local differencemana = (mana - resetmana) doCreatureAddMana(cid, -differencemana) doRemoveCreature(cid) local description = resets+1 db.executeQuery("UPDATE `players` SET `description` = ' [Reset: "..description.."]' WHERE `players`.`id`= ".. playerid .."") db.executeQuery("UPDATE `players` SET `level`="..config.newlevel..",`experience`= 0 WHERE `players`.`id`= ".. playerid .."") return true end 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 selfSay('Deseja resetar? O Valor de Reset custa '..newPrice..' gp\'s! diga {Yes}', cid) talkState[talkUser] = 1 else selfSay('You already reached the maximum reset level!', cid) end elseif(msgcontains(msg, 'yes') and talkState[talkUser] == 1) then if getPlayerItemCount(cid, 2457) selfSay('Nao posso lhe resetar se voce nao tiver pelo menos '..newPrice..' gp\'s para Resetar...', cid) elseif getPlayerLevel(cid) < newminlevel then selfSay('O Nivel minimo para resetar e '..newminlevel..'!', cid) else doPlayerRemoveItem(cid, 2457, 1) playerid = getPlayerGUID(cid) addEvent(function() if isPlayer(cid) then addReset(cid) end end, 3000) local number = getResets(cid)+1 local msg ="---[Reset: "..number.."]-- Parabens, voce Resetou, Irei lhe desconectar para aplicar o efeito em 3 segundos, volte por favor." doPlayerPopupFYI(cid, msg) talkState[talkUser] = 0 npcHandler:releaseFocus(cid) end talkState[talkUser] = 0 elseif(msgcontains(msg, 'no')) and isInArray({1}, talkState[talkUser]) == TRUE then talkState[talkUser] = 0 npcHandler:releaseFocus(cid) selfSay('Ok.', cid) elseif msgcontains(msg, 'Quantidade') then selfSay('Voce possui no total '..getResets(cid)..' reset(s).', cid) talkState[talkUser] = 0 end return true end npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback) npcHandler:addModule(FocusModule:new()) Opa consegui, a syntaxe estava errada e ajeitei a verificação e coloquei algumas variaveis para ficar mais pratico pelo id do item. obrigado! a linha if getPlayerItemCount(cid, 2457) selfSay('Nao posso lhe resetar se voce nao tiver pelo menos '..newPrice..' gp\'s para Resetar...', cid) deveria ser: if getPlayerItemCount(cid, 2457) < 1 then selfSay('Nao posso lhe resetar se voce nao tiver pelo menos '..newPrice..' gp\'s para Resetar...', cid) 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 Fevereiro 27, 2017 8 anos Fala mano, coloquei o script e aparentemente deu tudo certo! muito bom! o que eu gostaria de saber é se tem como adicionar um rank reset ou aparecer os resets no look do player
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.