Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function item.open_shop(vnum)
- local shopCount = mysql_query("player", "select count(*) from shop_item where shop_vnum = '"..tonumber(vnum).."';")
- local shopItems = mysql_query("player", "select item_vnum, count from shop_item where shop_vnum = '"..tonumber(vnum).."';")
- local tableItem = {}
- -- local tableItemNames = {}
- for i = 1, tonumber(shopCount[1][1]) do
- table.insert(tableItem, item_name(shopItems[i][1])" x"..tonumber(shopItems[i][2]))
- end
- table.insert(tableItem, "Zamknij")
- local wybor = select_table(tableItem)
- if wybor = tonumber(shopCount[1][1])+1 then
- return
- end
- say_title("Sklep przenośny:")
- say()
- say_item(tableItem[wybor][1], shopItems[wybor][1], "")
- say()
- -----------
- local itemPrice = mysql_query("player", "select gold from player where vnum = '"..shopItems[wybor][1].."';")
- local itemSize = mysql_query("player", "select size from player where vnum = '"..shopItems[wybor][1].."';")
- say("Czy chcesz zakupić ten przedmiot za "..(tonumber(itemPrice[1][1]))*(tonumber(shopItems[i][2])).." Yang?")
- say()
- if select("Tak", "Nie") == 1 then
- if pc.get_gold() < (tonumber(itemPrice[1][1]))*(tonumber(shopItems[i][2])) then
- syschat("<Sklep> Nie masz wystarczającej ilości Yang.")
- return
- end
- if pc.get_empty_inventory_count() < tonumber(itemSize[1][1]) then
- syschat("<Sklep> Nie masz wolnego miejscu w ekwipunku.")
- return
- end
- pc.change_gold(-(tonumber(itemPrice[1][1]))*(tonumber(shopItems[i][2])))
- pc.give_item2(shopItems[wybor][1], shopItems[wybor][2])
- end
- end
Advertisement
Add Comment
Please, Sign In to add comment