Teria como olhar o script pra mim brow?
gems.lua
function onUse(cid, item, fromPosition, itemEx, toPosition)gem = gems.id[getPlayerVocation(cid)]if item.itemid == gem thendoUseGem(cid, item, getPlayerVocation(cid))endreturn TRUEend
actions.xml
<action itemid="2156" script="gems.lua"/><action itemid="2155" script="gems.lua"/><action itemid="2158" script="gems.lua"/><action itemid="2153" script="gems.lua"/>
Pivi.lua pasta lib
function doUseGem(cid, item) local voc = getPlayerVocation(cid) local interval = gems.interval[voc] if item.itemid ~= gems.id[voc] or getPlayerStorageValue(cid, gems.storage[voc]) > 0 then return FALSE end setPlayerStorageValue(cid, gems.storage[voc], 1) sendGemEffect(cid, gems.storage[voc], gems.interval[voc]) doRemoveItem(item.uid, 1)
return TRUE end
function sendGemEffect(cid, storage, interval) local pos = getThingPos(cid) local voc = getPlayerVocation(cid) local color = 1 if voc == 1 then color = gemMsg.colorDruid[math.random(1,#gemMsg.colorDruid)] elseif voc == 2 then color = gemMsg.colorSorcerer[math.random(1,#gemMsg.colorSorcerer)] elseif voc == 3 then color = gemMsg.colorPaladin[math.random(1,#gemMsg.colorPaladin)] elseif voc == 4 then color = gemMsg.colorKnight[math.random(1,#gemMsg.colorKnight)] elseif voc == 5 then color = gemMsg.colorDruid[math.random(1,#gemMsg.colorElderDruid)] elseif voc == 6 then color = gemMsg.colorSorcerer[math.random(1,#gemMsg.colorMasterSorcerer)] elseif voc == 7 then color = gemMsg.colorPaladin[math.random(1,#gemMsg.colorRoyalPaladin)] elseif voc == 8 then color = gemMsg.colorKnight[math.random(1,#gemMsg.colorEliteKnight)] end doSendAnimatedText(pos, gemMsg.rnd[math.random(1,#gemMsg.rnd)], color) if getPlayerStorageValue(cid, gems.storage[getPlayerVocation(cid)]) >= 1 then addEvent(sendGemEffect, interval, cid, storage, interval) end end function doRemoveGemEffect(cid) if getPlayerStorageValue(cid, gems.storage[getPlayerVocation(cid)]) < 1 then return FALSE end setPlayerStorageValue(cid, gems.storage[getPlayerVocation(cid)], 0) return TRUE end function doRemoveAllGemEffect(cid) for i = 1, table.maxn(gms.storage) do setPlayerStorageValue(cid, gems.storage, 0) end return TRUE end function isGemActivated(cid) if getPlayerStorageValue(cid, gems.storage[getPlayerVocation(cid)]) > 0 then return TRUE end return FALSE end
Pivi_const.lua pasta lib
gems = { id = {2156, 2155, 2158, 2153, 2156, 2155, 2158, 2156}, storage = {5001, 5002, 5003, 5004, 5005, 5006, 5007, 5008}, interval = {600, 600, 600, 600, 600, 600, 600}, -- Intervalo dos efeitos } gemMsg = { rnd = {"´ . ,", ". ´ ,", "` . ,", ", ´ ."}, colorDruid = {182,213}, colorSorcerer = {215,215}, colorPaladin = {89,89}, colorKnight = {210,210}, colorElderDruid = {182,213}, colorMasterSorcerer = {215,215}, colorRoyalPaladin = {89,89}, colorEliteKnight = {210,210} }