-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathclient.lua
More file actions
77 lines (63 loc) · 2.17 KB
/
Copy pathclient.lua
File metadata and controls
77 lines (63 loc) · 2.17 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
local ox_inventory = exports["ox_inventory"]
local function playPlateAnim(vehicle)
if cache.vehicle then
return false, "player_in_vehicle"
end
local platelight = GetEntityBoneIndexByName(vehicle, "platelight")
local bumper = GetEntityBoneIndexByName(vehicle, "bumper_f")
local engine = GetEntityBoneIndexByName(vehicle, "engine")
local engineblock = GetEntityBoneIndexByName(vehicle, "engineblock")
local plateCoords = nil
if platelight ~= -1 then
plateCoords = GetWorldPositionOfEntityBone(vehicle, platelight)
elseif bumper ~= -1 then
plateCoords = GetWorldPositionOfEntityBone(vehicle, bumper)
elseif engine ~= -1 then
plateCoords = GetWorldPositionOfEntityBone(vehicle, engine)
elseif engineblock ~= -1 then
plateCoords = GetWorldPositionOfEntityBone(vehicle, engineblock)
end
if not plateCoords then
return false, "vehicle_no_plate"
end
local coords = GetEntityCoords(cache.ped)
local distance = #(coords - plateCoords)
if distance > 1 then
return false, "plate_too_far"
end
TaskTurnPedToFaceEntity(cache.ped, vehicle, 1000)
Wait(1000)
local success = lib.progressBar({
duration = 5000,
label = locale("progress_label"),
useWhileDead = false,
canCancel = true,
disable = {
car = true,
move = true,
combat = true,
},
anim = {
dict = "anim@amb@clubhouse@tutorial@bkr_tut_ig3@",
clip = "machinic_loop_mechandplayer",
flag = 1,
},
prop = {
model = `prop_tool_screwdvr01`,
bone = 57005, -- Right hand
pos = {x = 0.09, y = 0.1, z = -0.01},
rot = {x = 90.0, y = 0.0, z = 0.0},
},
})
ClearPedTasks()
local vehicleCoords = GetEntityCoords(vehicle)
if #(coords - vehicleCoords) > 5.0 then
return false, "vehicle_too_far"
end
return success
end
lib.callback.register("sd_fakeplate:playAnim", function(netId)
local vehicle = NetToVeh(netId)
local animResult, animMessage = playPlateAnim(vehicle)
return animResult, animMessage
end)