-
Notifications
You must be signed in to change notification settings - Fork 0
/
pay.lua
106 lines (58 loc) · 2.11 KB
/
pay.lua
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
local payment = {}
RegisterNetEvent('rs_payment:Payment', function()
local src = source
local dialog = lib.inputDialog('Make Payment', {
-- title 1
{type = 'input', label = 'Payment description', description = 'Enter title for payment'},
-- identifier 2
{type = 'number', label = 'Total', description = 'Price', icon = 'hashtag'},
{type = 'number', label = 'ID', description = 'ID'},
{type = "select",label = "Payment style", options = {{ value = 'send', label = 'Send Payment' },{ value = 'make', label = 'Make Payment' }}}
})
if dialog then
payment = dialog
if payment[4] == 'send' then
TriggerServerEvent('rs_payment:SendPayment', payment[1], payment[2], payment[3])
end
if payment[4] == 'make' then
TriggerServerEvent('rs_payment:MakePayment', payment[1], payment[2], payment[3])
end
end
end)
RegisterNetEvent('rs_payment:GetBills', function(bills)
local data = bills
if not data then
TriggerEvent('DoLongHudText', 'Pole arveid')
end
--print(json.encode(data[1].paid))
if data then
local menu = {}
local catmenu = {}
local categoryMenu = {}
for k, v in pairs(data) do
if type(data) == 'table' then
catmenu[v] = v
end
end
for k, v in pairs(catmenu) do
categoryMenu[#categoryMenu + 1] = {
title = 'Arve: '..v.detail,
arrow = true,
description = 'Staatus: '..v.paid..' Hind: '..v.amount..'$',
serverEvent = 'PayBill',
args = {
price = v.amount
}
}
end
lib.registerContext({
id = 'test',
title = "Arved",
menu = 'test',
options = categoryMenu,
})
lib.showContext('test')
else
menu = {}
end
end)