diff --git a/qbx_crouch/client.lua b/qbx_crouch/client.lua new file mode 100644 index 0000000..c1d3ea6 --- /dev/null +++ b/qbx_crouch/client.lua @@ -0,0 +1,25 @@ +AddStateBagChangeHandler('crouch', ('player:%s'):format(cache.serverId), function(_, _, value, _, replicated) + if replicated then return end + lib.requestAnimSet('move_Ped_crouched') + if not value then + ResetPedMovementClipset(cache.ped, 1.0) + ResetPedWeaponMovementClipset(cache.ped) + ResetPedStrafeClipset(cache.ped) + SetPedStealthMovement(cache.ped, false, 'DEFAULT_ACTION') + else + SetPedMovementClipset(cache.ped, 'move_Ped_crouched', 1.0) + SetPedStrafeClipset(cache.ped, 'move_Ped_crouched_strafing') + end + RemoveAnimSet('move_Ped_crouched') +end) + +lib.addKeybind({ + name = 'crouch', + description = 'Crouch', + defaultKey = 'K', + onReleased = function(self) + if cache.vehicle then return end + LocalPlayer.state:set("crouch", not LocalPlayer.state.crouch, false) + end +}) + diff --git a/qbx_tackle/server.lua b/qbx_tackle/server.lua index 7d2cdc4..5f86ec5 100644 --- a/qbx_tackle/server.lua +++ b/qbx_tackle/server.lua @@ -1,3 +1,10 @@ -RegisterNetEvent('tackle:server:TacklePlayer', function(source) - TriggerClientEvent('tackle:client:GetTackled', source) +RegisterNetEvent('tackle:server:TacklePlayer', function(target) + local src = source + + local srcCoords = GetEntityCoords(GetPlayerPed(src)) + local targetCoords = GetEntityCoords(GetPlayerPed(target)) + + if #(srcCoords - targetCoords) > 2.0 then return end + + TriggerClientEvent('tackle:client:GetTackled', target) end)