-
Notifications
You must be signed in to change notification settings - Fork 8
/
main.lua
127 lines (111 loc) · 4.23 KB
/
main.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
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
local Menu = zUI.CreateMenu("Titre", "Sous-Titre", "Voici la description",
nil, "F1", "Ouvrir le Menu exemple.")
local subMenu = zUI.CreateSubMenu(Menu, "Titre", "Sous-Titre", "Voici la description")
local checkboxState = false
local percentage = 0
local index = 1
local colorListIndex = 1
Menu:SetItems(function(Items)
Items:AddSeparator("Séparateur")
Items:AddLine()
Items:AddButton("Titre", "Je suis un bouton", {},
function(onSelected, onHovered)
end, subMenu)
Items:AddLinkButton("Titre", "Je suis un bouton lien", {}, "https://zsquad.fr")
Items:AddCheckbox("Titre", "Je suis une checkbox", checkboxState, {}, function(onSelected, onHovered)
if onSelected then
checkboxState = not checkboxState
end
end)
Items:AddSlider("Titre", "Je suis un slider", percentage, 10, {},
function(onSelected, onHovered, onChange, percentage)
if onChange then
percentage = percentage
end
end)
Items:AddList("Titre", "Je suis une liste", index, { "Item #1", "Item #2" }, {},
function(onSelected, onHovered, onListChange, i)
if onListChange then
index = i
end
end)
Items:AddColorList("Titre", "C'est une liste de couleurs", colorListIndex,
{ "#00ff00", "#fffd2c", "#ff00ff", "#ff0000", "#0000ff" }, {},
function(onSelected, onHovered, onListChange, index)
if onListChange then
colorListIndex = index
end
end)
end)
subMenu:SetItems(function(Items)
Items:AddSeparator("Sous Menu", "right")
Items:AddLine()
Items:AddButton("Titre", "Je suis un bouton", {}, function(onSelected, onHovered)
if onSelected then
local value = zUI.ShowModal("Titre", {
{ type = "text", name = "Text input", description = "Input description", isRequired = false, minLength = 4, maxLength = 15 },
{ type = "number", name = "Number input", description = "Input description", isRequired = false },
{ type = "checkbox", name = "Checkbox input", description = "Input description", defaultValue = true },
{ type = "colorpicker", name = "Color input", defaultValue = "#faad2c" },
{ type = "date", name = "Date input", format = "DD/MM/YYYY" }
}, {})
print(value[1])
end
end)
Items:AddButton("Titre", "Je suis un bouton", {}, function(onSelected, onHovered)
if onHovered then
zUI.ShowInfo("Titre", nil, {
{ "Titre", "Valeur" },
{ "Titre", "Valeur" },
{ "Titre", "Valeur" },
{ "Titre", "Valeur" },
})
end
end)
end)
Menu:OnOpen(function()
print("Menu open")
end)
subMenu:OnOpen(function()
print("subMenu open")
end)
Menu:OnClose(function()
print("Menu close")
end)
subMenu:OnClose(function()
print("subMenu close")
end)
zUI.CreateContext("vehicle", function(Items, coords3D, Entity)
Items:AddSeparator("vehicle")
end)
zUI.CreateContext("props", function(Items, coords3D, Entity)
Items:AddSeparator("props")
end)
zUI.CreateContext("ped", function(Items, coords3D, Entity)
Items:AddSeparator("ped")
end)
zUI.CreateContext("other", function(Items, coords3D, Entity)
Items:AddSeparator("other")
end)
local coords = vector3(350.46109008789, 932.27905273438, 203.43138122559)
zUI.CreateContext(coords, function(Items, coords3D, Entity)
Items:AddSeparator("vector")
end)
local withContext = true
Citizen.CreateThread(function()
while true do
Wait(0)
if #(coords - GetEntityCoords(PlayerPedId())) < 3 then
if withContext then
zUI.DisplayPulsingNotification("", "", coords, { IsDisabled = true })
else
zUI.DisplayPulsingNotification("E", "Intéragir", coords, {})
if IsControlJustPressed(0, 51) then
zUI.SendNotification("Titre", "Vous avez appuyer sur E", {},
"https://i.postimg.cc/jSs6YGNh/ZProject-4.jpg",
"https://i.postimg.cc/pdrDpzsh/ZBanner-Paypal.png")
end
end
end
end
end)