diff --git a/[core]/esx_skin/client/main.lua b/[core]/esx_skin/client/main.lua index 86920a27..33b611a5 100644 --- a/[core]/esx_skin/client/main.lua +++ b/[core]/esx_skin/client/main.lua @@ -1,261 +1,51 @@ -local lastSkin, cam, isCameraActive -local firstSpawn, zoomOffset, camOffset, heading = true, 0.0, 0.0, 90.0 +Skin = {} +Skin._index = Skin -RegisterNetEvent("esx:playerLoaded") -AddEventHandler("esx:playerLoaded", function(_, _, skin) - TriggerServerEvent("esx_skin:setWeight", skin) -end) +Skin.firstSpawn = true +Skin.zoomOffset = 0.0 +Skin.camOffset = 0.0 +Skin.heading = 90.0 +Skin.customPI = math.pi / 180.0 -function OpenMenu(submitCb, cancelCb, restrict) - local playerPed = PlayerPedId() - - TriggerEvent("skinchanger:getSkin", function(skin) - lastSkin = skin - end) - TriggerEvent("skinchanger:getData", function(components, maxVals) - local elements = {} - local _components = {} - - -- Restrict menu - if restrict == nil then - for i = 1, #components, 1 do - _components[i] = components[i] - end - else - for i = 1, #components, 1 do - local found = false - - for j = 1, #restrict, 1 do - if components[i].name == restrict[j] then - found = true - end - end - - if found then - table.insert(_components, components[i]) - end - end - end - -- Insert elements - for i = 1, #_components, 1 do - local value = _components[i].value - local componentId = _components[i].componentId - - if componentId == 0 then - value = GetPedPropIndex(playerPed, _components[i].componentId) - end - - local data = { - label = _components[i].label, - name = _components[i].name, - value = value, - min = _components[i].min, - textureof = _components[i].textureof, - zoomOffset = _components[i].zoomOffset, - camOffset = _components[i].camOffset, - type = "slider", - } - - for k, v in pairs(maxVals) do - if k == _components[i].name then - data.max = v - break - end - end - - table.insert(elements, data) - end - - CreateSkinCam() - zoomOffset = _components[1].zoomOffset - camOffset = _components[1].camOffset - - ESX.UI.Menu.Open("default", GetCurrentResourceName(), "skin", { - title = TranslateCap("skin_menu"), - align = "bottom-left", - elements = elements, - }, function(data, menu) - TriggerEvent("skinchanger:getSkin", function(skin) - lastSkin = skin - end) - - submitCb(data, menu) - DeleteSkinCam() - end, function(data, menu) - menu.close() - DeleteSkinCam() - TriggerEvent("skinchanger:loadSkin", lastSkin) - - if cancelCb ~= nil then - cancelCb(data, menu) - end - end, function(data, menu) - local skin, tempMaxVals - - TriggerEvent("skinchanger:getSkin", function(getSkin) - skin = getSkin - end) - - zoomOffset = data.current.zoomOffset - camOffset = data.current.camOffset - - if skin[data.current.name] ~= data.current.value then - -- Change skin element - TriggerEvent("skinchanger:change", data.current.name, data.current.value) - - -- Update max values - TriggerEvent("skinchanger:getData", function(comp, max) - tempMaxVals = max - end) - - local newData = {} - - for i = 1, #elements, 1 do - newData.max = tempMaxVals[elements[i].name] - - if elements[i].textureof ~= nil and data.current.name == elements[i].textureof then - newData.value = 0 - end - - menu.update({ name = elements[i].name }, newData) - end - - menu.refresh() - end - end, function() - DeleteSkinCam() - end) - end) +function Skin:CalcualteHeading(angle) + if angle > 360 then + angle = angle - 360 + elseif angle < 0 then + angle = angle + 360 + end + angle = angle * self.customPI + return angle end -function CreateSkinCam() - if not DoesCamExist(cam) then - cam = CreateCam("DEFAULT_SCRIPTED_CAMERA", true) - end +function Skin:CalcuatePosition(coords) - local playerPed = PlayerPedId() - local coords = GetEntityCoords(playerPed) + local angle = self.heading * self.customPI + local theta = { + x = math.cos(angle), + y = math.sin(angle), + } - SetCamActive(cam, true) - RenderScriptCams(true, true, 500, true, true) + local pos = { + x = coords.x + (self.zoomOffset * theta.x), + y = coords.y + (self.zoomOffset * theta.y), + } - isCameraActive = true - SetCamCoord(cam, coords.x, coords.y, coords.z) - SetCamRot(cam, 0.0, 0.0, 270.0, 2) - SetEntityHeading(playerPed, 0.0) -end + local angleToLook = self:CalcualteHeading(self.heading - 140.0) + + local thetaToLook = { + x = math.cos(angleToLook), + y = math.sin(angleToLook), + } -function DeleteSkinCam() - isCameraActive = false - SetCamActive(cam, false) - RenderScriptCams(false, true, 500, true, true) - cam = nil -end - -CreateThread(function() - local customPI = math.pi / 180.0 - while true do - local sleep = 1500 - - if isCameraActive then - sleep = 0 - DisableControlAction(2, 30, true) - DisableControlAction(2, 31, true) - DisableControlAction(2, 32, true) - DisableControlAction(2, 33, true) - DisableControlAction(2, 34, true) - DisableControlAction(2, 35, true) - DisableControlAction(0, 25, true) -- Input Aim - DisableControlAction(0, 24, true) -- Input Attack - - local playerPed = PlayerPedId() - local coords = GetEntityCoords(playerPed) - - local angle = heading * customPI - local theta = { - x = math.cos(angle), - y = math.sin(angle), - } - - local pos = { - x = coords.x + (zoomOffset * theta.x), - y = coords.y + (zoomOffset * theta.y), - } - - local angleToLook = heading - 140.0 - if angleToLook > 360 then - angleToLook = angleToLook - 360 - elseif angleToLook < 0 then - angleToLook = angleToLook + 360 - end - - angleToLook = angleToLook * customPI - local thetaToLook = { - x = math.cos(angleToLook), - y = math.sin(angleToLook), - } - - local posToLook = { - x = coords.x + (zoomOffset * thetaToLook.x), - y = coords.y + (zoomOffset * thetaToLook.y), - } - - SetCamCoord(cam, pos.x, pos.y, coords.z + camOffset) - PointCamAtCoord(cam, posToLook.x, posToLook.y, coords.z + camOffset) - - ESX.ShowHelpNotification(TranslateCap("use_rotate_view")) - end - Wait(sleep) - end -end) - -CreateThread(function() - local angle = 90 - - while true do - local sleep = 1500 - - if isCameraActive then - sleep = 0 - if IsControlPressed(0, 209) then - angle = angle - 1 - elseif IsControlPressed(0, 19) then - angle = angle + 1 - end - - if angle > 360 then - angle = angle - 360 - elseif angle < 0 then - angle = angle + 360 - end - - heading = angle + 0.0 - end - Wait(sleep) - end -end) - -function OpenSaveableMenu(submitCb, cancelCb, restrict) - TriggerEvent("skinchanger:getSkin", function(skin) - lastSkin = skin - end) - - OpenMenu(function(data, menu) - menu.close() - DeleteSkinCam() - - TriggerEvent("skinchanger:getSkin", function(skin) - TriggerServerEvent("esx_skin:save", skin) - - if submitCb ~= nil then - submitCb(data, menu) - end - end) - end, cancelCb, restrict) + local posToLook = { + x = coords.x + (self.zoomOffset * thetaToLook.x), + y = coords.y + (self.zoomOffset * thetaToLook.y), + } + return pos, posToLook end AddEventHandler("esx_skin:resetFirstSpawn", function() - firstSpawn = true + Skin.firstSpawn = true ESX.PlayerLoaded = false end) @@ -265,57 +55,46 @@ AddEventHandler("esx_skin:playerRegistered", function() Wait(100) end - if firstSpawn then + if Skin.firstSpawn then ESX.TriggerServerCallback("esx_skin:getPlayerSkin", function(skin) if skin == nil then - TriggerEvent("skinchanger:loadSkin", { sex = 0 }, OpenSaveableMenu) - Wait(100) + exports["skinchanger"]:loadSkin({ sex = 0 }) + Menu:Saveable() else - TriggerEvent("skinchanger:loadSkin", skin) - Wait(100) + exports["skinchanger"]:loadSkin(skin) end end) - firstSpawn = false + Skin.firstSpawn = false end end) end) -RegisterNetEvent("esx:playerLoaded") -AddEventHandler("esx:playerLoaded", function() +RegisterNetEvent("esx:playerLoaded", function(_, _, skin) ESX.PlayerLoaded = true + TriggerServerEvent("esx_skin:setWeight", skin) +end) + +RegisterNetEvent("esx_skin:openMenu", function(submitCb, cancelCb) + Menu:Open(submitCb, cancelCb, nil) +end) + +RegisterNetEvent("esx_skin:openRestrictedMenu", function(submitCb, cancelCb, restrict) + Menu:Open(submitCb, cancelCb, nil) +end) + +RegisterNetEvent("esx_skin:openSaveableMenu", function(submitCb, cancelCb) + Menu:Saveable(submitCb, cancelCb, nil) +end) + +RegisterNetEvent("esx_skin:openSaveableRestrictedMenu", function(submitCb, cancelCb, restrict) + Menu:Saveable(submitCb, cancelCb, restrict) end) AddEventHandler("esx_skin:getLastSkin", function(cb) - cb(lastSkin) + cb(Skin.Last) end) + AddEventHandler("esx_skin:setLastSkin", function(skin) - lastSkin = skin -end) - -RegisterNetEvent("esx_skin:openMenu") -AddEventHandler("esx_skin:openMenu", function(submitCb, cancelCb) - OpenMenu(submitCb, cancelCb, nil) -end) - -RegisterNetEvent("esx_skin:openRestrictedMenu") -AddEventHandler("esx_skin:openRestrictedMenu", function(submitCb, cancelCb, restrict) - OpenMenu(submitCb, cancelCb, restrict) -end) - -RegisterNetEvent("esx_skin:openSaveableMenu") -AddEventHandler("esx_skin:openSaveableMenu", function(submitCb, cancelCb) - OpenSaveableMenu(submitCb, cancelCb, nil) -end) - -RegisterNetEvent("esx_skin:openSaveableRestrictedMenu") -AddEventHandler("esx_skin:openSaveableRestrictedMenu", function(submitCb, cancelCb, restrict) - OpenSaveableMenu(submitCb, cancelCb, restrict) -end) - -RegisterNetEvent("esx_skin:requestSaveSkin") -AddEventHandler("esx_skin:requestSaveSkin", function() - TriggerEvent("skinchanger:getSkin", function(skin) - TriggerServerEvent("esx_skin:responseSaveSkin", skin) - end) -end) + Skin.Last = skin +end) \ No newline at end of file diff --git a/[core]/esx_skin/client/modules/camera.lua b/[core]/esx_skin/client/modules/camera.lua new file mode 100644 index 00000000..73b94102 --- /dev/null +++ b/[core]/esx_skin/client/modules/camera.lua @@ -0,0 +1,83 @@ +Camera = {} +Camera._index = Camera + +function Camera:AngleLoop() + CreateThread(function() + local angle = 90 + + while self.cam do + if IsDisabledControlPressed(0, 44) then + angle = angle - 1 + elseif IsDisabledControlPressed(0, 38) then + angle = angle + 1 + end + + if angle > 360 then + angle = angle - 360 + elseif angle < 0 then + angle = angle + 360 + end + + Skin.heading = angle + 0.0 + Wait(0) + end + end) +end + +function Camera:DisableContols() + local controls = {30, 31, 32, 33, 34, 35, 25, 24} + for i=1 , #controls do + DisableControlAction(2, controls[i], true) + end +end + +function Camera:PositionLoop() + CreateThread(function() + while self.cam do + self:DisableContols() + + local ped = ESX.PlayerData.ped or PlayerPedId() + local coords = GetEntityCoords(ped) + + local pos, posToLook = Skin:CalcuatePosition(coords) + + SetCamCoord(self.cam, pos.x, pos.y, coords.z + Skin.camOffset) + PointCamAtCoord(self.cam, posToLook.x, posToLook.y, coords.z + Skin.camOffset) + Wait(0) + end + end) +end + +function Camera:StartLoops() + ESX.TextUI(Translate('use_rotate_view', "Q", "E")) + self:AngleLoop() + self:PositionLoop() +end + +function Camera:Create() + if self.cam then + return + end + + local playerPed = ESX.PlayerData.ped or PlayerPedId() + local playerCoords = GetEntityCoords(playerPed) + + self.cam = CreateCam("DEFAULT_SCRIPTED_CAMERA", true) + SetCamCoord(self.cam, playerCoords.x, playerCoords.y, playerCoords.z + 1.0) + SetCamRot(self.cam, 0.0, 0.0, 270.0, 2) + SetEntityHeading(playerPed, 0.0) + + SetCamActive(self.cam, true) + RenderScriptCams(true, true, 500, true, true) + self:StartLoops() +end + +function Camera:Destroy() + if not self.cam then + return + end + + RenderScriptCams(false, true, 500, true, true) + DestroyCam(self.cam, true) + self.cam = nil +end diff --git a/[core]/esx_skin/client/modules/menu.lua b/[core]/esx_skin/client/modules/menu.lua new file mode 100644 index 00000000..df606b2b --- /dev/null +++ b/[core]/esx_skin/client/modules/menu.lua @@ -0,0 +1,144 @@ +Menu = {} +Menu._index = Menu + +function Menu:ESXMenu() + ESX.UI.Menu.Open("default", GetCurrentResourceName(), "skin", { + title = TranslateCap("skin_menu"), + align = "bottom-left", + elements = self.elements, + }, function(data, menu) + self:Submit(data, menu) + end, function(data, menu) + self:Cancel(data, menu) + end, function(data, menu) + self:Change(data, menu) + end, function() + self:Close() + end) +end + +function Menu:Restrict() + local _components = {} + for i = 1, #self.components, 1 do + local found = false + + for j = 1, #self.restricted, 1 do + if self.components[i].name == self.restricted[j] then + found = true + end + end + + if found then + _components[#_components + 1] = self.components[i] + end + end +end + +function Menu:InsertElements() + local playerPed = ESX.PlayerData.ped or PlayerPedId() + + for i = 1, #self.components, 1 do + local value = self.components[i].value + local componentId = self.components[i].componentId + + if componentId == 0 then + value = GetPedPropIndex(playerPed, self.components[i].componentId) + end + + local data = self.components[i] + data.value = value + data.type = "slider" + data.max = type(data.max) == "function" and data.max() or data.max + + if not self.elements then + self.elements = {} + end + self.elements[#self.elements + 1] = data + end +end + +function Menu:Submit(data, menu) + Skin.last = exports["skinchanger"]:GetSkin() + self.submitCb(data, menu) + Camera:Destroy() +end + +function Menu:Cancel(data, menu) + menu.close() + Camera:Destroy() + TriggerEvent("skinchanger:loadSkin", Skin.last) + + if self.cancelCb then + self.cancelCb(data, menu) + end +end + +function Menu:Change(data, menu) + local skin = exports["skinchanger"]:GetSkin() + + Skin.zoomOffset = data.current.zoomOffset + Skin.camOffset = data.current.camOffset + + if skin[data.current.name] ~= data.current.value then + -- Change skin element + TriggerEvent("skinchanger:change", data.current.name, data.current.value) + + local newData = {} + + for i = 1, #self.elements, 1 do + local component = self.components[i] + newData.max = type(component.max) == "function" and component.max() or component.max + + if self.elements[i].textureof ~= nil and data.current.name == self.elements[i].textureof then + newData.value = 0 + end + + menu.update({ name = self.elements[i].name }, newData) + end + + self.elements = newData + menu.refresh() + end +end + +---@diagnostic disable-next-line: duplicate-set-field +function Menu:Close() + Camera:Destroy() +end + +function Menu:Open(submit, cancel, restrict) + self.submitCb = submit + self.cancelCb = cancel + self.restricted = restrict + Skin.last = exports["skinchanger"]:GetSkin() + + self.components, self.maxValues = exports["skinchanger"]:GetData() + + if restrict then + self.components = self:Restrict() + end + + self:InsertElements() + + self.zoomOffset = self.components[1].zoomOffset + self.camOffset = self.components[1].camOffset + Camera:Create() + + self:ESXMenu() +end + +function Menu:Saveable(submitCb, cancelCb, restrict) + Skin.last = exports["skinchanger"]:GetSkin() + + self:Open(function(data, menu) + menu.close() + Camera:Destroy() + + local skin = exports["skinchanger"]:GetSkin() + TriggerServerEvent("esx_skin:save", skin) + + if submitCb ~= nil then + submitCb(data, menu) + end + end, cancelCb, restrict) +end \ No newline at end of file diff --git a/[core]/esx_skin/fxmanifest.lua b/[core]/esx_skin/fxmanifest.lua index 0f14b54c..7e7f6e2b 100644 --- a/[core]/esx_skin/fxmanifest.lua +++ b/[core]/esx_skin/fxmanifest.lua @@ -5,21 +5,21 @@ description 'Allows players to customise their character\'s appearance' version '1.10.10' lua54 'yes' -shared_script '@es_extended/imports.lua' +shared_scripts { + '@es_extended/locale.lua', + 'locales/*.lua', + '@es_extended/imports.lua', + 'config.lua', +} server_scripts { '@oxmysql/lib/MySQL.lua', - '@es_extended/locale.lua', - 'locales/*.lua', - 'config.lua', 'server/main.lua' } client_scripts { - '@es_extended/locale.lua', - 'locales/*.lua', - 'config.lua', - 'client/main.lua' + 'client/main.lua', + 'client/modules/*.lua' } dependencies { diff --git a/[core]/esx_skin/locales/da.lua b/[core]/esx_skin/locales/da.lua index e6d8b8f8..4aee2f79 100644 --- a/[core]/esx_skin/locales/da.lua +++ b/[core]/esx_skin/locales/da.lua @@ -1,6 +1,6 @@ Locales["da"] = { ["skin_menu"] = "Udseende Menu", - ["use_rotate_view"] = "brug ~INPUT_FRONTEND_LS~ og ~INPUT_CHARACTER_WHEEL~ for at dreje kameraet.", + ["use_rotate_view"] = "brug Q og E for at dreje kameraet.", ["skin"] = "skift udseende", ["saveskin"] = "gem udseende til en fil", } diff --git a/[core]/esx_skin/locales/de.lua b/[core]/esx_skin/locales/de.lua index b40caa1d..d92041a1 100644 --- a/[core]/esx_skin/locales/de.lua +++ b/[core]/esx_skin/locales/de.lua @@ -1,6 +1,6 @@ Locales["de"] = { ["skin_menu"] = "Skin Menü", - ["use_rotate_view"] = "Drücke ~INPUT_FRONTEND_LS~ oder ~INPUT_CHARACTER_WHEEL~ um deine Ansicht zu ändern.", + ["use_rotate_view"] = "Drücke Q oder E um deine Ansicht zu ändern.", ["skin"] = "Aussehen ändern", ["saveskin"] = "Aussehen abspeichern", - } \ No newline at end of file + } diff --git a/[core]/esx_skin/locales/en.lua b/[core]/esx_skin/locales/en.lua index 5372bb93..afc9581a 100644 --- a/[core]/esx_skin/locales/en.lua +++ b/[core]/esx_skin/locales/en.lua @@ -1,6 +1,6 @@ Locales["en"] = { ["skin_menu"] = "Skin Menu", - ["use_rotate_view"] = "use ~INPUT_FRONTEND_LS~ and ~INPUT_CHARACTER_WHEEL~ to rotate the view.", + ["use_rotate_view"] = "use Q and E to rotate the view.", ["skin"] = "change skin", ["saveskin"] = "save skin to a file", } diff --git a/[core]/esx_skin/locales/es.lua b/[core]/esx_skin/locales/es.lua index 2cda4f34..735c78fe 100644 --- a/[core]/esx_skin/locales/es.lua +++ b/[core]/esx_skin/locales/es.lua @@ -1,6 +1,6 @@ Locales["es"] = { ["skin_menu"] = "Menú de apariencia", - ["use_rotate_view"] = "Utiliza ~INPUT_FRONTEND_LS~ y ~INPUT_CHARACTER_WHEEL~ para rotar la vista.", + ["use_rotate_view"] = "Utiliza Q y E para rotar la vista.", ["skin"] = "Cambiar aspecto", ["saveskin"] = "Guarda tu aspecto actual", } diff --git a/[core]/esx_skin/locales/fi.lua b/[core]/esx_skin/locales/fi.lua index b725260d..7747dcc0 100644 --- a/[core]/esx_skin/locales/fi.lua +++ b/[core]/esx_skin/locales/fi.lua @@ -1,6 +1,6 @@ Locales["fi"] = { ["skin_menu"] = "Ulkonäkö", - ["use_rotate_view"] = "Paina ~INPUT_FRONTEND_LS~ tai ~INPUT_CHARACTER_WHEEL~ liikutaaksesi kameraa.", + ["use_rotate_view"] = "Paina Q tai E liikutaaksesi kameraa.", ["skin"] = "Muokkaa ulkonäköä", ["saveskin"] = "Tallenna", } diff --git a/[core]/esx_skin/locales/fr.lua b/[core]/esx_skin/locales/fr.lua index cce0db0a..44d3d4b2 100644 --- a/[core]/esx_skin/locales/fr.lua +++ b/[core]/esx_skin/locales/fr.lua @@ -1,6 +1,6 @@ Locales["fr"] = { ["skin_menu"] = "menu de Skin", - ["use_rotate_view"] = "utilisez ~INPUT_FRONTEND_LS~ et ~INPUT_CHARACTER_WHEEL~ pour tourner la vue.", + ["use_rotate_view"] = "utilisez Q et E pour tourner la vue.", ["skin"] = "changer de skin", ["saveskin"] = "sauvegarder skin dans un fichier", } diff --git a/[core]/esx_skin/locales/he.lua b/[core]/esx_skin/locales/he.lua index 0e9f9379..6f750e07 100644 --- a/[core]/esx_skin/locales/he.lua +++ b/[core]/esx_skin/locales/he.lua @@ -1,6 +1,6 @@ Locales["he"] = { ["skin_menu"] = "תפריט עור", - ["use_rotate_view"] = "השתמש ~INPUT_FRONTEND_LS~ ו ~INPUT_CHARACTER_WHEEL~ כדי לסובב את התצוגה.", + ["use_rotate_view"] = "השתמש Q ו E כדי לסובב את התצוגה.", ["skin"] = "שנה עור", ["saveskin"] = "שמור עור לקובץ", } diff --git a/[core]/esx_skin/locales/hu.lua b/[core]/esx_skin/locales/hu.lua index c7ba9a12..a83ea999 100644 --- a/[core]/esx_skin/locales/hu.lua +++ b/[core]/esx_skin/locales/hu.lua @@ -1,6 +1,6 @@ Locales["hu"] = { ["skin_menu"] = "Kinézet Menü", - ["use_rotate_view"] = "Használd ~INPUT_FRONTEND_LS~ vagy ~INPUT_CHARACTER_WHEEL~ gombokat a forgatáshoz", + ["use_rotate_view"] = "Használd Q vagy E gombokat a forgatáshoz", ["skin"] = "kinézet változtatása", ["saveskin"] = "kinézet mentése fájlba", } diff --git a/[core]/esx_skin/locales/it.lua b/[core]/esx_skin/locales/it.lua index 4f434d42..c6605e97 100644 --- a/[core]/esx_skin/locales/it.lua +++ b/[core]/esx_skin/locales/it.lua @@ -1,6 +1,6 @@ Locales["it"] = { ["skin_menu"] = "Menu Skin", - ["use_rotate_view"] = "usa ~INPUT_FRONTEND_LS~ e ~INPUT_CHARACTER_WHEEL~ per ruotare la visuale.", + ["use_rotate_view"] = "usa Q e E per ruotare la visuale.", ["skin"] = "cambia skin", ["saveskin"] = "salvare la skin", } diff --git a/[core]/esx_skin/locales/nl.lua b/[core]/esx_skin/locales/nl.lua index 7c0a10bb..1ec2b1d2 100644 --- a/[core]/esx_skin/locales/nl.lua +++ b/[core]/esx_skin/locales/nl.lua @@ -1,6 +1,6 @@ Locales["nl"] = { ["skin_menu"] = "Kleding Menu", - ["use_rotate_view"] = "gebruik ~INPUT_FRONTEND_LS~ en ~INPUT_CHARACTER_WHEEL~ om de camera te draaien.", + ["use_rotate_view"] = "gebruik Q en E om de camera te draaien.", ["skin"] = "verander outfit", ["saveskin"] = "sla outfit op in je kledingkast.", } diff --git a/[core]/esx_skin/locales/pl.lua b/[core]/esx_skin/locales/pl.lua index a47859b4..c12fe139 100644 --- a/[core]/esx_skin/locales/pl.lua +++ b/[core]/esx_skin/locales/pl.lua @@ -1,6 +1,6 @@ Locales["pl"] = { ["skin_menu"] = "menu wyglądu", - ["use_rotate_view"] = "użyj ~INPUT_FRONTEND_LS~ i ~INPUT_CHARACTER_WHEEL~ aby obrócić ekran.", + ["use_rotate_view"] = "użyj Q i E aby obrócić ekran.", ["skin"] = "zmień wygląd", ["saveskin"] = "zapisz wygląd do pliku", } diff --git a/[core]/esx_skin/locales/pt.lua b/[core]/esx_skin/locales/pt.lua index f7916886..0109a66a 100644 --- a/[core]/esx_skin/locales/pt.lua +++ b/[core]/esx_skin/locales/pt.lua @@ -1,6 +1,6 @@ Locales["pt"] = { ["skin_menu"] = "Menu de Skin", - ["use_rotate_view"] = "Usa ~INPUT_FRONTEND_LS~ e ~INPUT_CHARACTER_WHEEL~ para rodar a câmara.", + ["use_rotate_view"] = "Usa Q e E para rodar a câmara.", ["skin"] = "alterar skin", ["saveskin"] = "salvar a skin num ficheiro", } diff --git a/[core]/esx_skin/locales/sl.lua b/[core]/esx_skin/locales/sl.lua index 3ae559f3..d2f3571c 100644 --- a/[core]/esx_skin/locales/sl.lua +++ b/[core]/esx_skin/locales/sl.lua @@ -1,6 +1,6 @@ Locales["sl"] = { ["skin_menu"] = "Oblacilni menu.", - ["use_rotate_view"] = "Pritisni ~INPUT_FRONTEND_LS~ in ~INPUT_CHARACTER_WHEEL~ da se obracas s pogledom.", + ["use_rotate_view"] = "Pritisni Q in E da se obracas s pogledom.", ["skin"] = "Zamenjaj Skin.", ["saveskin"] = "Shrani skin.", } diff --git a/[core]/esx_skin/locales/sr.lua b/[core]/esx_skin/locales/sr.lua index 5ec9324c..9d6ee01d 100644 --- a/[core]/esx_skin/locales/sr.lua +++ b/[core]/esx_skin/locales/sr.lua @@ -1,6 +1,6 @@ Locales["sr"] = { ["skin_menu"] = "Skin Meni", - ["use_rotate_view"] = "koristi ~INPUT_FRONTEND_LS~ i ~INPUT_CHARACTER_WHEEL~ da rotiras kameru.", + ["use_rotate_view"] = "koristi Q i E da rotiras kameru.", ["skin"] = "promeni skin", ["saveskin"] = "sacuvaj skin u file", } diff --git a/[core]/esx_skin/locales/sv.lua b/[core]/esx_skin/locales/sv.lua index 19519594..1e14369a 100644 --- a/[core]/esx_skin/locales/sv.lua +++ b/[core]/esx_skin/locales/sv.lua @@ -1,6 +1,6 @@ Locales["sv"] = { ["skin_menu"] = "Skin Meny", - ["use_rotate_view"] = "Använd ~INPUT_FRONTEND_LS~ och ~INPUT_CHARACTER_WHEEL~ för att rotera.", + ["use_rotate_view"] = "Använd Q och E för att rotera.", ["skin"] = "Ända utseende", ["saveskin"] = "Spara", } diff --git a/[core]/esx_skin/locales/zh-cn.lua b/[core]/esx_skin/locales/zh-cn.lua index 6eeafdaf..c0402d43 100644 --- a/[core]/esx_skin/locales/zh-cn.lua +++ b/[core]/esx_skin/locales/zh-cn.lua @@ -1,6 +1,6 @@ Locales["zh-cn"] = { ["skin_menu"] = "皮肤选单", - ["use_rotate_view"] = "使用 ~INPUT_FRONTEND_LS~ 和 ~INPUT_CHARACTER_WHEEL~ 旋转镜头视角.", + ["use_rotate_view"] = "使用 Q 和 E 旋转镜头视角.", ["skin"] = "更换皮肤数据", ["saveskin"] = "保存皮肤数据", } diff --git a/[core]/esx_skin/server/main.lua b/[core]/esx_skin/server/main.lua index b7e5cbb4..c917d3db 100644 --- a/[core]/esx_skin/server/main.lua +++ b/[core]/esx_skin/server/main.lua @@ -1,5 +1,4 @@ -RegisterServerEvent("esx_skin:save") -AddEventHandler("esx_skin:save", function(skin) +RegisterNetEvent("esx_skin:save", function(skin) local xPlayer = ESX.GetPlayerFromId(source) if not ESX.GetConfig().OxInventory then @@ -19,8 +18,7 @@ AddEventHandler("esx_skin:save", function(skin) }) end) -RegisterServerEvent("esx_skin:setWeight") -AddEventHandler("esx_skin:setWeight", function(skin) +RegisterServerEvent("esx_skin:setWeight", function(skin) local xPlayer = ESX.GetPlayerFromId(source) if not ESX.GetConfig().OxInventory then @@ -35,25 +33,6 @@ AddEventHandler("esx_skin:setWeight", function(skin) end end) -RegisterServerEvent("esx_skin:responseSaveSkin") -AddEventHandler("esx_skin:responseSaveSkin", function(skin) - local xPlayer = ESX.GetPlayerFromId(source) - - if xPlayer.getGroup() == "admin" then - 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() - else - print(("[^2INFO^7] ^5%s^7 attempted saving skin to file"):format(xPlayer.getIdentifier())) - end -end) - ESX.RegisterServerCallback("esx_skin:getPlayerSkin", function(source, cb) local xPlayer = ESX.GetPlayerFromId(source) @@ -78,7 +57,3 @@ end) ESX.RegisterCommand("skin", "admin", function(xPlayer) xPlayer.triggerEvent("esx_skin:openSaveableMenu") end, false, { help = TranslateCap("skin") }) - -ESX.RegisterCommand("skinsave", "admin", function(xPlayer) - xPlayer.triggerEvent("esx_skin:requestSaveSkin") -end, false, { help = TranslateCap("saveskin") })