[Admin] tierrilopes Posted October 18, 2017 at 12:46 PM Share Posted October 18, 2017 at 12:46 PM Serve para trocar item A por item B. quest trade_items begin state start begin when 20008.click begin --NPC vnum, trigerred when click say("What items you wanna trade?") local item_trocas = { --{"Quest option", Item to give to npc, Quantity, Item to receive from npc, Quantity}, {"Reinforce item", 71085, 200, 71084, 20}, {"Piece of Stone", 27990, 200, 27993, 1}, --Add values here, with same structure as above } local escolha = {} for num1,str1 in ipairs(item_trocas) do table.insert(escolha, str1[1]) end local item_select = select_table(escolha, " Close ") local num_item = pc.count_item(item_trocas[item_select][2]) if item_select == table.getn(escolha) then return end say("Do you want to trade ".. item_trocas[item_select][1] .." x" .. item_trocas[item_select][3] .. " and receive "..item_name(item_trocas[item_select][4]).." x" .. item_trocas[item_select][5] .." ?") if select("Yes","No") == 2 then return end if num_item < item_trocas[item_select][3] then syschat("You dont have enough materials for the exchange.") return end pc.removeitem(item_trocas[item_select][2],item_trocas[item_select][3]) pc.give_item2(item_trocas[item_select][4], item_trocas[item_select][5]) end end end Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now