Ir para conteúdo

Shiuns

Membro
  • Registro em

  • Última visita

Solutions

  1. Shiuns's post in (Resolvido)[GLOBALEVENTS] Tp não abre com player no sqm indicado! was marked as the answer   
    local function hasBoss() local id = getGlobalStorageValue("bossSys") if id ~= -1 then if isMonster(id) then return true else return false end end return false end local postp, postpentrada = {x = 129, y = 66, z = 7},{x = 62, y = 339, z = 7} local days = {"thursday"} function onTime() if isInArray(days, os.date("%A")) then if not hasBoss() then local player = getTopCreature(postp).uid if player ~= 0 and isPlayer(player) then doTeleportThing(player, postpentrada) end doCreateTeleport(1387, postpentrada, postp) local id = doCreateMonster("Boss Stremoxy", {x = 38, y = 340, z = 7}) setGlobalStorageValue("bossSys", id) doBroadcastMessage("O Boss Stremoxy nasceu! Corram para matar ele -> Teleporte no templo!") end end return true end function onThink(interval, lastExecution) if hasBoss() then doSendAnimatedText(postp, "Boss", 245) doSendMagicEffect(postp, 11) end return true end  
  2. Shiuns's post in (Resolvido)Remover o item na backpack was marked as the answer   
    adc na lib essas funções:
     
    function getContainerItems(container, array, haveCap) array = array or {} haveCap = haveCap or false if not isContainer(container.uid) or getContainerSize(container.uid) == 0 then array[#array +1] = container else local size = getContainerSize(container.uid) haveCap = (getContainerCap(container.uid) -size) > 0 for slot = 0, (size -1) do local item = getContainerItem(container.uid, slot) if item.itemid > 1 then getContainerItems(item, array, haveCap) end end end return #array >= 1 and array, haveCap end function getContainerItemsById(container, itemid) local founds = {} local items = not container.uid and container or getContainerItems(container) for index, item in pairs(items) do if item.itemid == itemid then founds[#founds +1] = item end end return #founds >= 1 and founds end  
     
    e tenta usar a função do npc assim:
     
    local onSell = function(cid, item, subType, amount, ignoreCap, inBackpacks) if getPlayerSlotItem(cid, CONST_SLOT_BACKPACK).itemid ~= 0 then local bp = getPlayerSlotItem(cid, CONST_SLOT_BACKPACK) local z = getContainerItemsById(bp, item) if #z >= amount and items[item].sellPrice ~= 0 then doPlayerAddMoney(cid, items[item].sellPrice * amount) for i = 1, amount do doRemoveItem(z[i].uid) end end end return true end  
  3. Shiuns's post in (Resolvido)Colocar delay was marked as the answer   
    local globalEvent = 0 local function globalSave(minutes) if minutes <= 0 then doSetGameState(GAMESTATE_SHUTDOWN) os.exit(0) return true end if minutes == 1 then addEvent(doSaveServer, 59000) -- 59 segundos doBroadcastMessage("Global server save in " .. minutes .. " minute, please go to safe zone and logout. The save will not be longer than 1 minute.") elseif minutes <= 3 then doBroadcastMessage("Global server save in " .. minutes .. " minutes, please go to safe zone. The save will not be longer than 1 minute.") else doBroadcastMessage("Global server save in " .. minutes .. " minutes, please go to safe zone. The save will not be longer than 1 minute.") end globalEvent = addEvent(globalSave, 60000, minutes - 1) return true end function onTime(interval, lastExecution) setGlobalStorageValue(48572, 1) return globalSave(math.abs(math.ceil(5))) end  
  4. Shiuns's post in (Resolvido)[Action] Reset system por Action was marked as the answer   
    Falta estudar tabelas...
     
    local tabble = { {reqVoc= 7, needLevel=330000}, } print(tabble.reqVoc) -- retorna nil --------------------------- local tabble = { {reqVoc= 7, needLevel=330000}, } print(tabble[1].reqVoc) -- retorna 7 ---------------------------- o certo é usar: local tabble = { reqVoc= 7, needLevel= 330000, } print(tabble.reqVoc)  
     
     
     
    o código:
     
    function onUse(cid, fromPosition, itemEx, toPosition) local tabble = { reqVoc = 7, needLevel = 330000 } local config = { pid = getPlayerGUID(cid), newlv = 90000, life = 3599865, mana = 3599715 } if getPlayerLevel(cid) < 330000 and tabble.needLevel then doPlayerPopupFYI(cid, "Voce precisa ser level " .. needLevel .. " para resetar.") return true elseif tabble.reqVoc >= getPlayerVocation(cid) or 8 then doPlayerPopupFYI(cid, "Voce já é vocaçao.") return true elseif tabble.reqVoc <= 7 and getPlayerVocation(cid) then doPlayerPopupFYI(cid, "Voce precisa ser vocaçao para resetar.") return true end if tabble.reqVoc == getPlayerVocation(cid) then setPlayerStorageValue(cid, 887978, 1) end local newvoc = tabble.reqVoc ~= getPlayerVocation(cid) and (tabble.reqVoc+1) setPlayerStorageValue(cid, 887979, newvoc) doTeleportThing(cid, getTownTemplePosition(getPlayerTown(cid))) doRemoveCreature(cid) db.executeQuery("UPDATE `players` SET `level` = "..config.newlv..", `experience` = "..getExperienceForLevel(config.newlv)..",`manamax` = "..config.mana..",`health` = "..config.life..", `healthmax` = "..config.life..",`mana` = "..config.mana.." WHERE `id` = "..config.pid) return true end  
  5. Shiuns's post in (Resolvido)Ao upar club ganhar recompensa was marked as the answer   
    function onAdvance(cid, skill, oldLevel, newLevel) local config = { [50] = {item = 2160, count = 5}, [100] = {item = 2160, count = 15}, [150] = {item = 2160, count = 20}, [200] = {item = 2160, count = 25}, [250] = {item = 2160, count = 30}, [300] = {item = 2160, count = 50}, [350] = {item = 4891, count = 1}, [400] = {item = 4892, count = 1}, } if skill == SKILL_CLUB then for level, info in pairs(config) do if newLevel >= level and (getPlayerStorageValue(cid, 30705) == -1 or not (string.find(getPlayerStorageValue(cid, 30705), "'" .. level .. "'"))) then doPlayerAddItem(cid, info.item, info.count) doPlayerSendTextMessage(cid, MESSAGE_STATUS_WARNING, "Parabéns, você atingiu o level "..newLevel.." e ganhou "..info.count.." "..getItemNameById(info.item)..".") local sat = getPlayerStorageValue(cid, 30705) == -1 and "Values: '" .. level .. "'" or getPlayerStorageValue(cid, 30705) .. ",'" .. level .. "'" setPlayerStorageValue(cid, 30705, sat) end end end return true end  

Informação Importante

Confirmação de Termo