-
Notifications
You must be signed in to change notification settings - Fork 14
/
Copy pathunarmed_knockout.lua
93 lines (92 loc) · 3.9 KB
/
unarmed_knockout.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
93
local QBCore = exports["qb-core"]:GetCoreObject()
local knockedOut = false
local wait = 15
local count = 60
local isdead = false
CreateThread(function()
while true do
Wait(1)
local ped = PlayerPedId()
PlayerData = QBCore.Functions.GetPlayerData()
if IsPedInMeleeCombat(ped) then
-- {UNARMED ONLY}
if (HasPedBeenDamagedByWeapon(ped, GetHashKey("WEAPON_UNARMED"), 0)) then
-- Health to be knocked out
if GetEntityHealth(ped) < 145 then
SetPlayerInvincible(ped, false)
-- Position taken by your Ped
SetPedToRagdoll(ped, 1000, 1000, 0, 0, 0, 0)
-- Time to wait
wait = 60
QBCore.Functions.Progressbar("knocked-out", "unconscious...", 45000, false, false, {
disableMovement = true,
disableCarMovement = true,
disableMouse = false,
disableCombat = true
},
{},
{},
{},
function()
-- Done
QBCore.Functions.Notify("Finally you're awake!", "success", 5000)
end,
function()
end,
"fa-solid fa-face-dizzy")
-- QBCore.Functions.Progressbar("knocked-out", "unconscious...", 45000, math.random(18000, 30000), false, false, {
-- disableMovement = true,
-- disableCarMovement = true,
-- disableMouse = false,
-- disableCombat = true,
-- }, {}, {}, {},
-- function()
-- Done
-- QBCore.Functions.Notify("Finally you're awake!", "success", 5000)
-- end,
-- function()
-- end)
knockedOut = true
-- Health after knockout preferably dont make it more than 150 (50 %) because people will abuse with it {No need to go to hospital or so}
SetEntityHealth(ped, 140)
end
end
end
if knockedOut == true then
--Your ped is able to die
SetPlayerInvincible(ped(), false)
DisablePlayerFiring(ped(), true)
SetPedToRagdoll(ped, 1000, 1000, 0, 0, 0, 0)
ResetPedRagdollTimer(ped)
-- Blur Cam
SetTimecycleModifier("hud_def_blur")
if wait >= 0 then
count = count - 1
if count == 0 then
count = 60
wait = wait - 1
--- in case bark
if GetEntityHealth(ped) <= 50 then
-- Ped healing
SetEntityHealth(ped, GetEntityHealth(ped) + 2)
end
end
else
-- Remove Blue cam
SetTimecycleModifier("")
SetTransitionTimecycleModifier("")
-- Ped Able to die again
SetPlayerInvincible(ped(), false)
knockedOut = false
end
end
-- Simple clear Knockout if Dead
if PlayerData['isdead']then
-- Remove Konockout effect
SetTimecycleModifier("")
SetTransitionTimecycleModifier("")
knockedOut = false
end
end
end
)