Skip to content

Commit 1b003ec

Browse files
feat(client/framework/esx): ESX 1.11 support (#467)
Adds exports from ESX 1.11
1 parent 0f1eb8f commit 1b003ec

File tree

1 file changed

+34
-2
lines changed

1 file changed

+34
-2
lines changed

client/framework/esx/compatibility.lua

Lines changed: 34 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,8 @@ RegisterNetEvent("skinchanger:getSkin", function(cb)
2929
end)
3030
end)
3131

32-
RegisterNetEvent("skinchanger:loadSkin", function(skin, cb)
32+
33+
local function LoadSkin(skin, cb)
3334
if skin.model then
3435
client.setPlayerAppearance(skin)
3536
else -- add validation invisible when failed registration (maybe server restarted when apply skin)
@@ -42,16 +43,47 @@ RegisterNetEvent("skinchanger:loadSkin", function(skin, cb)
4243
if cb ~= nil then
4344
cb()
4445
end
46+
end
47+
48+
RegisterNetEvent("skinchanger:loadSkin", function(skin, cb)
49+
LoadSkin(skin, cb)
4550
end)
4651

47-
RegisterNetEvent("skinchanger:loadClothes", function(_, clothes)
52+
local function loadClothes(_, clothes)
4853
local components = Framework.ConvertComponents(clothes, client.getPedComponents(cache.ped))
4954
local props = Framework.ConvertProps(clothes, client.getPedProps(cache.ped))
5055

5156
client.setPedComponents(cache.ped, components)
5257
client.setPedProps(cache.ped, props)
58+
end
59+
60+
RegisterNetEvent("skinchanger:loadClothes", function(_, clothes)
61+
loadClothes(_, clothes)
5362
end)
5463

5564
RegisterNetEvent("esx_skin:openSaveableMenu", function(onSubmit, onCancel)
5665
InitializeCharacter(Framework.GetGender(true), onSubmit, onCancel)
5766
end)
67+
68+
local function exportHandler(exportName, func)
69+
AddEventHandler(('__cfx_export_skinchanger_%s'):format(exportName), function(setCB)
70+
setCB(func)
71+
end)
72+
end
73+
74+
exportHandler("GetSkin", function()
75+
while not Framework.PlayerData do
76+
Wait(1000)
77+
end
78+
79+
local appearance = lib.callback.await("illenium-appearance:server:getAppearance", false)
80+
return appearance
81+
end)
82+
83+
exportHandler("LoadSkin", function(skin)
84+
return LoadSkin(skin)
85+
end)
86+
87+
exportHandler("LoadClothes", function(playerSkin, clothesSkin)
88+
return loadClothes(playerSkin, clothesSkin)
89+
end)

0 commit comments

Comments
 (0)