-
Notifications
You must be signed in to change notification settings - Fork 10
Expand file tree
/
Copy pathclient.lua
More file actions
87 lines (74 loc) · 2.39 KB
/
client.lua
File metadata and controls
87 lines (74 loc) · 2.39 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
local lastStandTrigger = false
local function loadAnimDict(dict)
while (not HasAnimDictLoaded(dict)) do
RequestAnimDict(dict)
Wait(0)
end
end
local function loadAnimDict(dict)
while (not HasAnimDictLoaded(dict)) do
RequestAnimDict(dict)
Wait(0)
end
end
local function movement(ped, num)
ClearPedTasks(ped)
TaskPlayAnimAdvanced(ped, "move_injured_ground", "front_loop", GetEntityCoords(ped), 1.0, 0.0, GetEntityHeading(ped), 1.0, 1.0, 1.0, num, 1.0, 0, 0)
end
local function doRagdoll(ped)
Wait(2000)
local heading = GetEntityHeading(ped)
local pos = GetEntityCoords(ped)
NetworkResurrectLocalPlayer(pos.x, pos.y, pos.z + 0.5, heading, true, false)
end
CreateThread(function()
while true do
local sleep = 1000
if lastStandTrigger then
sleep = 0
local ped = PlayerPedId()
local heading = GetEntityHeading(ped)
if IsDisabledControlPressed(0, 34) then
SetEntityHeading(ped, GetEntityHeading(ped) + 0.25 )
elseif IsDisabledControlPressed(0, 35) then
SetEntityHeading(ped, GetEntityHeading(ped) - 0.25 )
end
if IsDisabledControlJustPressed(0, 32) then
movement(ped, 47)
elseif IsDisabledControlJustReleased(0, 32) then
movement(ped, 46)
end
end
end
Wait(sleep)
end
end)
AddEventHandler('gameEventTriggered', function(event, data)
if event == "CEventNetworkEntityDamage" then
local victim, attacker, victimDied, weapon = data[1], data[2], data[4], data[7]
if not IsEntityAPed(victim) then return end
if victimDied and NetworkGetPlayerIndexFromPed(victim) == PlayerId() and IsEntityDead(victim) then
-- doRagdoll(victim)
if not lastStandTrigger then
lastStandTrigger = true
end
end
end
end)
loadAnimDict("move_injured_ground")
-- QB or QBox
--[[
AddEventHandler('hospital:client:Revive', function()
lastStandTrigger = false
end)
]]--
-- ESX Choose One Whic Support Your Script
-- IF YOU DIE YOU ARE IN RAGDOLL STATE PLEASE UNCOMMENT "-- doRagdoll(victim)"
--[[
AddEventHandler('esx:onPlayerDeath', function(data)
lastStandTrigger = false
end)
AddEventHandler('playerSpawned', function(spawn)
lastStandTrigger = false
end)
]]--