fix(esx_skin): fix /saveskin command and add missing params

This commit is contained in:
Kasey FItton
2024-10-24 16:01:47 +01:00
parent d0edbe857b
commit e591cf00ea
2 changed files with 10 additions and 5 deletions
+3 -2
View File
@@ -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
+7 -3
View File
@@ -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,