forked from TerbSEC/Radargun
-
Notifications
You must be signed in to change notification settings - Fork 0
/
client.lua
92 lines (84 loc) · 2.46 KB
/
client.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
local shown = false
local isPed = false
local isFreeAiming = false
local getSelectedWeapon = false
Citizen.CreateThread(function()
while(true) do
isPed = PlayerPedId()
isFreeAiming = IsPlayerFreeAiming(PlayerId())
getSelectedWeapon = GetSelectedPedWeapon(isPed) == GetHashKey(cfg.radargun)
if shown then
if getSelectedWeapon then
if isFreeAiming then
player = isPed
coordA = GetOffsetFromEntityInWorldCoords(player, 0.0, 1.0, 1.0)
coordB = GetOffsetFromEntityInWorldCoords(player, 0.0, 105.0, 0.0)
frontcar = StartShapeTestCapsule(coordA, coordB, 3.0, 10, player, 7)
a, b, c, d, e = GetShapeTestResult(frontcar)
playerId = PlayerId()
pos = GetEntityCoords(e)
end
end
end
Citizen.Wait(500)
end
end)
Citizen.CreateThread( function()
while true do
Citizen.Wait(1)
-- ////////////////////////////////////////////////////////////////
-- DISABLE Attack/Weapon firing and MeleeAttackAlternate
if getSelectedWeapon then
DisableControlAction( 0, 24, true ) -- Attack
DisablePlayerFiring(isPed, true ) -- Disable weapon firing
DisableControlAction( 0, 142, true ) -- MeleeAttackAlternate
end
-- ////////////////////////////////////////////////////////////////
if IsControlJustPressed(1, cfg.menuopen) then --246 = Y
if getSelectedWeapon then
if shown == true then
shown = false
SendNUIMessage({
action = "close",
})
else
SendNUIMessage({
action = "open",
})
shown = true
end
else
if shown == true then
SendNUIMessage({
action = "close",
})
shown = false
end
end
end
if shown then
if getSelectedWeapon then
if IsControlJustPressed(1, cfg.bottomfreeze) then --38 = E
if IsEntityAVehicle(e) then
if isFreeAiming then
PlaySoundFrontend(-1, "5_Second_Timer", "DLC_HEISTS_GENERAL_FRONTEND_SOUNDS", false)
if cfg.metric == true then
local fvspeed = GetEntitySpeed(e)*3.6 -- m/s to kmh
SendNUIMessage({
speed = math.ceil(fvspeed),
range = GetDistanceBetweenCoords(GetEntityCoords(isPed),GetEntityCoords(e), true)
})
else
local fvspeed = GetEntitySpeed(e)*2.23694 -- m/s to mph
SendNUIMessage({
speed = math.ceil(fvspeed),
range = GetDistanceBetweenCoords(GetEntityCoords(isPed),GetEntityCoords(e), true)
})
end
end
end
end
end
end
end
end)