Skip to content

Commit

Permalink
fix(migrate): force save for migration
Browse files Browse the repository at this point in the history
  • Loading branch information
Frowmza committed Aug 12, 2024
1 parent 6e4e9c7 commit 321d4b2
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 5 deletions.
4 changes: 2 additions & 2 deletions src/server/appearance/setters.ts
Original file line number Diff line number Diff line change
Expand Up @@ -52,11 +52,11 @@ exports('SavePlayerTattoos', function(id, tattoos) {
});


export async function saveAppearance(src: number, frameworkId: string, appearance: TAppearance) {
export async function saveAppearance(src: number, frameworkId: string, appearance: TAppearance, force?: boolean) {
if (src && frameworkId) {
const playerId = getFrameworkID(src);

if (frameworkId !== playerId) {
if (!force && frameworkId !== playerId) {
console.warn('You are trying to save an appearance for a different player', src, frameworkId);
return;
}
Expand Down
2 changes: 1 addition & 1 deletion src/server/migrate/fivem.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ const migrate = async (src: string) => {
await delay(100);
const response = await triggerClientCallback('bl_appearance:client:getAppearance', src) as TAppearance
const playerSrc = parseInt(src)
await saveAppearance(playerSrc, element.citizenid, response as TAppearance)
await saveAppearance(playerSrc, element.citizenid, response as TAppearance, true)
}
}
console.log('Converted '+ response.length + ' appearances')
Expand Down
2 changes: 1 addition & 1 deletion src/server/migrate/illenium.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ const migrate = async (src: string) => {
await delay(100);
const response = await triggerClientCallback('bl_appearance:client:getAppearance', src) as TAppearance
const playerSrc = parseInt(src)
await saveAppearance(playerSrc, element.citizenid, response as TAppearance)
await saveAppearance(playerSrc, element.citizenid, response as TAppearance, true)
}
}
console.log('Converted '+ response.length + ' appearances')
Expand Down
2 changes: 1 addition & 1 deletion src/server/migrate/qb.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ const migrate = async (src: string) => {
await delay(200);
const response = await triggerClientCallback('bl_appearance:client:getAppearance', src) as TAppearance
const playerSrc = parseInt(src)
await saveAppearance(playerSrc, element.citizenid, response as TAppearance)
await saveAppearance(playerSrc, element.citizenid, response as TAppearance, true)
}
console.log('Converted '+ response.length + ' appearances')
};
Expand Down

0 comments on commit 321d4b2

Please sign in to comment.