-
Notifications
You must be signed in to change notification settings - Fork 6
Expand file tree
/
Copy pathclient.lua
More file actions
89 lines (70 loc) · 2.18 KB
/
client.lua
File metadata and controls
89 lines (70 loc) · 2.18 KB
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
function startControl()
CreateThread(function()
while PL.active do
Wait(0)
PL:setObjectPos()
-- SHIFT
if IsControlPressed(0, 61) then
-- SHIFT+SCROLL
if IsControlJustReleased(0, 14) then
PL:decreaseHeading(10.0)
PL:normalizeHeading()
end
-- SHIFT+SCROLL
if IsControlJustReleased(0, 15) then
PL:increaseHeading(10.0)
PL:normalizeHeading()
end
else
-- X toggle move
if IsControlJustReleased(0, 120) then
PL:toggleMove()
PL:setOffset()
end
--RIGHT CLICK
if IsControlJustReleased(0, 25) then
PL:putItInFrontOfMe()
end
--E
if IsControlJustReleased(0, 38) then
PL:loadNextObject()
end
--SCROLL
if IsControlJustReleased(0, 14) then
PL:decreaseHeading(1.0)
PL:normalizeHeading()
end
--SCROLL
if IsControlJustReleased(0, 15) then
PL:increaseHeading(1.0)
PL:normalizeHeading()
end
--SCROLL DOWN
if IsControlJustReleased(1, 27) then
PL:saveCoords()
end
end
end
end)
end
RegisterCommand(Config.on_off_command, function()
PL:initPlace()
end)
AddEventHandler('eco_placement:moveObject', function(obj)
if PL.object ~= obj and DoesEntityExist(obj) then
PL.active = false
Wait(500)
PL:initPlace(obj)
end
end)
AddEventHandler('onResourceStop', function(resource)
if resource == GetCurrentResourceName() then
PL:deleteObject()
end
end)
function round(num, numDecimalPlaces)
return tonumber(string.format("%." .. (numDecimalPlaces or 0) .. "f", num))
end
RegisterNUICallback('nuiSync', function(data, cb)
cb(Config.on_off_command)
end)