So essentially, this script is to handcuff people with /cuff [ID]. They will then not be able to jump, enter vehicles normally, etc unless the vehicle is a police vehicle, in which case the enter buttons are X and B on controller (Spacebar and R on keyboard) to enter the rear 2 seats (left and right)
Problem is, when I start the server, the script won’t friggin work. I have to restart it via the console, and then it flips a coin and decides whether or not it’s gonna work, but then it enables the player to do things that I have defined as disabled: attack, jump, etc as if the player was never cuffed in the first place, despite having made sure to cuff them after restarting the script. I’ve been at this for over a week and it’s really f*%#ing pissing me off.
I have checked every edit I have ever made with this and it doesn’t seem to have any errors. All my other scripts run perfectly except this asshole.
Any and all help is appreciated.
__resource.lua
resource_manifest_version '44febabe-d386-4d18-afbe-5e627f4af937'
client_script 'client.lua'
server_script 'server.lua'
SERVER:
AddEventHandler("chatMessage", function(source, name, message)
cm = stringsplit(message, " ")
if cm[1] == "/cuff" then
CancelEvent()
if tablelength(cm) > 1 then
if tonumber(cm[2]) ~= nil then
local tPID = tonumber(cm[2])
TriggerClientEvent("Handcuff", tPID, source, name)
else
CancelEvent()
TriggerClientEvent("chatMessage", source, "[CUFF]", {255, 0, 0}, "Usage: /cuff [ID]")
end
else
CancelEvent()
TriggerClientEvent("chatMessage", source, "[CUFF]", {255, 0, 0}, "Usage: /cuff [ID]")
end
end
end)
function stringsplit(inputstr, sep)
if sep == nil then
sep = "%s"
end
local t={} ; i=1
for str in string.gmatch(inputstr, "([^"..sep.."]+)") do
t[i] = str
i = i + 1
end
return t
end
function tablelength(T)
local count = 0
for _ in pairs(T) do count = count + 1 end
return count
end
CLIENT:
DisableControlAction(0, 80, true) -- disable vehicle cinematic camera
DisableControlAction(1, 80, true) -- disable cinematic camera
local handcuff = false
local handsup = false
local detained = false
local ragdoll = false
RegisterNetEvent("Handcuff")
AddEventHandler("Handcuff", function(source, name)
local playerPed = GetPlayerPed(-1)
if not IsPedInAnyVehicle(playerPed, false) and not IsPedSittingInAnyVehicle(playerPed) and not IsPedHangingOnToVehicle(playerPed) and not IsPedGettingIntoAVehicle(playerPed) and not IsPedJumpingOutOfVehicle(playerPed) and not IsEntityInWater(playerPed) and not IsPedSwimming(playerPed) and not IsPedSwimmingUnderWater(playerPed) and not IsPedDiving(playerPed) and not IsPedEvasiveDiving(playerPed) and not IsPedInParachuteFreeFall(playerPed) and not IsPedFalling(playerPed) and not IsPedClimbing(playerPed) and not IsPedJumping(playerPed) and not IsPedVaulting(playerPed) then
if handcuff == false then
ClearPedTasks(playerPed)
ClearPedSecondaryTask(playerPed)
ClearPedTasksImmediately(playerPed)
RequestAnimDict("mp_arresting")
while not HasAnimDictLoaded("mp_arresting") do
Citizen.Wait(100)
end
TaskPlayAnim(playerPed, "mp_arresting", "idle", 8.0, -8, -1, 49, 0, 0, 0, 0)
SetCurrentPedWeapon(playerPed, GetHashKey("WEAPON_UNARMED"), true)
SetEnableHandcuffs(playerPed, true)
if ragdoll == true then
SetPedRagdollOnCollision(playerPed, true)
end
--SetPedCanRagdoll(playerPed, false)
handcuff = true
--TriggerEvent("chatMessage", "Cuffed by: [" .. source .. "] " .. name)
elseif handcuff == true then
ClearPedTasks(playerPed)
ClearPedSecondaryTask(playerPed)
ClearPedTasksImmediately(playerPed)
SetCurrentPedWeapon(playerPed, GetHashKey("WEAPON_UNARMED"), true)
SetEnableHandcuffs(playerPed, false)
if ragdoll == true then
SetPedRagdollOnCollision(playerPed, false)
end
--SetPedCanRagdoll(playerPed, true)
handcuff = false
--TriggerEvent("chatMessage", "Uncuffed by: [" .. source .. "] " .. name)
end
end
end)
Citizen.CreateThread(function()
local playerPed = GetPlayerPed(-1)
local coordA = GetEntityCoords(playerPed, 1)
local coordB = GetOffsetFromEntityInWorldCoords(playerPed, 0.0, 5.0, 0.0)
local vehicle = GetVehiclePedIsIn(playerPed, false)--false for current, true for last
local targetvehicle = getVehicleInDirection(coordA, coordB)
local detained = false
while true do
Citizen.Wait(0)
if handcuff == true then
BlockWeaponWheelThisFrame()
--ped controls
DisableControlAction(0, 12, true) -- WeaponWheelUpDown
DisableControlAction(0, 13, true) -- WeaponWheelLeftRight
DisableControlAction(0, 14, true) -- WeaponWheelNext
DisableControlAction(0, 15, true) -- WeaponWheelPrev
DisableControlAction(0, 16, true) -- SelectNextWeapon
DisableControlAction(0, 17, true) -- SelectPrevWeapon
--DisableControlAction(0, 21, true) -- disable sprint
DisableControlAction(0, 22, true) -- disable jump
DisableControlAction(0, 23, true) -- disable enter vehicle
DisableControlAction(0, 24, true) -- disable attack
DisableControlAction(0, 25, true) -- disable aim
DisableControlAction(1, 24, true) -- disable attack
DisableControlAction(1, 25, true) -- disable aim
DisableControlAction(0, 36, true) -- disable sneak/duck
DisableControlAction(0, 37, true) -- disable select weapon
DisableControlAction(0, 38, true) -- disable pickup (E)
DisableControlAction(0, 44, true) -- disable cover
DisableControlAction(0, 45, true) -- disable reload
DisableControlAction(0, 47, true) -- disable detonate
DisableControlAction(0, 49, true) -- disable "arrest" (pull driver out)
DisableControlAction(0, 50, true) -- disable accurate aim
DisableControlAction(0, 51, true) -- disable context dpad right
DisableControlAction(0, 52, true) -- disable context dpad left
DisableControlAction(0, 55, true) -- disable dive
DisableControlAction(0, 56, true) -- disable drop weapon
DisableControlAction(0, 57, true) -- disable drop ammo
DisableControlAction(0, 58, true) -- disable throw grenade
--vehicle controls
DisableControlAction(0, 59, true) -- disable move vehicle left/right (A/D)
DisableControlAction(0, 60, true) -- disable move vehicle up/down ([LEFT]SHIFT/[LEFT]CTRL)
DisableControlAction(0, 65, true) -- disable vehicle special
DisableControlAction(0, 68, true) -- disable vehicle aim
DisableControlAction(0, 71, true) -- disable vehicle accelerate (A)
DisableControlAction(0, 72, true) -- disable vehicle brake/reverse (S)
DisableControlAction(0, 73, true) -- disable vehicle ducking
DisableControlAction(0, 74, true) -- disable vehicle headlights
DisableControlAction(0, 75, true) -- disable vehicle exiting
DisableControlAction(0, 76, true) -- disable vehicle handbrake
DisableControlAction(0, 77, true) -- disable vehicle hotwire left
DisableControlAction(0, 78, true) -- disable vehicle hotwire right
DisableControlAction(0, 80, true) -- disable vehicle cinematic camera
DisableControlAction(0, 81, true) -- disable vehicle next radio station
DisableControlAction(0, 82, true) -- disable vehicle prev radio station
DisableControlAction(0, 83, true) -- disable vehicle next radio track
DisableControlAction(0, 84, true) -- disable vehicle prev radio track
DisableControlAction(0, 85, true) -- disable vehicle radio wheel
DisableControlAction(0, 86, true) -- disable vehicle horn
DisableControlAction(0, 87, true) -- disable vehicle fly throttle up
DisableControlAction(0, 88, true) -- disable vehicle fly throttle down
DisableControlAction(0, 89, true) -- disable vehicle fly yaw left
DisableControlAction(0, 90, true) -- disable vehicle fly yaw right
DisableControlAction(0, 91, true) -- disable vehicle passenger aim
DisableControlAction(0, 92, true) -- disable vehicle passenger attack
DisableControlAction(0, 99, true) -- disable vehicle next weapon
DisableControlAction(0, 100, true) -- disable vehicle prev weapon
DisableControlAction(1, 91, true) -- disable vehicle passenger aim
DisableControlAction(1, 92, true) -- disable vehicle passenger attack
DisableControlAction(1, 99, true) -- disable vehicle next weapon
DisableControlAction(1, 100, true) -- disable vehicle prev weapon
DisableControlAction(0, 101, true) -- disable vehicle roof (convertible?)
DisableControlAction(0, 102, true) -- disable vehicle jump (Ruiner 2000?)
DisableControlAction(0, 103, true) -- disable vehicle grappling hook (deploy, cargobob)
DisableControlAction(0, 104, true) -- disable vehicle shuffle
DisableControlAction(0, 105, true) -- disable vehicle drop projectile
DisableControlAction(0, 106, true) -- VehicleMouseControlOverride
DisableControlAction(0, 107, true) -- disable vehicle fly roll left/right
DisableControlAction(0, 110, true) -- disable vehicle fly pitch up/down
DisableControlAction(0, 114, true) -- disable vehicle fly attack
DisableControlAction(0, 115, true) -- disable vehicle fly next weapon
DisableControlAction(0, 116, true) -- disable vehicle fly prev weapon
DisableControlAction(0, 117, true) -- disable vehicle fly target left
DisableControlAction(0, 118, true) -- disable vehicle fly target right
DisableControlAction(0, 119, true) -- disable vehicle fly VTOL mode
DisableControlAction(0, 120, true) -- disable vehicle fly duck
DisableControlAction(0, 123, true) -- disable vehicle sub turn left/right
DisableControlAction(0, 126, true) -- disable vehicle sub pitch up/down
DisableControlAction(0, 129, true) -- disable vehicle sub throttle up (W)
DisableControlAction(0, 130, true) -- disable vehicle sub throttle down (S)
DisableControlAction(0, 131, true) -- disable vehicle sub ascend (LeftShift)
DisableControlAction(0, 132, true) -- disable vehicle sub descend (LeftCtrl)
DisableControlAction(0, 136, true) -- disable bicycle pedal
DisableControlAction(0, 137, true) -- disable bicycle sprint (CapsLock)
--ped combat controls
DisableControlAction(0, 140, true) -- disable melee light
DisableControlAction(0, 141, true) -- disable melee heavy
DisableControlAction(0, 142, true) -- disable melee alternate
DisableControlAction(0, 143, true) -- disable melee block
DisableControlAction(0, 257, true) -- disable attack2
DisableControlAction(0, 263, true) -- disable melee attack1
DisableControlAction(0, 264, true) -- disable melee attack2
DisableControlAction(0, 282, true) -- disable vehicle gun left
DisableControlAction(0, 283, true) -- disable vehicle gun right
DisableControlAction(0, 284, true) -- disable vehicle gun up
DisableControlAction(0, 285, true) -- disable vehicle gun down
-- vehicle hydraulics
DisableControlAction(0, 337, true) -- disable vehicle hydraulics control toggle
DisableControlAction(0, 338, true) -- disable vehicle hydraulics control left
DisableControlAction(0, 339, true) -- disable vehicle hydraulics control right
DisableControlAction(0, 340, true) -- disable vehicle hydraulics control up
DisableControlAction(0, 341, true) -- disable vehicle hydraulics control down
DisableControlAction(0, 342, true) -- disable vehicle hydraulics control up/down
DisableControlAction(0, 343, true) -- disable vehicle hydraulics control left/right
if IsPedGettingUp(playerPed) or IsPedVaulting(playerPed) then
Citizen.Wait(2250)
local h = GetEntityHeading(playerPed)
local x,y,z = table.unpack(GetEntityCoords(playerPed))
SetEntityHeading(playerPed, h)
SetEntityCoords(playerPed, x, y, z-1.0, 0, 0, 0, 0)
TaskPlayAnim(playerPed, "mp_arresting", "idle", 8.0, -8, -1, 49, 0, 0, 0, 0)
end
--if detained == false then--detain suspects in back seats of police road vehicles (not helis/boats)
if not IsEntityUpsidedown(targetvehicle) and targetvehicle ~= nil then-- and (IsVehicleModel(targetvehicle, 1171614426) or IsVehicleModel(targetvehicle, 456714581) or IsVehicleModel(targetvehicle, 1127131465) or IsVehicleModel(targetvehicle, -1647941228) or IsVehicleModel(targetvehicle, -2007026063) or IsVehicleModel(targetvehicle, 2046537925) or IsVehicleModel(targetvehicle, -1627000575) or IsVehicleModel(targetvehicle, 1912215274) or IsVehicleModel(targetvehicle, -1973172295) or IsVehicleModel(targetvehicle, -1536924937) or IsVehicleModel(targetvehicle, -1779120616) or IsVehicleModel(targetvehicle, 741586030) or IsVehicleModel(targetvehicle, -1205689942) or IsVehicleModel(targetvehicle, -1683328900) or IsVehicleModel(targetvehicle, 1922257928)) then
if IsDisabledControlJustPressed(1, 22) then--rear left seat (hold DPAD LEFT+Y while cuffed)
if GetPedInVehicleSeat(targetvehicle, 1) == 0 then-- or IsVehicleSeatFree(targetvehicle, 1) then
TaskEnterVehicle(playerPed, targetvehicle, -1, 1, 2, 0)
while GetVehiclePedIsIn(playerPed, false) ~= targetvehicle do
Citizen.Wait(100)
end
Citizen.Wait(100)
SetVehicleDoorsShut(targetvehicle, false)
detained = true
else
TriggerEvent("chatMessage", "[CUFF]", {255, 0, 0}, "That seat is occupied.")
end
end
if IsDisabledControlJustPressed(1, 80) then--rear right seat (hold DPAD RIGHT+Y while cuffed)
if GetPedInVehicleSeat(targetvehicle, 2) == 0 then-- or IsVehicleSeatFree(targetvehicle, 2) then
TaskEnterVehicle(playerPed, targetvehicle, -1, 2, 2, 0)
while GetVehiclePedIsIn(playerPed, false) ~= targetvehicle do
Citizen.Wait(100)
end
Citizen.Wait(100)
SetVehicleDoorsShut(targetvehicle, false)
detained = true
else
TriggerEvent("chatMessage", "[CUFF]", {255, 0, 0}, "That seat is occupied.")
end
end
end
--end
--if detained == true then
if IsDisabledControlJustPressed(0, 23) then--get out of seat+detainment (hold DPAD DOWN+Y while in a rear [detainment] seat {see above})
TaskLeaveVehicle(playerPed, GetVehiclePedIsIn(playerPed, false), 1)
while IsPedInAnyVehicle(playerPed, true) == true do
Citizen.Wait(100)
end
detained = false
end
--end
--[[
if not IsEntityPlayingAnim(GetPlayerPed(PlayerId()), "mp_arresting", "idle", 3) then-- and not IsPedInAnyVehicle(playerPed, false) and not IsPedSittingInAnyVehicle(playerPed) and not IsPedHangingOnToVehicle(playerPed) and not IsPedGettingIntoAVehicle(playerPed) and not IsPedJumpingOutOfVehicle(playerPed) and not IsEntityInWater(playerPed) and not IsPedSwimming(playerPed) and not IsPedSwimmingUnderWater(playerPed) and not IsPedDiving(playerPed) and not IsPedEvasiveDiving(playerPed) and not IsPedInParachuteFreeFall(playerPed) and not IsPedFalling(playerPed) and not IsPedClimbing(playerPed) and not IsPedJumping(playerPed) and not IsPedVaulting(playerPed) then
Citizen.Wait(1000)
Citizen.Trace("BACKUP CUFFING TRIGGERED")
TaskPlayAnim(playerPed, "mp_arresting", "idle", 8.0, -8, -1, 49, 0, 0, 0, 0)
end
if ragdoll == true then
local ragged = false
if IsPedRagdoll(playerPed) or IsPedRunningRagdollTask(playerPed) then
ragged = true
TriggerEvent("chatMessage", "[RAGDOLL]", {255, 0, 0}, "BEGIN RAGDOLLING x1 (wait 1.5s)")
Citizen.Wait(1500)
if not IsPedRagdoll(playerPed) and not IsPedRunningRagdollTask(playerPed) then
TriggerEvent("chatMessage", "[RAGDOLL]", {0, 255, 0}, "FINISHED RAGDOLLING Stage 1")
DisableControlAction(0, 23, true) -- disable enter vehicle
TaskPlayAnim(playerPed, "mp_arresting", "idle", 8.0, -8, -1, 49, 0, 0, 0, 0)
else
TriggerEvent("chatMessage", "[RAGDOLL]", {255, 255, 0}, "BEGIN RAGDOLLING Stage 2 (wait 1s)")
Citizen.Wait(1000)
if not IsPedRagdoll(playerPed) and not IsPedRunningRagdollTask(playerPed) then
TriggerEvent("chatMessage", "[RAGDOLL]", {0, 255, 0}, "FINISHED RAGDOLLING Stage 2")
DisableControlAction(0, 23, true) -- disable enter vehicle
TaskPlayAnim(playerPed, "mp_arresting", "idle", 8.0, -8, -1, 49, 0, 0, 0, 0)
else
TriggerEvent("chatMessage", "[RAGDOLL]", {255, 255, 0}, "BEGIN RAGDOLLING Stage 3 (wait 1s)")
Citizen.Wait(1000)
if not IsPedRagdoll(playerPed) and not IsPedRunningRagdollTask(playerPed) then
TriggerEvent("chatMessage", "[RAGDOLL]", {0, 255, 0}, "FINISHED RAGDOLLING Stage 3")
DisableControlAction(0, 23, true) -- disable enter vehicle
TaskPlayAnim(playerPed, "mp_arresting", "idle", 8.0, -8, -1, 49, 0, 0, 0, 0)
else
TriggerEvent("chatMessage", "[RAGDOLL]", {255, 255, 0}, "BEGIN RAGDOLLING Stage 4 (wait 1s)")
Citizen.Wait(1000)
if not IsPedRagdoll(playerPed) and not IsPedRunningRagdollTask(playerPed) then
TriggerEvent("chatMessage", "[RAGDOLL]", {0, 255, 0}, "FINISHED RAGDOLLING Stage 4")
DisableControlAction(0, 23, true) -- disable enter vehicle
TaskPlayAnim(playerPed, "mp_arresting", "idle", 8.0, -8, -1, 49, 0, 0, 0, 0)
else
TriggerEvent("chatMessage", "[RAGDOLL]", {255, 255, 0}, "BEGIN RAGDOLLING Stage 5 (wait 1.5s)")
Citizen.Wait(1500)
if not IsPedRagdoll(playerPed) and not IsPedRunningRagdollTask(playerPed) then
TriggerEvent("chatMessage", "[RAGDOLL]", {0, 255, 0}, "FINISHED RAGDOLLING Stage 5")
DisableControlAction(0, 23, true) -- disable enter vehicle
TaskPlayAnim(playerPed, "mp_arresting", "idle", 8.0, -8, -1, 49, 0, 0, 0, 0)
end
ClearPedTasksImmediately(playerPed)
TaskPlayAnim(playerPed, "mp_arresting", "idle", 8.0, -8, -1, 49, 0, 0, 0, 0)
end
ClearPedTasksImmediately(playerPed)
TaskPlayAnim(playerPed, "mp_arresting", "idle", 8.0, -8, -1, 49, 0, 0, 0, 0)
end
ClearPedTasksImmediately(playerPed)
TaskPlayAnim(playerPed, "mp_arresting", "idle", 8.0, -8, -1, 49, 0, 0, 0, 0)
end
ClearPedTasksImmediately(playerPed)
TaskPlayAnim(playerPed, "mp_arresting", "idle", 8.0, -8, -1, 49, 0, 0, 0, 0)
end
ClearPedTasksImmediately(playerPed)
TaskPlayAnim(playerPed, "mp_arresting", "idle", 8.0, -8, -1, 49, 0, 0, 0, 0)
if ragged == true then
Citizen.Wait(1000)
TriggerEvent("chatMessage", "[RAGDOLL]", {0, 0, 255}, "FINISHED RAGDOLLING")
DisableControlAction(0, 23, true) -- disable enter vehicle
local h = GetEntityHeading(playerPed)
local x,y,z = table.unpack(GetEntityCoords(playerPed))
SetEntityHeading(playerPed, h)
SetEntityCoords(playerPed, x, y, z-1.0, 0, 0, 0, 0)
TaskPlayAnim(playerPed, "mp_arresting", "idle", 8.0, -8, -1, 49, 0, 0, 0, 0)
if ragdoll == true then
SetPedRagdollOnCollision(playerPed, true)
end
end
end
end
]]
if GetSeatPedIsTryingToEnter(playerPed) == -1 or GetSeatPedIsTryingToEnter(playerPed) == 0 then
local h = GetEntityHeading(playerPed)
local x,y,z = table.unpack(GetEntityCoords(playerPed))
local tv = GetVehiclePedIsTryingToEnter(playerPed)
SetEntityHeading(playerPed, h)
SetEntityCoords(playerPed, x, y-2.0, z-1.0, 1, 0, 0, 1)
SetVehicleDoorControl(tv, 0, 0, 0)
end
end
end
end)
Citizen.CreateThread(function()
while true do
Citizen.Wait(0)
local playerPed = GetPlayerPed(-1)
local vehicle = GetVehiclePedIsIn(playerPed, false)
--FALLING/RAGDOLL/PRONE CHECK
if IsPedFalling(playerPed) then
Citizen.Wait(625)
if IsPedFalling(playerPed) then
--TriggerEvent("chatMessage", "[#]", {255, 0, 0}, "Prone!")
SetPedToRagdoll(playerPed, 1000, 1000, 0, false, false, false)
--SetPedRagdollForceFall(playerPed)
end
end
--VEHICLE ROTATION OVER 180* CHECK
if IsEntityUpsidedown(vehicle) or IsEntityUpsidedown(targetvehicle) then
--TriggerEvent("chatMessage", "", {0, 255, 0}, "Upside Down!")
end
RequestAnimDict("random@mugging3")
if handcuff == false then
if not IsPedHangingOnToVehicle(playerPed) and not IsPedGettingIntoAVehicle(playerPed) and not IsPedJumpingOutOfVehicle(playerPed) and not IsEntityInWater(playerPed) and not IsPedSwimming(playerPed) and not IsPedSwimmingUnderWater(playerPed) and not IsPedDiving(playerPed) and not IsPedEvasiveDiving(playerPed) and not IsPedInParachuteFreeFall(playerPed) and not IsPedFalling(playerPed) and not IsPedGettingUp(playerPed) and not IsPedInWrithe(playerPed) and not IsPedClimbing(playerPed) and not IsPedJumping(playerPed) and not IsPedVaulting(playerPed) and not IsPedProne(playerPed) and not IsPedRagdoll(playerPed) and not IsPedRunningRagdollTask(playerPed) then
if IsControlPressed(1, 20) then
--CURRENT WEAPON HASH CHECK
--local sw = GetSelectedPedWeapon(playerPed)
--TriggerEvent("chatMessage", "[#]", {255, 0, 0}, sw)
--ped controls
DisableControlAction(0, 12, true) -- WeaponWheelUpDown
DisableControlAction(0, 13, true) -- WeaponWheelLeftRight
DisableControlAction(0, 14, true) -- WeaponWheelNext
DisableControlAction(0, 15, true) -- WeaponWheelPrev
DisableControlAction(0, 16, true) -- SelectNextWeapon
DisableControlAction(0, 17, true) -- SelectPrevWeapon
--DisableControlAction(0, 21, true) -- disable sprint
DisableControlAction(0, 22, true) -- disable jump
DisableControlAction(0, 23, true) -- disable enter vehicle
DisableControlAction(0, 24, true) -- disable attack
DisableControlAction(0, 25, true) -- disable aim
DisableControlAction(0, 36, true) -- disable sneak/duck
DisableControlAction(0, 37, true) -- disable select weapon
DisableControlAction(0, 38, true) -- disable pickup (E)
DisableControlAction(0, 44, true) -- disable cover
DisableControlAction(0, 45, true) -- disable reload
DisableControlAction(0, 47, true) -- disable detonate
DisableControlAction(0, 49, true) -- disable "arrest" (pull driver out)
DisableControlAction(0, 50, true) -- disable accurate aim
DisableControlAction(0, 51, true) -- disable context dpad right
DisableControlAction(0, 52, true) -- disable context dpad left
DisableControlAction(0, 55, true) -- disable dive
DisableControlAction(0, 56, true) -- disable drop weapon
DisableControlAction(0, 57, true) -- disable drop ammo
DisableControlAction(0, 58, true) -- disable throw grenade
--vehicle controls
DisableControlAction(0, 59, true) -- disable move vehicle left/right (A/D)
DisableControlAction(0, 60, true) -- disable move vehicle up/down ([LEFT]SHIFT/[LEFT]CTRL)
DisableControlAction(0, 65, true) -- disable vehicle special
DisableControlAction(0, 68, true) -- disable vehicle aim
DisableControlAction(0, 71, true) -- disable vehicle accelerate (A)
DisableControlAction(0, 72, true) -- disable vehicle brake/reve/reverse (S) DisableControlAction(0, 73, true) -- disable vehicle ducking
DisableControlAction(0, 73, true) -- disable vehicle ducking
DisableControlAction(0, 74, true) -- disable vehicle headlights
DisableControlAction(0, 75, true) -- disable vehicle exiting
DisableControlAction(0, 76, true) -- disable vehicle handbrake
DisableControlAction(0, 77, true) -- disable vehicle hotwire left
DisableControlAction(0, 78, true) -- disable vehicle hotwire right
DisableControlAction(0, 80, true) -- disable vehicle cinematic camera
DisableControlAction(0, 81, true) -- disable vehicle next radio station
DisableControlAction(0, 82, true) -- disable vehicle prev radio station
DisableControlAction(0, 83, true) -- disable vehicle next radio track
DisableControlAction(0, 84, true) -- disable vehicle prev radio track
DisableControlAction(0, 85, true) -- disable vehicle radio wheel
DisableControlAction(0, 86, true) -- disable vehicle horn
DisableControlAction(0, 87, true) -- disable vehicle fly throttle up
DisableControlAction(0, 88, true) -- disable vehicle fly throttle down
DisableControlAction(0, 89, true) -- disable vehicle fly yaw left
DisableControlAction(0, 90, true) -- disable vehicle fly yaw right
DisableControlAction(0, 91, true) -- disable vehicle passenger aim
DisableControlAction(0, 92, true) -- disable vehicle passenger attack
DisableControlAction(0, 99, true) -- disable vehicle next weapon
DisableControlAction(0, 100, true) -- disable vehicle prev weapon
DisableControlAction(1, 91, true) -- disable vehicle passenger aim
DisableControlAction(1, 92, true) -- disable vehicle passenger attack
DisableControlAction(1, 99, true) -- disable vehicle next weapon
DisableControlAction(1, 100, true) -- disable vehicle prev weapon
DisableControlAction(0, 101, true) -- disable vehicle roof (convertible?)
DisableControlAction(0, 102, true) -- disable vehicle jump (Ruiner 2000?)
DisableControlAction(0, 103, true) -- disable vehicle grappling hook (deploy, cargobob)
DisableControlAction(0, 104, true) -- disable vehicle shuffle
DisableControlAction(0, 105, true) -- disable vehicle drop projectile
DisableControlAction(0, 106, true) -- VehicleMouseControlOverride
DisableControlAction(0, 107, true) -- disable vehicle fly roll left/right
DisableControlAction(0, 110, true) -- disable vehicle fly pitch up/down
DisableControlAction(0, 114, true) -- disable vehicle fly attack
DisableControlAction(0, 115, true) -- disable vehicle fly next weapon
DisableControlAction(0, 116, true) -- disable vehicle fly prev weapon
DisableControlAction(0, 117, true) -- disable vehicle fly target left
DisableControlAction(0, 118, true) -- disable vehicle fly target right
DisableControlAction(0, 119, true) -- disable vehicle fly VTOL mode
DisableControlAction(0, 120, true) -- disable vehicle fly duck
DisableControlAction(0, 123, true) -- disable vehicle sub turn left/right
DisableControlAction(0, 126, true) -- disable vehicle sub pitch up/down
DisableControlAction(0, 129, true) -- disable vehicle sub throttle up (W)
DisableControlAction(0, 130, true) -- disable vehicle sub throttle down (S)
DisableControlAction(0, 131, true) -- disable vehicle sub ascend (LeftShift)
DisableControlAction(0, 132, true) -- disable vehicle sub descend (LeftCtrl)
DisableControlAction(0, 136, true) -- disable bicycle pedal
DisableControlAction(0, 137, true) -- disable bicycle sprint (CapsLock)
--ped combat controls
DisableControlAction(0, 140, true) -- disable melee light
DisableControlAction(0, 141, true) -- disable melee heavy
DisableControlAction(0, 142, true) -- disable melee alternate
DisableControlAction(0, 143, true) -- disable melee block
DisableControlAction(0, 257, true) -- disable attack2
DisableControlAction(0, 263, true) -- disable melee attack1
DisableControlAction(0, 264, true) -- disable melee attack2
DisableControlAction(0, 282, true) -- disable vehicle gun left
DisableControlAction(0, 283, true) -- disable vehicle gun right
DisableControlAction(0, 284, true) -- disable vehicle gun up
DisableControlAction(0, 285, true) -- disable vehicle gun down
-- vehicle hydraulics
DisableControlAction(0, 337, true) -- disable vehicle hydraulics control toggle
DisableControlAction(0, 338, true) -- disable vehicle hydraulics control left
DisableControlAction(0, 339, true) -- disable vehicle hydraulics control right
DisableControlAction(0, 340, true) -- disable vehicle hydraulics control up
DisableControlAction(0, 341, true) -- disable vehicle hydraulics control down
DisableControlAction(0, 342, true) -- disable vehicle hydraulics control up/down
DisableControlAction(0, 343, true) -- disable vehicle hydraulics control left/right
if IsEntityUpsidedown(vehicle) and (IsControlPressed(0,75) or IsControlJustPressed(0,75)) then
TaskLeaveVehicle(playerPed, vehicle, 1)
end
if ragdoll == true then
SetPedRagdollOnCollision(playerPed, true)
end
if not IsEntityPlayingAnim(playerPed, "mp_arresting", "idle", 3) then
if not IsEntityPlayingAnim(playerPed, "random@mugging3", "handsup_standing_base", 3) then
TaskPlayAnim(playerPed, "random@mugging3", "handsup_standing_base", 8.0, -8, -1, 49, 0, 0, 0, 0)
SetEnableHandcuffs(playerPed, true)
handsup = true
end
if IsPedInAnyVehicle(playerPed, false) and IsVehicleStopped(vehicle) and IsDisabledControlJustPressed(0, 75) then
TaskLeaveVehicle(playerPed, vehicle, 256)
end
if IsEntityPlayingAnim(playerPed, "random@mugging3", "handsup_standing_base", 3) and IsDisabledControlJustPressed(0, 75) and not IsPedInAnyVehicle(playerPed, false) and not IsPedSittingInAnyVehicle(playerPed) and not IsPedHangingOnToVehicle(playerPed) and not IsPedGettingIntoAVehicle(playerPed) and not IsPedJumpingOutOfVehicle(playerPed) and not IsEntityInWater(playerPed) and not IsPedSwimming(playerPed) and not IsPedSwimmingUnderWater(playerPed) and not IsPedDiving(playerPed) and not IsPedEvasiveDiving(playerPed) and not IsPedInParachuteFreeFall(playerPed) and not IsPedFalling(playerPed) and not IsPedClimbing(playerPed) and not IsPedJumping(playerPed) and not IsPedVaulting(playerPed) and not IsPedRagdoll(playerPed) and not IsPedRunningRagdollTask(playerPed) then
SetPedDropsInventoryWeapon(playerPed, GetSelectedPedWeapon(playerPed), 0.0, 3.0, 0.0, GetAmmoInPedWeapon(playerPed, GetSelectedPedWeapon(playerPed)))
SetCurrentPedWeapon(playerPed, GetHashKey("WEAPON_UNARMED"), true)
end
end
elseif IsControlReleased(1, 20) then-- and not IsPedGettingIntoAVehicle(playerPed) and not IsPedJumpingOutOfVehicle(playerPed) then
if ragdoll == true then
SetPedRagdollOnCollision(playerPed, false)
end
if IsEntityPlayingAnim(playerPed, "random@mugging3", "handsup_standing_base", 3) then
ClearPedTasks(playerPed)
ClearPedSecondaryTask(playerPed)
--ClearPedTasksImmediately(playerPed)
SetEnableHandcuffs(playerPed, false)
handsup = false
end
end
end
end
end
end)
function getVehicleInDirection(coordFrom, coordTo)
local rayHandle = CastRayPointToPoint(coordFrom.x, coordFrom.y, coordFrom.z, coordTo.x, coordTo.y, coordTo.z, 10, GetPlayerPed(-1), 0)
local a, b, c, d, vehicle = GetRaycastResult(rayHandle)
return vehicle
end
function ShowNotification(msg)
SetNotificationTextEntry("STRING")
AddTextComponentString(msg)
DrawNotification(false, false)
end