Skip to content

Commit

Permalink
fix(baseevents): use NetworkGetPlayerIndexFromPed rather than old act…
Browse files Browse the repository at this point in the history
…ive player loop.
  • Loading branch information
The-Neco committed Mar 25, 2021
1 parent f559e8b commit 860a4b2
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 8 deletions.
9 changes: 1 addition & 8 deletions resources/[system]/baseevents/deathevents.lua
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ Citizen.CreateThread(function()
end
end

local killerid = GetPlayerByEntityID(killer)
local killerid = NetworkGetPlayerIndexFromPed(killer)
if killer ~= ped and killerid ~= nil and NetworkIsPlayerActive(killerid) then killerid = GetPlayerServerId(killerid)
else killerid = -1
end
Expand Down Expand Up @@ -64,10 +64,3 @@ Citizen.CreateThread(function()
end
end
end)

function GetPlayerByEntityID(id)
for i=0,32 do
if(NetworkIsPlayerActive(i) and GetPlayerPed(i) == id) then return i end
end
return nil
end
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
-- This resource is part of the default Cfx.re asset pack (cfx-server-data)
-- Altering or recreating for local use only is strongly discouraged.

fx_version 'cerulean'
game 'gta5'

version '1.0.0'
author 'Cfx.re <[email protected]>'
description 'Adds basic events for developers to use in their scripts. Some third party resources may depend on this resource.'
Expand Down

0 comments on commit 860a4b2

Please sign in to comment.