Skip to content

Commit

Permalink
Merge pull request #6 from realCallMeJ/main2
Browse files Browse the repository at this point in the history
feat: disable npwd when cuffed
  • Loading branch information
Andyyy7666 authored Feb 2, 2024
2 parents 98a34e1 + 1b3c3fc commit 825cbd0
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion client/cuff.lua
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
local isCuffed = false
local currentCuffType = "cuffs"
local npwd = GetResourceState("npwd") == "started"

local cuffSounds = {
cuffs = {"cuff", "uncuff"},
Expand Down Expand Up @@ -81,6 +82,10 @@ local function toggleHandsUp(status, animType)
local state = Player(cache.serverId).state
if state.gettingCuffed or state.isCuffed or state.isCuffing then return end

if npwd then
exports.npwd:setPhoneDisabled(status)
end

exports.ox_target:disableTargeting(status)
state:set("handsUp", status, true)
handsUpStatus = status
Expand Down Expand Up @@ -168,7 +173,7 @@ local function setCuffed(enabled, angle, cuffType)
state:set("isCuffed", false, true)
state:set("cuffType", false, true)
exports.ox_target:disableTargeting(false)
return
return npwd and exports.npwd:setPhoneDisabled(false)
end

toggleHandsUp(false)
Expand All @@ -186,6 +191,10 @@ local function setCuffed(enabled, angle, cuffType)
state:set("cuffType", cuffType, true)
exports.ox_target:disableTargeting(true)

if npwd then
exports.npwd:setPhoneDisabled(true)
end

local entity = CreateObject(model, 0, 0, 0, true, true, true)
AttachEntityToEntity(entity, ped, GetPedBoneIndex(ped, 0x49D9), pos.x, pos.y, pos.z, rot.x, rot.y, rot.z, true, true, false, true, 1, true)
ClearPedTasksImmediately(ped)
Expand Down

0 comments on commit 825cbd0

Please sign in to comment.