Postado 2 horas2 hs Alguem ajuda a coloca pra cada 5 resets o player ganhar 3 items (modificado)EX: ele deu o QUINTO reset, ai vai ganhar...ai no DECIMO RESET....item: 2160, 50item: 9971, 5item: 10558, 25local config = {minlevel = 4000, --- initial level to resetprice = 1000000, ---initial price to resetnewlevel = 150, --- level after resetpriceByReset = 2000000, --- price added per resetpercent = 10, ---- percentage of health/mana you will have upon reset (relative to your old total health)maxresets = 100,levelbyreset = 0 --- how much more level will you need in the next reset}function getResets(uid)resets = getPlayerStorageValue(uid, 14335)if resets < 0 thenresets = 0endreturn resetsendlocal keywordHandler = KeywordHandler:new()local npcHandler = NpcHandler:new(keywordHandler)NpcSystem.parseParameters(npcHandler)local talkState = {}function onCreatureAppear(cid) npcHandler:onCreatureAppear(cid) endfunction onCreatureDisappear(cid) npcHandler:onCreatureDisappear(cid) endfunction onCreatureSay(cid, type, msg) npcHandler:onCreatureSay(cid, type, msg) endfunction onThink() npcHandler:onThink() endfunction creatureSayCallback(cid, type, msg)if not npcHandler:isFocused(cid) thenreturn falseendlocal talkUser = NPCHANDLER_CONVBEHAVIOR == CONVERSATION_DEFAULT and 0 or cidfunction addReset(cid)if(npcHandler:isFocused(cid)) thennpcHandler:releaseFocus(cid)endtalkState[talkUser] = 0resets = getResets(cid)setPlayerStorageValue(cid, 14335, 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+1local description = resets+1db.query("UPDATE players SET level="..config.newlevel.."experience= 0 WHERE playersid= ".. playerid .."")return trueendlocal newPrice = config.price + (getResets(cid) * config.priceByReset)local newminlevel = config.minlevel + (getResets(cid) * config.levelbyreset)if msgcontains(msg, 'reset') thenif getResets(cid) < config.maxresets thenselfSay('[RESET] Voce quer resetar seu personagem? custa '..newPrice..' gp\'s!', cid)talkState[talkUser] = 1elseselfSay('[RESET] Voce ja atingiu o maximo de resetes!', cid)endelseif(msgcontains(msg, 'yes') and talkState[talkUser] == 1) thenif getPlayerMoney(cid) < newPrice thenselfSay('[RESET] E necessario ter '..newPrice..' gp\'s para resetar!', cid)elseif getPlayerLevel(cid) < newminlevel thenselfSay('[RESET] O minimo para resetar e level '..newminlevel..'!', cid)elsedoPlayerRemoveMoney(cid,newPrice)playerid = getPlayerGUID(cid)addEvent(function()if isPlayer(cid) thenaddReset(cid)endend, 5000)local number = getResets(cid)+1local msg ="* Voce resetou!\n\n* [Reset(s): "..number.."]\n\n* Voce sera desconectado em 5 segundos para concluir o resete.\n\n* [Bonificacao]: 1 Baiak Token, 10% do Hp/Mp."doPlayerPopupFYI(cid, msg)talkState[talkUser] = 0npcHandler:releaseFocus(cid)doBroadcastMessage("[RESET] ["..getPlayerName(cid).."] Acabou de Resetar ["..number.."] Reset(s).", MESSAGE_STATUS_CONSOLE_ORANGE)endtalkState[talkUser] = 0elseif(msgcontains(msg, 'no')) and isInArray({1}, talkState[talkUser]) == TRUE thentalkState[talkUser] = 0npcHandler:releaseFocus(cid)selfSay('Ok.', cid)elseif msgcontains(msg, 'quantity') thenselfSay('[RESET] Voce tem no total de '..getResets(cid)..' reset(s).', cid)talkState[talkUser] = 0endreturn trueendnpcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback)npcHandler:addModule(FocusModule:new()) Editado 2 horas2 hs por Tokias (veja o histórico de edições)
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.