Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- OpenAction = function(action, shelf, text)
- if action["value"] == "checkout" then
- if payAmount > 0 and #Basket then
- CashRegister(text)
- else
- pNotify("Nie posiadasz nic w koszyku!", 'error', 1500)
- end
- else
- ShelfMenu(text, shelf)
- end
- end
- --[[ Cash register menu ]]--
- CashRegister = function(titel)
- local elements = {
- {label = '<span style="color:lightgreen; border-bottom: 1px solid lightgreen;">Potwierdz</span>', value = "yes"},
- {label = 'Kwota do zaplaty: <span style="color:green">$' .. payAmount ..'</span>'},
- }
- for i=1, #Basket do
- local item = Basket[i]
- table.insert(elements, {
- label = '<span style="color:red">*</span> ' .. item["label"] .. ': ' .. item["amount"] .. ' wartosc',
- value = item["value"],
- })
- end
- ESX.UI.Menu.CloseAll()
- ESX.UI.Menu.Open(
- 'default', GetCurrentResourceName(), 'penis',
- {
- title = "Sklep - " .. titel,
- align = 'center',
- elements = elements
- },
- function(data, menu)
- if data.current.value == "yes" then
- menu.close()
- ESX.UI.Menu.Open(
- 'default', GetCurrentResourceName(), 'penis2',
- {
- title = "Sklep - Wybor platnosci",
- align = 'center',
- elements = {
- {label = "Zaplac gotowka", value = "cash"},
- {label = "Zaplac karta kredytowa", value = "bank"},
- },
- },
- function(data2, menu2)
- ESX.TriggerServerCallback('99kr-shops:CheckMoney', function(hasMoney)
- if hasMoney then
- TriggerServerEvent('99kr-shops:Cashier', payAmount, Basket, data2.current["value"])
- payAmount = 0
- Basket = {}
- menu2.close()
- else
- pNotify("Nie podsiadasz wystarczajaco pieniedzy!", 'error', 1500)
- end
- end, payAmount, data2.current["value"])
- end,
- function(data2, menu2)
- menu2.close()
- end)
- end
- end,
- function(data, menu)
- menu.close()
- end)
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement