Skip to content

Commit

Permalink
Update GetPlayerFromPed function
Browse files Browse the repository at this point in the history
updated old method of finding ped to one that supports OneSync
  • Loading branch information
murfasa committed Apr 21, 2020
1 parent 44be7f9 commit 4019cec
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions CuffedUp/kb-c.lua
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,9 @@ local function getEntity(player) -- function To Get Entity Player Is Aiming At
end

function GetPlayerFromPed(ped)
for a = 0, 64 do
if GetPlayerPed(a) == ped then
return a
for _, player in ipairs(GetActivePlayers()) do
if GetPlayerPed(player) == ped then
return player
end
end
return -1
Expand All @@ -23,10 +23,10 @@ end
-- Functions

Citizen.CreateThread(function()
local player = PlayerId()
while true do
Citizen.Wait(0)
local player = PlayerId()
local ped = GetPlayerPed(PlayerId())
Citizen.Wait(0)
if IsPedInMeleeCombat(ped) then
if IsControlJustReleased(1, 51) then

Expand Down Expand Up @@ -57,7 +57,7 @@ Citizen.CreateThread(function()
while not HasAnimDictLoaded(hudict) do
Citizen.Wait(100)
end

while true do
Citizen.Wait(0)
if IsControlJustPressed(1, 323) then --Start holding X
Expand All @@ -71,7 +71,7 @@ Citizen.CreateThread(function()
end
end
end

end)

RegisterNetEvent('cu:cuffanim')
Expand Down

0 comments on commit 4019cec

Please sign in to comment.