Postado Dezembro 17, 2018 6 anos Achei um script aqui e queria modifica-lo, minha ideia é fazer 1 npc que troque pontos por items de addon, montarias etc. Eu to usando esse script como base. Sendo que, ele tá por level e pontos level 160 ganha 5 pontos, eu queria por toda vez que upasse o level ganhasse 5 pontos, porque se não eu vou ter que fazer 1 tabela infinita do lvl 1 ao 999, ASUIHDFUIOASHFUISA. Se alguém puder ajudar nessa parte. local rewards = { -- Level, points {160, 5}, {200, 10}, {245, 15} } function onAdvance(player, skill, oldLevel, newLevel) if skill ~= SKILL__LEVEL then return true end for i = 1, #rewards do local reward = rewards[i] if newLevel >= reward[1] and player:getStorageValue(21352) < i then db.query("UPDATE `accounts` SET `NOVA_TABELA` = `NOVA_TABELA` + " .. reward[2] .. " WHERE `id` = '" .. player:getAccountId() .. "';") player:setStorageValue(21352, i) player:sendTextMessage(MESSAGE_STATUS_CONSOLE_ORANGE, 'Congratulations! You have advanced to level ' .. reward[1] .. ' and you have earned '.. reward[2] ..' points!') break end end return true end
Postado Dezembro 17, 2018 6 anos Solução Testa aí @Jobs local points = 5 local storage = 1234 function onAdvance(player, skill, oldLevel, newLevel) if skill ~= SKILL_LEVEL or newLevel <= oldLevel then return true end if player:getStorageValue(storage) < oldLevel then db.query("UPDATE `accounts` SET `NOVA_TABELA` = `NOVA_TABELA` + " .. points .. " WHERE `id` = '" .. player:getAccountId() .. "';") player:sendTextMessage(MESSAGE_STATUS_CONSOLE_ORANGE, 'Congratulations! You have advanced to level ' .. newLevel .. ' and you have earned '.. points ..' points!') player:setStorageValue(storage, oldLevel) end return true end
Postado Dezembro 18, 2018 6 anos Autor Em 17/12/2018 em 17:18, Coltera disse: Testa aí @Jobs local points = 5 local storage = 1234 function onAdvance(player, skill, oldLevel, newLevel) if skill ~= SKILL_LEVEL or newLevel <= oldLevel then return true end if player:getStorageValue(storage) < oldLevel then db.query("UPDATE `accounts` SET `NOVA_TABELA` = `NOVA_TABELA` + " .. points .. " WHERE `id` = '" .. player:getAccountId() .. "';") player:sendTextMessage(MESSAGE_STATUS_CONSOLE_ORANGE, 'Congratulations! You have advanced to level ' .. newLevel .. ' and you have earned '.. points ..' points!') player:setStorageValue(storage, oldLevel) end return true end Obrigado, funcionou sim.
Postado Dezembro 18, 2018 6 anos Autor Em 18/12/2018 em 05:47, Hone Onna disse: Dúvida sanada. Tópico movido! wtf?
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.