JIT
Zipties server script
client.lua ESX = nil Citizen.CreateThread(function() while ESX == nil do TriggerEvent('esx:getSharedObject', function(obj) ESX = obj end) Citizen.Wait(100) end end) local lib, anim = 'missminuteman_1ig_2' , 'handsup_base' local isCuffed = false local handcuffTimer = {} function AreHandsUp(ped) if IsEntityPlayingAnim(ped, lib, anim, 3) then return true end return false end RegisterNetEvent('bixbi_zipties:startZiptie') AddEventHandler("bixbi_zipties:startZiptie", function(targetId) if (targetId == nil) then local closestPlayer, closestDistance = ESX.Game.GetClosestPlayer() if closestPlayer ~= -1 and closestDistance <= 2.0 then targetId = GetPlayerServerId(closestPlayer) else ESX.ShowNotification('Ingen nära') return end end while (targetId == nil) do Citizen.Wait(100) end local targetPed = GetPlayerFromServerId(targetId) if (AreHandsUp(GetPlayerPed(targetPed))) then -- if (Player(targetId).state.handsup ~= nil and Player(targetId).state.handsup) then exports['progressbar']:Progress({ name = "buntband", duration = Config.ZiptieSpeed * 1000, label = "Sätter på buntband på personen", useWhileDead = false, canCancel = false, controlDisables = { disableMovement = true, disableCarMovement = true, disableMouse = false, disableCombat = true, }, animation = { animDict = "missheistdockssetup1clipboard@idle_a", anim = "idle_a", }, prop = { model = "prop_paper_bag_small", } }, function(status) if not status then TriggerServerEvent('bixbi_zipties:ApplyZipties', targetId) ESX.ShowNotification('Du har satt på buntband på personen.') end end) else ESX.ShowNotification('Personen har inte händerna upp.') end end) RegisterNetEvent('bixbi_zipties:startziptieremove') AddEventHandler("bixbi_zipties:startziptieremove", function(tool, targetId) if (targetId == nil) then local closestPlayer, closestDistance = ESX.Game.GetClosestPlayer() if closestPlayer ~= -1 and closestDistance <= 2.0 then targetId = GetPlayerServerId(closestPlayer) else ESX.ShowNotification('Ingen nära') return end end exports['progressbar']:Progress({ name = "buntband", duration = (tool.timer or 5) * 1000, label = "Tar bort buntbandet", useWhileDead = false, canCancel = false, controlDisables = { disableMovement = true, disableCarMovement = true, disableMouse = false, disableCombat = true, }, animation = { animDict = "missheistdockssetup1clipboard@idle_a", anim = "idle_a", }, prop = { model = "prop_paper_bag_small", } }, function(status) if not status then ESX.ShowNotification('Du tog bort buntbandet') TriggerServerEvent('bixbi_zipties:RemoveZipties', targetId) end end) end) function StartHandcuffTimer() if Config.EnableHandcuffTimer and handcuffTimer.active then ESX.ClearTimeout(handcuffTimer.task) end handcuffTimer.active = true handcuffTimer.task = ESX.SetTimeout(Config.HandcuffTimer, function() ESX.ShowNotification('Du känner hur dragkedjorna sakta tappar greppet och försvinner.') TriggerEvent('bixbi_zipties:removeziptie') handcuffTimer.active = false end) end -- local isZiptied = false RegisterNetEvent('bixbi_zipties:ziptie') AddEventHandler("bixbi_zipties:ziptie", function(source, tool) local playerPed = PlayerPedId() ESX.ShowNotification('You have been ziptied.') if (not LocalPlayer.state.ziptied) then LocalPlayer.state:set('ziptied', true, true) playAnim(playerPed, 're@stag_do@idle_a', 'idle_a_ped', -1) SetEnableHandcuffs(playerPed, true) DisablePlayerFiring(playerPed, true) SetCurrentPedWeapon(playerPed, GetHashKey('WEAPON_UNARMED'), true) SetPedCanPlayGestureAnims(playerPed, false) DisplayRadar(false) if handcuffTimer.active then ESX.ClearTimeout(handcuffTimer.task) end StartHandcuffTimer() ZiptieLoop() end end) RegisterNetEvent('bixbi_zipties:removeziptie') AddEventHandler('bixbi_zipties:removeziptie', function() local playerPed = PlayerPedId() ESX.ShowNotification("Du är fri igen!") if (LocalPlayer.state.ziptied) then LocalPlayer.state:set('ziptied', false, true) SetEnableHandcuffs(playerPed, false) DisablePlayerFiring(playerPed, false) SetPedCanPlayGestureAnims(playerPed, true) ClearPedTasks(playerPed) ClearPedSecondaryTask(playerPed) DisplayRadar(true) if handcuffTimer.active then ESX.ClearTimeout(handcuffTimer.task) end end end) function ZiptieLoop() Citizen.CreateThread(function() while (LocalPlayer.state.ziptied) do Citizen.Wait(0) -- EnableControlAction(0, 47, true) DisableControlAction(0, 24, true) -- Attack DisableControlAction(0, 257, true) -- Attack 2 DisableControlAction(0, 25, true) -- Aim DisableControlAction(0, 263, true) -- Melee Attack 1 DisableControlAction(0, 45, true) -- Reload DisableControlAction(0, 22, true) -- Jump DisableControlAction(0, 44, true) -- Cover DisableControlAction(0, 37, true) -- Select Weapon DisableControlAction(0, 288, true) -- Disable phone DisableControlAction(0, 289, true) -- Inventory DisableControlAction(0, 170, true) -- Animations DisableControlAction(0, 167, true) -- Job DisableControlAction(0, 0, true) -- Disable changing view DisableControlAction(0, 26, true) -- Disable looking behind DisableControlAction(0, 73, true) -- Disable clearing animation DisableControlAction(2, 199, true) -- Disable pause screen DisableControlAction(0, 59, true) -- Disable steering in vehicle DisableControlAction(0, 71, true) -- Disable driving forward in vehicle DisableControlAction(0, 72, true) -- Disable reversing in vehicle DisableControlAction(0, 47, true) -- Disable weapon DisableControlAction(0, 264, true) -- Disable melee DisableControlAction(0, 257, true) -- Disable melee DisableControlAction(0, 140, true) -- Disable melee DisableControlAction(0, 141, true) -- Disable melee DisableControlAction(0, 142, true) -- Disable melee DisableControlAction(0, 143, true) -- Disable melee local playerPed = PlayerPedId() if (IsEntityPlayingAnim(playerPed, 're@stag_do@idle_a', 'idle_a_ped', 3) ~= 1 and LocalPlayer.state.ziptied) then playAnim(playerPed, 're@stag_do@idle_a', 'idle_a_ped', -1) end end end) end -- function IsZiptied(ped) -- if (IsEntityPlayingAnim(ped, 're@stag_do@idle_a', 'idle_a_ped', 3)) then return true end -- return false -- end --[[--------------------------------------------------------------------- Hands Up Code ]]----------------------------------------------------------------------- -- local isHandsup = false --]]-------------------------------------------------- RegisterNetEvent('esx:playerLoaded') AddEventHandler("esx:playerLoaded", function(xPlayer) ESX.PlayerData = xPlayer ESX.PlayerLoaded = true end) RegisterNetEvent('esx:onPlayerLogout') AddEventHandler('esx:onPlayerLogout', function() ESX.PlayerLoaded = false ESX.PlayerData = {} end) function playAnim(ped, animDict, animName, duration, emoteMoving, playbackRate) local movingType = 49 if (emoteMoving == nil) then movingType = 49 elseif (emoteMoving == false) then movingType = 0 end RequestAnimDict(animDict) while not HasAnimDictLoaded(animDict) do Citizen.Wait(100) end local playbackSpeed = playbackRate or 0 -- TaskPlayAnim(ped, animDict, animName, 1.0, -1.0, duration, movingType, 1, false, false, false) TaskPlayAnim(ped, animDict, animName, 2.0, 2.0, duration, movingType, playbackSpeed, false, false, false) RemoveAnimDict(animDict) end config.lua Config = {} Config.ZiptieSpeed = 3 -- 3 seconds Config.HandcuffTimer = 10 * 60000 -- 10 minutes. Config.ZiptieRemovers = { avbitare = { -- Name of item. timer = 5, -- How long it takes to remove zipties. OneTimeUse = false -- Remove after use? or allowed to use again. }, } Config.qtarget = true -- Disable if you don't use qtarget. fxmanifest.lua --[[---------------------------------- Creation Date: 27/02/21 ]]------------------------------------ fx_version 'cerulean' game 'gta5' author 'leah_uk' version '1.3.3' versioncheck 'https://raw.githubusercontent.com/Leah-UK/bixbi_zipties/main/fxmanifest.lua' lua54 'yes' shared_scripts { '@es_extended/imports.lua', -- Remove this if you're on an ESX version less than 1.3 'config.lua' } client_scripts { 'client/client.lua' } server_scripts { 'server/server.lua' } exports { "ToggleHandsUp", "AreHandsUp", "IsZiptied" } Kolla på koden och gör en server.lua

I'll analyze the code and create a server.lua file that complements the existing client.lua and config.lua files.

Write file
Read file
Created complete server.lua for zipties resource
v1