Skip to content

Commit

Permalink
fix(migration): ESX gender conversion fixed
Browse files Browse the repository at this point in the history
  • Loading branch information
TheiLLeniumStudios committed Feb 10, 2023
1 parent f299157 commit faa0b5e
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions server/framework/esx/migrate.lua
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ local function tofloat(num)
return num + 0.0
end

local function convertSkinToNewFormat(oldSkin)
local function convertSkinToNewFormat(oldSkin, gender)
local skin = {
components = Framework.ConvertComponents(oldSkin),
eyeColor = oldSkin.eye_color,
Expand Down Expand Up @@ -121,7 +121,7 @@ local function convertSkinToNewFormat(oldSkin)
secondColor = oldSkin.makeup_4 or 0
}
},
model = oldSkin.sex == 0 and "mp_m_freemode_01" or "mp_m_freemode_01",
model = gender == "m" and "mp_m_freemode_01" or "mp_m_freemode_01",
props = Framework.ConvertProps(oldSkin),
tattoos = {}
}
Expand All @@ -139,7 +139,7 @@ lib.addCommand("admin", "migrateskins", function(source)
if user.skin then
local oldSkin = json.decode(user.skin)
if oldSkin.hair_1 then -- Convert only if its an old skin
local skin = json.encode(convertSkinToNewFormat(oldSkin))
local skin = json.encode(convertSkinToNewFormat(oldSkin, user.sex))
local affectedRows = Database.Users.UpdateSkinForUser(user.identifier, skin)
if affectedRows then
convertedSkins += 1
Expand Down

0 comments on commit faa0b5e

Please sign in to comment.