diff --git a/compatibility/backwards/server.lua b/compatibility/backwards/server.lua index a6dc434..529c467 100644 --- a/compatibility/backwards/server.lua +++ b/compatibility/backwards/server.lua @@ -196,6 +196,13 @@ function NDCore.Functions.UpdateLastLocation(characterId, location) }) 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. RegisterNetEvent("ND:GetCharacters", function() local src = source diff --git a/server/player.lua b/server/player.lua index c91aa89..4251c45 100644 --- a/server/player.lua +++ b/server/player.lua @@ -111,6 +111,9 @@ local function createCharacterTable(info) -- Unload and save character function self.unload() 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) if ped then local coords = GetEntityCoords(ped) @@ -235,6 +238,9 @@ local function createCharacterTable(info) local char = NDCore.players[self.source] if char and char.id == self.id then return true 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 TriggerEvent("ND:characterLoaded", self) self.triggerEvent("ND:characterLoaded", self)