Skip to content

Commit

Permalink
fix(server/storage/players): use correct check for group grade (#529)
Browse files Browse the repository at this point in the history
* fix(server/storage/players): use correct check for group grade

* Update server/storage/players.lua

Co-authored-by: Manason <clanerp@gmail.com>

* Update server/storage/players.lua

Co-authored-by: Manason <clanerp@gmail.com>

---------

Co-authored-by: Manason <clanerp@gmail.com>
  • Loading branch information
solareon and Manason authored Aug 8, 2024
1 parent ab5dd32 commit ae3d11c
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions server/storage/players.lua
Original file line number Diff line number Diff line change
Expand Up @@ -326,7 +326,7 @@ local function fetchPlayerGroups(citizenid)
local validGroup = group.type == GroupType.JOB and GetJob(group.group) or GetGang(group.group)
if not validGroup then
lib.print.warn(('Invalid group %s found in player_groups table, Does it exist in shared/%ss.lua?'):format(group.group, group.type))
elseif not validGroup[group.grade] then
elseif not validGroup.grades?[group.grade] then
lib.print.warn(('Invalid grade %s found in player_groups table for %s %s, Does it exist in shared/%ss.lua?'):format(group.grade, group.type, group.group, group.type))
elseif group.type == GroupType.JOB then
jobs[group.group] = group.grade
Expand Down Expand Up @@ -383,7 +383,7 @@ local function cleanPlayerGroups()
if not validGroup then
MySQL.query.await('DELETE FROM player_groups WHERE `group` = ? AND type = ?', {group.group, group.type})
lib.print.info(('Remove invalid %s %s from player_groups table'):format(group.type, group.group))
elseif not validGroup[group.grade] then
elseif not validGroup.grades?[group.grade] then
MySQL.query.await('DELETE FROM player_groups WHERE `group` = ? AND type = ? AND grade = ?', {group.group, group.type, group.grade})
lib.print.info(('Remove invalid %s %s grade %s from player_groups table'):format(group.type, group.group, group.grade))
end
Expand Down

0 comments on commit ae3d11c

Please sign in to comment.