From 83cacb7ba6e5727512c37c178416cc6aca215642 Mon Sep 17 00:00:00 2001 From: Andyyy7666 <86536434+Andyyy7666@users.noreply.github.com> Date: Sat, 26 Aug 2023 01:37:15 +0200 Subject: [PATCH] update(server/player): job info & data --- server/player.lua | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/server/player.lua b/server/player.lua index 0240767..275e442 100644 --- a/server/player.lua +++ b/server/player.lua @@ -78,7 +78,7 @@ local function createCharacterTable(info) return self.metadata[metadata] end local returnData = {} - for i=1, #metadata then + for i=1, #metadata do local data = metadata[i] returnData[data] = self.metadata[data] end @@ -276,7 +276,6 @@ local function createCharacterTable(info) local groupInfo = Config.groups[name] if not groupInfo then return end if isJob then - self.job = name for _, group in pairs(self.groups) do group.isJob = nil end @@ -300,9 +299,6 @@ local function createCharacterTable(info) ---@param name string function self.removeGroup(name) - if self.job == "name" then - self.job = nil - end self.groups[name] = nil self.triggerEvent("ND:updateCharacter", self) lib.removePrincipal(self.source, ("group.%s"):format(name)) @@ -317,14 +313,20 @@ local function createCharacterTable(info) ---@param job string ---@return boolean - function self.getJob(job) + function self.getJob() for name, group in pairs(self.groups) do - if group.isJob and not job or group.isJob and name == job then - return group + if group.isJob then + return name, group end end end + local jobName, jobInfo = self.getJob() + if jobInfo then + self.job = jobName + self.jobInfo = jobInfo + end + return self end