Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 9 additions & 4 deletions client/main.lua
Original file line number Diff line number Diff line change
Expand Up @@ -408,7 +408,7 @@ local function GetPositionByRelativeHeading(ped, head, dist)

return finPosx, finPosy
end
local function openMenu(allowedMenus)
local function openMenu(allowedMenus, isCreatingFirstCharacter)
previousSkinData = json.encode(skinData)
creatingCharacter = true
PlayerData = QBCore.Functions.GetPlayerData()
Expand All @@ -426,6 +426,7 @@ local function openMenu(allowedMenus)
currentClothing = skinData,
hasTracker = trackerMeta,
translations = translations,
isCreatingFirstCharacter = isCreatingFirstCharacter
})
SetNuiFocus(true, true)
SetCursorLocation(0.9, 0.25)
Expand Down Expand Up @@ -1022,7 +1023,7 @@ RegisterNetEvent('qb-clothes:client:CreateFirstCharacter', function()
{menu = "hair", label = Lang:t("menu.hair"), selected = false},
{menu = "clothing", label = Lang:t("menu.character"), selected = false},
{menu = "accessoires", label = Lang:t("menu.accessoires"), selected = false}
})
}, true)

if pData.charinfo.gender == 1 then
skin = "mp_f_freemode_01"
Expand Down Expand Up @@ -1542,12 +1543,13 @@ RegisterNUICallback('resetOutfit', function(_, cb)
previousSkinData = {}
cb('ok')
end)
RegisterNUICallback('close', function(_, cb)
RegisterNUICallback('close', function(data, cb)
local isCreatingFirstCharacter = data.isCreatingFirstCharacter
SetNuiFocus(false, false)
creatingCharacter = false
disableCam()
FreezeEntityPosition(PlayerPedId(), false)
TriggerEvent('qb-clothing:client:onMenuClose')
TriggerEvent('qb-clothing:client:onMenuClose', isCreatingFirstCharacter)
cb('ok')
end)
RegisterNUICallback('getCatergoryItems', function(data, cb)
Expand Down Expand Up @@ -1580,6 +1582,9 @@ RegisterNUICallback('saveClothing', function(_, cb)
SaveSkin()
cb('ok')
end)
RegisterNUICallback('characterCreated', function()
-- Do stuff here as developers need
end)
-- Commands
RegisterCommand("refreshskin", function()
local playerPed = PlayerPedId()
Expand Down
13 changes: 12 additions & 1 deletion html/script.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,9 @@ var translations = {};

var clothingCategorys = [];

// Introduced to allow for new character creation callback
let isCreatingFirstCharacter = false;

$(document).on('click', '.clothing-menu-header-btn', function(e) {
var category = $(this).data('category');

Expand Down Expand Up @@ -378,6 +381,11 @@ $(document).on('click', "#save-menu", function(e) {
e.preventDefault();
QBClothing.Close();
$.post('https://qb-clothing/saveClothing');

if (isCreatingFirstCharacter) {
$.post('https://qb-clothing/characterCreated');
isCreatingFirstCharacter = false;
}
});

$(document).on('click', "#cancel-menu", function(e) {
Expand Down Expand Up @@ -508,7 +516,10 @@ $(document).on('click', '.clothing-menu-myOutfit-option-button-remove', function
});

QBClothing.Close = function() {
$.post('https://qb-clothing/close');
$.post('https://qb-clothing/close', JSON.stringify({
isCreatingFirstCharacter: isCreatingFirstCharacter
}));

$(".change-camera-buttons").fadeOut(150);
$(".clothing-menu-roomOutfits-container").css("display", "none");
$(".clothing-menu-myOutfits-container").css("display", "none");
Expand Down