Postado Outubro 2, 2012 12 anos Um... Então ficaria mais ou menos assim... local config = { [50] = {{itemid = 0,0}, premmy = 5, storage = 35322} [100]= {{itemid = 0,0}, premmy = 10, storage = 35333}, [150] = {{itemid = 0,0}, premmy = 15, storage = 35344} } function onAdvance(cid, oldLevel, newLevel) if getPlayerStorageValue(cid, config[getPlayerLevel(cid)].storage) == -1 then doPlayerAddItem(cid,config[getPlayerLevel(cid)].itemid,config[getPlayerLevel(cid)].quant) doPlayerSendTextMessage(cid,MESSAGE_STATUS_CONSOLE_BLUE,"Você recebeu "..verificaritem(cid, text).."" .. verificarpremmy(cid, text) .. " por chegar ao level "..getPlayerLevel(cid).."") setPlayerStorageValue(cid, config[getPlayerLevel(cid)].storage,1) return true end end function verificaritem(cid, text) if (config[getPlayerLevel(cid)].itemid >= 1) then doPlayerAddItem(cid,config[getPlayerLevel(cid)].itemid,config[getPlayerLevel(cid)].quant) local text = ""..config.quant.."" .. getItemNameById(config[getPlayerVocation(cid)].itemid) .. "" return true end end function verificarpremmy(cid, text) if (config[getPlayerLevel(cid)].itemid >= 1) then local e = " e " end if (config[getPlayerLevel(cid)].premmy >= 1) then doPlayerAddPremiumDays(cid, config[getPlayerLevel(cid)].premmy) local text = "" .. e .. "" .. config.premmy .. " dias de premmy" return true end end [/code] ps. não testei ._. Há tempos que não programo e posso estar equivocado, mas não teria que retornar a var local nas funções de verificar?
Postado Outubro 2, 2012 12 anos Comedinhass ali no caso você usou meta-tables oque é uma tabela dentro da outra nesse caso é necessário usar pairs. Editado Outubro 2, 2012 12 anos por Skyforever (veja o histórico de edições)
Postado Outubro 10, 2012 12 anos Alguem pode arruma? to meio sem tempo... To faz 1 semana quereno fala isso lol ._.
Postado Outubro 10, 2012 12 anos acho que assim funciona function onAdvance(cid, skill, oldLevel, newLevel) local config = { {level = 50, itemid = {false, 2160,10}, premmy = 5, storage = 143801}, {level = 100, itemid = {true, 2160,1}, premmy = 0, storage = 143802}, {level = 150, itemid = {true, 2160,5}, premmy = 10, storage = 143803} } if skill ~= SKILL__LEVEL then return true end for i = 1, #config do if newLevel >= config[i].level and getPlayerStorageValue(cid, config[i].storage) == -1 then doPlayerSendTextMessage(cid,MESSAGE_STATUS_CONSOLE_BLUE,"Você recebeu"..(config[i].itemid[1] == true and ", "..config[i].itemid[3].." "..getItemNameById(config[i].itemid[2]) or "")..""..(config[i].premmy > 0 and ", "..config[i].premmy.." dias de premium" or "").." por chegar ao level "..config[i].level) if config[i].itemid[1] == true then doPlayerAddItem(cid, config[i].itemid[2], config[i].itemid[3]) end doPlayerAddPremiumDays(cid, config[i].premmy > 0 and config[i].premmy or 0) setPlayerStorageValue(cid, config[i].storage, 1) break end end return true end
Postado Outubro 10, 2012 12 anos Acho que funciona sim, o ruim é que se o cara quiser adicionar somente premium em tal level os items vão provavelmente dar erro...
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.