Is there a drag feature with this too?
Script appears to be “functional” but extremely buggy.
I have the September 08, 2017 FXServer and hands up does not toggle, as soon as you move it cancels the animation, same with the cuff script. When you move, however, the game still acts like you’re handcuffed… Just no visual representation.
Hm. on our server it works fine. I really just need to revisit all my scripts. Just have had an extreme lack of time lately.
Yeah. I’m not entirely sure what would cause that or I would attempt to fix it myself.
Thank you.
anyway to make it so permission levels have to be greater than or equal to two in order to use cuff command?
Yes. There is a way. I don’t use vrp or essentialmode or any other open source framework so it would take a bit to setup a server for those and alsoessentialmode has couch db and mysql dbs. Plus add all that to my lack of time.
Works perfectly thanks a lot
Hey xander love the work! Just one question could you add hands up kneel? Like Doj if you know what i mean, It would be cool. Thanks
it exist on FiveM Already, just search around for it
For Hands up on knee’s like DOJ’s.
Server.lua
AddEventHandler("chatMessage", function(p, color, msg)
if msg:sub(1, 1) == "/" then
fullcmd = stringSplit(msg, " ")
cmd = fullcmd[1]
if cmd == "/huk" then
TriggerClientEvent("KneelHU", p)
CancelEvent()
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
client.lua
function loadAnimDict( dict )
while ( not HasAnimDictLoaded( dict ) ) do
RequestAnimDict( dict )
Citizen.Wait( 5 )
end
end
RegisterNetEvent( 'KneelHU' )
AddEventHandler( 'KneelHU', function()
local ped = GetPlayerPed( -1 )
local wep = GetSelectedPedWeapon(ped)
if ( DoesEntityExist( ped ) and not IsEntityDead( ped )) then
loadAnimDict( "random@arrests" )
loadAnimDict( "random@arrests@busted" )
if ( IsEntityPlayingAnim( ped, "random@arrests@busted", "idle_a", 3 ) ) then
TaskPlayAnim( ped, "random@arrests@busted", "exit", 8.0, 1.0, -1, 2, 0, 0, 0, 0 )
Wait (3000)
TaskPlayAnim( ped, "random@arrests", "kneeling_arrest_get_up", 8.0, 1.0, -1, 128, 0, 0, 0, 0 )
SetEnableHandcuffs(ped, false)
SetCurrentPedWeapon(ped, GetHashKey("WEAPON_UNARMED"), true)
else
ClearPedSecondaryTask(ped)
SetEnableHandcuffs(ped, true)
TaskPlayAnim( ped, "random@arrests", "idle_2_hands_up", 8.0, 1.0, -1, 2, 0, 0, 0, 0 )
Wait (4000)
SetPedDropsInventoryWeapon(ped, wep, 0, 2.0, 0, -1)
SetCurrentPedWeapon(ped, GetHashKey("WEAPON_UNARMED"), true)
TaskPlayAnim( ped, "random@arrests", "kneeling_arrest_idle", 8.0, 1.0, -1, 2, 0, 0, 0, 0 )
Wait (500)
TaskPlayAnim( ped, "random@arrests@busted", "enter", 8.0, 1.0, -1, 2, 0, 0, 0, 0 )
Wait (1000)
TaskPlayAnim( ped, "random@arrests@busted", "idle_a", 8.0, 1.0, -1, 9, 0, 0, 0, 0 )
end
end
end )
Citizen.CreateThread(function()
while true do
Citizen.Wait(0)
if IsEntityPlayingAnim(GetPlayerPed(PlayerId()), "random@arrests@busted", "idle_a", 3) then
DisableControlAction(0, 21, true)
DisableControlAction(1, 140, true)
DisableControlAction(1, 141, true)
DisableControlAction(1, 142, true)
end
end
end)
for some reason when i cuff someone like myself i cant uncuff them it just readds the cuffs
Hm, weird. I have never seen that problem occur.
yeah i even redownloaded and installed your resource and its still the same
So if you try to uncuff yourself. It just recuffs you?
yes
(20 char limit
Must be something with the way it’s checking The animation being played to uncuff the player.
heres client & server.lua:
client.lua
local handcuffconfig = {
model = "prop_cs_cuffs_01",
handcuffs = nil
}
--[[ HANDCUFF SCRIPT ]]--
RegisterNetEvent("Handcuff")
AddEventHandler("Handcuff", function()
local lPed = GetPlayerPed(-1)
if DoesEntityExist(lPed) then
if IsEntityPlayingAnim(lPed, "mp_arresting", "idle", 3) then
--DetachEntity(handcuffconfig.handcuffs, 0, 0)
--DeleteEntity(handcuffconfig.handcuffs)
--handcuffconfig.handcuffs = nil
ClearPedSecondaryTask(lPed)
SetEnableHandcuffs(lPed, false)
SetCurrentPedWeapon(lPed, GetHashKey("WEAPON_UNARMED"), true)
else
RequestAnimDict("mp_arresting")
while not HasAnimDictLoaded("mp_arresting") do
Citizen.Wait(100)
end
--RequestModel(GetHashKey(handcuffconfig.model))
--while not HasModelLoaded(GetHashKey(handcuffconfig.model)) do
-- Citizen.Wait(100)
--end
--local plyCoords = GetEntityCoords(GetPlayerPed(PlayerId()), false)
--handcuffconfig.handcuffs = CreateObject(GetHashKey(handcuffconfig.model), plyCoords.x, plyCoords.y, plyCoords.z, 1, 1, 1)
--AttachEntityToEntity(handcuffconfig.handcuffs, GetPlayerPed(PlayerId()), GetPedBoneIndex(GetPlayerPed(PlayerId()), 60309), 0.0, 0.05, 0.0, 0.0, 0.0, 80.0, 1, 0, 0, 0, 0, 1)
TaskPlayAnim(lPed, "mp_arresting", "idle", 8.0, -8, -1, 49, 0, 0, 0, 0)
SetEnableHandcuffs(lPed, true)
SetCurrentPedWeapon(lPed, GetHashKey("WEAPON_UNARMED"), true)
end
end
end)
--]]
--[[---------------------]]--
--[[ HANDSUP SCRIPT ]]--
RegisterNetEvent("Handsup")
AddEventHandler("Handsup", function()
local lPed = GetPlayerPed(-1)
if DoesEntityExist(lPed) then
if not IsEntityPlayingAnim(lPed, "mp_arresting", "idle", 3) then
RequestAnimDict("random@mugging3")
while not HasAnimDictLoaded("random@mugging3") do
Citizen.Wait(100)
end
if IsEntityPlayingAnim(lPed, "random@mugging3", "handsup_standing_base", 3) then
ClearPedSecondaryTask(lPed)
SetEnableHandcuffs(lPed, false)
SetCurrentPedWeapon(lPed, GetHashKey("WEAPON_UNARMED"), true)
TriggerEvent("chatMessage", "", {255, 0, 0}, "Your have put your hands down.")
else
TaskPlayAnim(lPed, "random@mugging3", "handsup_standing_base", 8.0, -8, -1, 49, 0, 0, 0, 0)
SetEnableHandcuffs(lPed, true)
SetCurrentPedWeapon(lPed, GetHashKey("WEAPON_UNARMED"), true)
TriggerEvent("chatMessage", "", {255, 0, 0}, "Your hands are up.")
end
else
TriggerEvent("chatMessage", "You are handcuffed..")
end
end
end)
--]]
--[[---------------------]]--
--[[ Other Functions ]]--
Citizen.CreateThread(function()
while true do
Citizen.Wait(0)
if IsEntityPlayingAnim(GetPlayerPed(PlayerId()), "mp_arresting", "idle", 3) then
DisableControlAction(1, 140, true)
DisableControlAction(1, 141, true)
DisableControlAction(1, 142, true)
SetPedPathCanUseLadders(GetPlayerPed(PlayerId()), false)
end
if IsEntityPlayingAnim(GetPlayerPed(PlayerId()), "random@mugging3", "handsup_standing_base", 3) then
DisableControlAction(1, 140, true)
DisableControlAction(1, 141, true)
DisableControlAction(1, 142, true)
end
end
end)
--]]
Server.lua:
AddEventHandler("chatMessage", function(source, name, message)
cm = stringsplit(message, " ")
if cm[1] == "/cuff" then
CancelEvent()
if tablelength(cm) > 1 then
local tPID = tonumber(cm[2])
TriggerClientEvent("Handcuff", tPID)
end
end
if cm[1] == "/hu" then
CancelEvent()
TriggerClientEvent("Handsup", source)
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
Hm, I have no idea at the moment. I’m off to bed.
ok have a good night take your time
This works better than I thought, thanks