Ir para conteúdo
Banner com Efeitos

Havokz

Membro
  • Registro em

  • Última visita

Histórico de Curtidas

  1. Curtir
    Havokz deu reputação a Skydangerous em Loot Crate System   
    Sistema simples de abrir uma box com algum objeto (No caso uma chave) e ter chance de ganhar outfits, items , montarias ou perder a chave.
     
     
    key_loot_crate.lua (Actions)
    local config = { key_break = 30, -- Porcentagem de chave quebrar crate_itemid = 1739, -- ItemID da Crate rewards = { [1] = { item = "addon", chance = 10, lookType = { [0] = 142, -- lookType Female [1] = 134, -- lookType Male }, addon = 2, name = "Warrior Sword", }, [2] = { item = "mount", chance = 20, mountId = 40, name = "Noble Lion", }, [3] = { item = {2160, 2}, chance = 30, }, [4] = { item = {2390, 1}, chance = 40, }, [5] = { item = {2195, 1}, chance = 50, }, [6] = { item = {2471, 2}, chance = 60, }, [7] = { item = {2469, 1}, chance = 70, }, [8] = { item = {2492, 2}, chance = 80, }, } } local function broadcast(message) for _, targetPlayer in ipairs(Game.getPlayers()) do targetPlayer:sendTextMessage(MESSAGE_STATUS_WARNING, message) end return true end function onUse(cid, item, fromPosition, itemEx, toPosition) local player = Player(cid) if (itemEx.itemid ~= config.crate_itemid) then return false end if (math.random(100) <= config.key_break) then toPosition:sendMagicEffect(3) player:sendTextMessage(MESSAGE_EVENT_ORANGE, "Na tentativa de abrir a crate, sua chave quebrou!") else local random = math.random(100) local i = 1 while (i <= #config.rewards) do local v = config.rewards[i] if (random <= v.chance) then if (v.item == "addon") then local lookType = v.lookType[player:getSex()] if (not player:hasOutfit(lookType, v.addon)) then player:addOutfitAddon(lookType, v.addon) broadcast(player:getName() .. " abriu uma loot crate e ganhou o addon ".. v.name .. ".") i = 9999 break else random = math.random(100) end elseif(v.item == "mount") then if (not player:hasMount(v.mountId)) then player:addMount(v.mountId) broadcast(player:getName() .. " abriu uma loot crate e ganhou a montaria ".. v.name .. ".") i = 9999 break else random = math.random(100) end else local new_item = player:addItem(v.item[1], v.item[2]) if (type(new_item) == "table") then new_item = new_item[1] end broadcast(player:getName() .. " abriu uma loot crate e ganhou ".. v.item[2] .. " ".. new_item:getName() .. ".") i = 9999 break end end i = i + 1 end if (i == 9999) then toPosition:sendMagicEffect(14) player:sendTextMessage(MESSAGE_EVENT_ORANGE, "Eh uma pena, mas a loot crate estava vazia.") else toPosition:sendMagicEffect(15) end end itemEx:remove() item:remove() return true end actions.xml
    <action itemid="22607" script="key_loot_crate.lua" /> <!-- Loot Crate Key --> HAVE FUN ! 

Informação Importante

Confirmação de Termo