mirror of
https://github.com/ND-Framework/ND_Core.git
synced 2026-08-17 05:56:01 +01:00
perf: updating last location
This commit is contained in:
@@ -83,7 +83,9 @@ AddEventHandler("playerDropped", function()
|
|||||||
local player = source
|
local player = source
|
||||||
local character = NDCore.Players[player]
|
local character = NDCore.Players[player]
|
||||||
if character then
|
if character then
|
||||||
NDCore.Functions.UpdateLastLocation(character.id, character.lastLocation)
|
local ped = GetPlayerPed(player)
|
||||||
|
local lastLocation = GetEntityCoords(ped)
|
||||||
|
NDCore.Functions.UpdateLastLocation(character.id, {x = lastLocation.x, y = lastLocation.y, z = lastLocation.z})
|
||||||
end
|
end
|
||||||
TriggerEvent("ND:characterUnloaded", player, character)
|
TriggerEvent("ND:characterUnloaded", player, character)
|
||||||
character = nil
|
character = nil
|
||||||
|
|||||||
@@ -11,20 +11,6 @@ function GetCoreObject()
|
|||||||
return NDCore
|
return NDCore
|
||||||
end
|
end
|
||||||
|
|
||||||
CreateThread(function()
|
|
||||||
while true do
|
|
||||||
Wait(30000)
|
|
||||||
for player, playerInfo in pairs(NDCore.Players) do
|
|
||||||
local ped = GetPlayerPed(player)
|
|
||||||
if DoesEntityExist(ped) then
|
|
||||||
local lastLocation = GetEntityCoords(ped)
|
|
||||||
playerInfo.lastLocation = {x = lastLocation.x, y = lastLocation.y, z = lastLocation.z}
|
|
||||||
TriggerClientEvent("ND:updateLastLocation", player, playerInfo.lastLocation)
|
|
||||||
end
|
|
||||||
end
|
|
||||||
end
|
|
||||||
end)
|
|
||||||
|
|
||||||
isResourceStarted("ox_inventory", function(started)
|
isResourceStarted("ox_inventory", function(started)
|
||||||
if not started then return end
|
if not started then return end
|
||||||
SetConvarReplicated("inventory:framework", "nd")
|
SetConvarReplicated("inventory:framework", "nd")
|
||||||
|
|||||||
Reference in New Issue
Block a user