update: compat for get admin and update ace on group

This commit is contained in:
Andyyy7666
2023-08-24 01:00:54 +02:00
parent 9738fc236b
commit 46fc396924
2 changed files with 13 additions and 0 deletions

View File

@@ -196,6 +196,13 @@ function NDCore.Functions.UpdateLastLocation(characterId, location)
}) })
end end
function NDCore.Functions.IsPlayerAdmin(src)
local player = NDCore.getPlayer(src)
if player.groups["admin"] then
return true
end
end
-- Getting all the characters the player has and returning them to the client. -- Getting all the characters the player has and returning them to the client.
RegisterNetEvent("ND:GetCharacters", function() RegisterNetEvent("ND:GetCharacters", function()
local src = source local src = source

View File

@@ -111,6 +111,9 @@ local function createCharacterTable(info)
-- Unload and save character -- Unload and save character
function self.unload() function self.unload()
if not NDCore.players[self.source] then return end if not NDCore.players[self.source] then return end
for name, _ in pairs(self.groups) do
ExecuteCommand(("remove_principal identifier.%s group.%s"):format(self.identifier, name))
end
local ped = GetPlayerPed(self.source) local ped = GetPlayerPed(self.source)
if ped then if ped then
local coords = GetEntityCoords(ped) local coords = GetEntityCoords(ped)
@@ -235,6 +238,9 @@ local function createCharacterTable(info)
local char = NDCore.players[self.source] local char = NDCore.players[self.source]
if char and char.id == self.id then return true end if char and char.id == self.id then return true end
if char then char.unload() end if char then char.unload() end
for name, _ in pairs(self.groups) do
ExecuteCommand(("add_principal identifier.%s group.%s"):format(self.identifier, name))
end
NDCore.players[self.source] = self NDCore.players[self.source] = self
TriggerEvent("ND:characterLoaded", self) TriggerEvent("ND:characterLoaded", self)
self.triggerEvent("ND:characterLoaded", self) self.triggerEvent("ND:characterLoaded", self)