Skip to content

Commit

Permalink
feat(client): Configurable sections for new character creation menu (i…
Browse files Browse the repository at this point in the history
  • Loading branch information
TheiLLeniumStudios authored Jul 12, 2022
1 parent aff7978 commit 9b16ffd
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 25 deletions.
37 changes: 16 additions & 21 deletions client/client.lua
Original file line number Diff line number Diff line change
Expand Up @@ -196,19 +196,17 @@ function getDefaultConfig()
}
end

local function getConfigForPermission(hasPedPerms)
local function getNewCharacterConfig()
local config = getDefaultConfig()
config.ped = true
config.headBlend = true
config.faceFeatures = true
config.headOverlays = true
config.components = true
config.props = true
config.tattoos = true
config.enableExit = false

if Config.EnablePedMenu then
config.ped = hasPedPerms
end
config.ped = Config.NewCharacterSections.Ped
config.headBlend = Config.NewCharacterSections.HeadBlend
config.faceFeatures = Config.NewCharacterSections.FaceFeatures
config.headOverlays = Config.NewCharacterSections.HeadOverlays
config.components = Config.NewCharacterSections.Components
config.props = Config.NewCharacterSections.Props
config.tattoos = Config.NewCharacterSections.Tattoos

return config
end
Expand All @@ -229,16 +227,13 @@ RegisterNetEvent('qb-clothes:client:CreateFirstCharacter', function()
exports['fivem-appearance']:setPedProps(ped, Config.InitialPlayerClothes[gender].Props)
exports['fivem-appearance']:setPedHair(ped, Config.InitialPlayerClothes[gender].Hair)
ClearPedDecorations(ped)
QBCore.Functions.TriggerCallback("QBCore:HasPermission", function(permission)
local config = getConfigForPermission(permission)
config.enableExit = false
exports['fivem-appearance']:startPlayerCustomization(function(appearance)
if (appearance) then
TriggerServerEvent('fivem-appearance:server:saveAppearance', appearance)
ResetRechargeMultipliers()
end
end, config)
end, Config.PedMenuGroup)
local config = getNewCharacterConfig()
exports['fivem-appearance']:startPlayerCustomization(function(appearance)
if (appearance) then
TriggerServerEvent('fivem-appearance:server:saveAppearance', appearance)
ResetRechargeMultipliers()
end
end, config)
end)
end)

Expand Down
4 changes: 0 additions & 4 deletions server/server.lua
Original file line number Diff line number Diff line change
Expand Up @@ -53,10 +53,6 @@ QBCore.Functions.CreateCallback('fivem-appearance:server:getAppearance', functio
end
end)

QBCore.Functions.CreateCallback('QBCore:HasPermission', function(source, cb, perm)
cb(QBCore.Functions.HasPermission(source, perm))
end)

QBCore.Functions.CreateCallback('fivem-appearance:server:hasMoney', function(source, cb, shopType)
local Player = QBCore.Functions.GetPlayer(source)
local money = getMoneyForShop(shopType)
Expand Down
10 changes: 10 additions & 0 deletions shared/config.lua
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,16 @@ Config.EnablePedsForPlayerOutfitRooms = true
Config.EnablePedMenu = true
Config.PedMenuGroup = "admin"

Config.NewCharacterSections = {
Ped = true,
HeadBlend = true,
FaceFeatures = true,
HeadOverlays = true,
Components = true,
Props = true,
Tattoos = true
}

Config.AlwaysKeepProps = false

Config.PersistUniforms = false -- Keeps Job / Gang Outfits on player reconnects / logout
Expand Down

0 comments on commit 9b16ffd

Please sign in to comment.