Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function GetPlayers()
- local players = {}
- for i = 0, 31 do
- if NetworkIsPlayerActive(i) then
- table.insert(players, i)
- end
- end
- return players
- end
- unction GetClosestPlayer()
- local players = GetPlayers()
- local closestDistance = -1
- local closestPlayer = -1
- local ply = GetPlayerPed(-1)
- local plyCoords = GetEntityCoords(ply, 0)
- for index,value in ipairs(players) do
- local target = GetPlayerPed(value)
- if(target ~= ply) then
- local targetCoords = GetEntityCoords(GetPlayerPed(value), 0)
- local distance = Vdist(targetCoords["x"], targetCoords["y"], targetCoords["z"], plyCoords["x"], plyCoords["y"], plyCoords["z"])
- if(closestDistance == -1 or closestDistance > distance) then
- closestPlayer = value
- closestDistance = distance
- end
- end
- end
- return closestPlayer, closestDistance
- end
- –HandCuff start
- 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)
- –Handcuff end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement