From e591cf00ea46f98e527c0852156fde25bb67a421 Mon Sep 17 00:00:00 2001 From: Kasey FItton Date: Thu, 24 Oct 2024 16:01:47 +0100 Subject: [PATCH] fix(esx_skin): fix /saveskin command and add missing params --- [core]/esx_skin/client/main.lua | 5 +++-- [core]/esx_skin/server/main.lua | 10 +++++++--- 2 files changed, 10 insertions(+), 5 deletions(-) diff --git a/[core]/esx_skin/client/main.lua b/[core]/esx_skin/client/main.lua index 243d30ec..86920a27 100644 --- a/[core]/esx_skin/client/main.lua +++ b/[core]/esx_skin/client/main.lua @@ -134,13 +134,14 @@ function CreateSkinCam() end local playerPed = PlayerPedId() + local coords = GetEntityCoords(playerPed) SetCamActive(cam, true) RenderScriptCams(true, true, 500, true, true) isCameraActive = true - SetCamCoord(cam, GetEntityCoords(playerPed)) - SetCamRot(cam, 0.0, 0.0, 270.0, true) + SetCamCoord(cam, coords.x, coords.y, coords.z) + SetCamRot(cam, 0.0, 0.0, 270.0, 2) SetEntityHeading(playerPed, 0.0) end diff --git a/[core]/esx_skin/server/main.lua b/[core]/esx_skin/server/main.lua index 1804130e..b7e5cbb4 100644 --- a/[core]/esx_skin/server/main.lua +++ b/[core]/esx_skin/server/main.lua @@ -40,8 +40,12 @@ AddEventHandler("esx_skin:responseSaveSkin", function(skin) local xPlayer = ESX.GetPlayerFromId(source) if xPlayer.getGroup() == "admin" then - local file = io.open("resources/[esx]/esx_skin/skins.txt", "a") - + print("[^3WARNING^7] /saveskin is a debug command and should not be used in production") + local path = GetResourcePath(GetCurrentResourceName()) + local file = io.open(("%s/skins.txt"):format(path), "a") + if not file then + return + end file:write(json.encode(skin) .. "\n\n") file:flush() file:close() @@ -56,7 +60,7 @@ ESX.RegisterServerCallback("esx_skin:getPlayerSkin", function(source, cb) MySQL.query("SELECT skin FROM users WHERE identifier = @identifier", { ["@identifier"] = xPlayer.identifier, }, function(users) - local user, skin = users[1] + local user, skin = users[1], nil local jobSkin = { skin_male = xPlayer.job.skin_male,