Skip to content

Instantly share code, notes, and snippets.

@Lucas7yoshi
Created September 20, 2022 14:19
Show Gist options
  • Save Lucas7yoshi/c5b9af46631051492b6706936d3e91a3 to your computer and use it in GitHub Desktop.
Save Lucas7yoshi/c5b9af46631051492b6706936d3e91a3 to your computer and use it in GitHub Desktop.
CreateThread(function()
Citizen.InvokeNative(0x144da052257ae7d8, true)
print("ENABLED NETWORK ALLOW REMOTE SYNC OF LOCAL PLAYERS")
end)
function GetNearestPlayerToMe()
local players = GetActivePlayers()
local closestPlayer, closestDistance = nil, 100000
local myPos = GetEntityCoords(PlayerPedId())
local myPlayerId = PlayerId()
for i = 1, #players do
local player = players[i]
if player ~= myPlayerId then
local ped = GetPlayerPed(player)
local pos = GetEntityCoords(ped)
local distance = #(pos - myPos)
if distance < closestDistance then
closestPlayer, closestDistance = player, distance
end
end
end
if closestPlayer then
return closestPlayer, closestDistance
end
return false, false
end
function Animseqnet1()
local closestPlayer, closestDistance = GetNearestPlayerToMe()
local dict = "mp_arresting"
RequestAnimDict(dict)
repeat Wait(0) until HasAnimDictLoaded(dict)
local myPed = PlayerPedId()
local targetPed = GetPlayerPed(closestPlayer)
local targetPos = GetEntityCoords(targetPed)
local targetHeading = GetEntityHeading(targetPed)
local scene = NetworkCreateSynchronisedScene(targetPos.x, targetPos.y, targetPos.z, 0.0, 0.0, targetHeading, 2, false, false, 1.0, 0.0, 1.0)
print(scene)
NetworkAddPedToSynchronisedScene(myPed, scene, dict, "arrest_on_floor_back_left_a", 8.0, -8.0, 0, 0, 1000.0, 0)
NetworkAddPedToSynchronisedScene(targetPed, scene, dict, "arrest_on_floor_back_left_b", 8.0, -8.0, 0, 0, 1000.0, 0)
NetworkStartSynchronisedScene(scene)
end
RegisterCommand("animseqnet1", Animseqnet1)
RegisterCommand("animseqnet", Animseqnet1)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment