forked from CsokiHUN/fl_dashboard
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathshared.lua
85 lines (75 loc) · 1.55 KB
/
shared.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
ADMIN_GROUPS = {
admin = true,
superadmin = true,
moderator = true,
}
PREMIUM = {
items = {
{
name = "burger",
price = 100,
},
{
name = "beer",
price = 100,
},
{
name = "cola",
price = 5,
},
},
vehicles = {
{
name = "sultan",
price = 100,
},
{
name = "sultanrs",
price = 100,
},
{
name = "enduro",
price = 10000,
},
},
money = {
{ price = 1000, name = 1000, img = "http://pluspng.com/img-png/money-png--3179.png" },
{ price = 500, name = 10000, img = "http://pluspng.com/img-png/money-png--3179.png" },
},
}
function getItemImagePath(itemName)
return "nui://ox_inventory/web/images/" .. itemName .. ".png"
end
function getItemData(Item, typ)
for _, item in pairs(PREMIUM[typ]) do
if item.name == Item.name and item.price then
return item
end
end
return false
end
function secondsToClock(seconds)
local seconds = tonumber(seconds)
if not seconds then
return "00:00:00"
end
if seconds <= 0 then
return "00:00:00"
end
local hours = string.format("%02.f", math.floor(seconds / 3600))
local mins = string.format("%02.f", math.floor(seconds / 60 - (hours * 60)))
local secs = string.format("%02.f", math.floor(seconds - hours * 3600 - mins * 60))
return hours .. ":" .. mins .. ":" .. secs
end
function chatbox(message, color, target)
local msg = {
color = color or { 255, 255, 255 },
multiline = true,
args = { "Szerver", message },
}
if IsDuplicityVersion() then
TriggerClientEvent("chat:addMessage", target or -1, msg)
return
end
TriggerEvent("chat:addMessage", msg)
end