-
Notifications
You must be signed in to change notification settings - Fork 21
/
Copy pathclient.lua
103 lines (97 loc) · 3.79 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
93
94
95
96
97
98
99
100
101
102
103
-- Script Created by Giant Cheese Wedge (AKA Blü)
-- Script Modified and fixed by Hoopsure
local crouched = false
local proned = false
crouchKey = 26
proneKey = 36
Citizen.CreateThread( function()
while true do
Citizen.Wait( 1 )
local ped = GetPlayerPed( -1 )
if ( DoesEntityExist( ped ) and not IsEntityDead( ped ) ) then
ProneMovement()
DisableControlAction( 0, proneKey, true )
DisableControlAction( 0, crouchKey, true )
if ( not IsPauseMenuActive() ) then
if ( IsDisabledControlJustPressed( 0, crouchKey ) and not proned ) then
RequestAnimSet( "move_ped_crouched" )
RequestAnimSet("MOVE_M@TOUGH_GUY@")
while ( not HasAnimSetLoaded( "move_ped_crouched" ) ) do
Citizen.Wait( 100 )
end
while ( not HasAnimSetLoaded( "MOVE_M@TOUGH_GUY@" ) ) do
Citizen.Wait( 100 )
end
if ( crouched and not proned ) then
ResetPedMovementClipset( ped )
ResetPedStrafeClipset(ped)
SetPedMovementClipset( ped,"MOVE_M@TOUGH_GUY@", 0.5)
crouched = false
elseif ( not crouched and not proned ) then
SetPedMovementClipset( ped, "move_ped_crouched", 0.55 )
SetPedStrafeClipset(ped, "move_ped_crouched_strafing")
crouched = true
end
elseif ( IsDisabledControlJustPressed(0, proneKey) and not crouched and not IsPedInAnyVehicle(ped, true) and not IsPedFalling(ped) and not IsPedDiving(ped) and not IsPedInCover(ped, false) and not IsPedInParachuteFreeFall(ped) and (GetPedParachuteState(ped) == 0 or GetPedParachuteState(ped) == -1) ) then
if proned then
ClearPedTasks(ped)
local me = GetEntityCoords(ped)
SetEntityCoords(ped, me.x, me.y, me.z-0.5)
proned = false
elseif not proned then
RequestAnimSet( "move_crawl" )
while ( not HasAnimSetLoaded( "move_crawl" ) ) do
Citizen.Wait( 100 )
end
ClearPedTasksImmediately(ped)
proned = true
if IsPedSprinting(ped) or IsPedRunning(ped) or GetEntitySpeed(ped) > 5 then
TaskPlayAnim(ped, "move_jump", "dive_start_run", 8.0, 1.0, -1, 0, 0.0, 0, 0, 0)
Citizen.Wait(1000)
end
SetProned()
end
end
end
else
proned = false
crouched = false
end
end
end)
function SetProned()
ped = PlayerPedId()
ClearPedTasksImmediately(ped)
TaskPlayAnimAdvanced(ped, "move_crawl", "onfront_fwd", GetEntityCoords(ped), 0.0, 0.0, GetEntityHeading(ped), 1.0, 1.0, 1.0, 46, 1.0, 0, 0)
end
function ProneMovement()
if proned then
ped = PlayerPedId()
DisableControlAction(0, 23)
DisableControlAction(0, 21)
if IsControlPressed(0, 32) or IsControlPressed(0, 33) then
DisablePlayerFiring(ped, true)
elseif IsControlJustReleased(0, 32) or IsControlJustReleased(0, 33) then
DisablePlayerFiring(ped, false)
end
if IsControlJustPressed(0, 32) and not movefwd then
movefwd = true
TaskPlayAnimAdvanced(ped, "move_crawl", "onfront_fwd", GetEntityCoords(ped), 1.0, 0.0, GetEntityHeading(ped), 1.0, 1.0, 1.0, 47, 1.0, 0, 0)
elseif IsControlJustReleased(0, 32) and movefwd then
TaskPlayAnimAdvanced(ped, "move_crawl", "onfront_fwd", GetEntityCoords(ped), 1.0, 0.0, GetEntityHeading(ped), 1.0, 1.0, 1.0, 46, 1.0, 0, 0)
movefwd = false
end
if IsControlJustPressed(0, 33) and not movebwd then
movebwd = true
TaskPlayAnimAdvanced(ped, "move_crawl", "onfront_bwd", GetEntityCoords(ped), 1.0, 0.0, GetEntityHeading(ped), 1.0, 1.0, 1.0, 47, 1.0, 0, 0)
elseif IsControlJustReleased(0, 33) and movebwd then
TaskPlayAnimAdvanced(ped, "move_crawl", "onfront_bwd", GetEntityCoords(ped), 1.0, 0.0, GetEntityHeading(ped), 1.0, 1.0, 1.0, 46, 1.0, 0, 0)
movebwd = false
end
if IsControlPressed(0, 34) then
SetEntityHeading(ped, GetEntityHeading(ped)+2.0 )
elseif IsControlPressed(0, 35) then
SetEntityHeading(ped, GetEntityHeading(ped)-2.0 )
end
end
end