-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathclient_extended.lua
62 lines (51 loc) · 1.85 KB
/
client_extended.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
function CutDigits(val)
return math.floor(val * 1000) / 1000
end
RegisterNUICallback('close', function(data, cb)
DisableSpoonerMode()
cb({})
end)
RegisterNUICallback('getAttachmentSettings', function(data, cb)
local props = GetEntityProperties(data.handle)
if not props or not props.attachment or props.attachment.to == 0 then return cb({value = 'nil'}) end
local from = data.handle
local clipboard = ('AttachEntityToEntity(%s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s)'):format(
GetAttachValues(from, props.attachment.to, props.attachment.bone, props.attachment.x, props.attachment.y, props.attachment.z, props.attachment.pitch, props.attachment.roll, props.attachment.yaw, props.attachment.useSoftPinning, props.attachment.collision, props.attachment.vertex, props.attachment.fixedRot)
)
cb({value = clipboard})
end)
----------------
-- Animations --
----------------
local animationInfo = {}
function StoreAnimationInfo(entity, animation)
animationInfo[tostring(entity)] = animation
end
function GetAnimationInfo(entity)
return animationInfo[tostring(entity)]
end
RegisterNUICallback('getAnimationSettings', function(data, cb)
local animation = GetAnimationInfo(data.handle)
if not animation then return cb({value = 'nil'}) end
local entity = data.handle
local clipboard = ''
if GetEntityType(entity) == 3 then
clipboard = ("PlayEntityAnim(%s, '%s', '%s', %s, %s, %s, %s, %s, %s)"):format(
GetAnimationValues(entity, animation)
)
else
clipboard = ("TaskPlayAnim(%s, '%s', '%s', %s, %s, %s, %s, %s, %s, %s, %s, '%s', %s)"):format(
GetAnimationValues(entity, animation)
)
end
cb({value = clipboard})
end)
RegisterNUICallback('stopAnimation', function(data, cb)
local entity = data.handle
if GetEntityType(entity) == 3 then -- object
TryStopEntityAnim(entity)
else -- ped
TryClearTasks(entity)
end
cb({})
end)