-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathmain.lua
83 lines (72 loc) · 1.64 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
local showtrainer = false
Citizen.CreateThread(function()
while true do
Wait(1)
if IsControlJustReleased(1, 167) and not blockinput then -- f6
if not showtrainer then
showtrainer = true
SendNUIMessage({
showtrainer = true
})
else
showtrainer = false
SendNUIMessage({
hidetrainer = true
})
end
end
if showtrainer and not blockinput then
if IsControlJustReleased(1, 176) then -- enter
SendNUIMessage({
trainerenter = true
})
elseif IsControlJustReleased(1, 177) then -- back / right click
SendNUIMessage({
trainerback = true
})
end
if IsControlJustReleased(1, 172) then -- up
SendNUIMessage({
trainerup = true
})
elseif IsControlJustReleased(1, 173) then -- down
SendNUIMessage({
trainerdown = true
})
end
if IsControlJustReleased(1, 174) then -- left
SendNUIMessage({
trainerleft = true
})
elseif IsControlJustReleased(1, 175) then -- right
SendNUIMessage({
trainerright = true
})
end
end
end
end)
RegisterNUICallback("playsound", function(data, cb)
PlaySoundFrontend(-1, data.name, "HUD_FRONTEND_DEFAULT_SOUNDSET", true)
cb("ok")
end)
RegisterNUICallback("trainerclose", function(data, cb)
showtrainer = false
cb("ok")
end)
function drawNotification(text)
SetNotificationTextEntry("STRING")
AddTextComponentString(text)
DrawNotification(false, false)
end
function stringsplit(inputstr, sep)
if sep == nil then
sep = "%s"
end
local t={} ; i=1
for str in string.gmatch(inputstr, "([^"..sep.."]+)") do
t[i] = str
i = i + 1
end
return t
end