Configuration
EXPORTS
The following exports can be used to check, change, or remove a player’s lifestyle. These are useful for integrating with other scripts or enforcing logic based on a player’s role.
CHECK LIFESTYLE
exports['1337_lifestyles']:CheckLifestyle(source, "gang") --> true/false
exports['1337_lifestyles']:CheckLifestyle(source) --> "civilian" or "gang"
CHANGE LIFESTYLE
exports['1337_lifestyles']:ChangeLifestyle(source, "civilian")
REMOVE LIFESTYLE
exports['1337_lifestyles']:RemoveLifestyle(source)
Restricting Lifestyles in 1337-Gravediggers as an example
Gravediggers Client.lua Usage
RegisterNetEvent('1337_gravedigger:lifestyleCheckResult', function(canDeliver)
if not canDeliver then
lib.notify({
description = Locales.civilian_blocked,
type = 'error'
})
return
end
Gravediggers Server.lua Usage
RegisterNetEvent('1337_gravedigger:checkLifestyle', function()
local src = source
local Player = QBCore.Functions.GetPlayer(src)
if not Player then return end
-- Optional: Get the lifestyle string
local lifestyle = exports['1337_lifestyles']:CheckLifestyle(src)
if exports['1337_lifestyles']:CheckLifestyle(src, "civilian") then
TriggerClientEvent('1337_gravedigger:lifestyleCheckResult', source, false)
else
TriggerClientEvent('1337_gravedigger:lifestyleCheckResult', source, true)
end
end)
Any script you are adding the lifestyle check you must have access to the main client/server files
UI Configuration
-- Choose preset style: "custom", "dark", "blue", "neon"
style = "custom", -- Only when "custom", the below color values are used
cardStyle = "rounded", -- options: "rounded", "square", "pill"
-- Custom Theme Colors (used only if style == "custom")
primaryColor = "#ff0808",
primaryColorHover = "#d90606",
backgroundColor = "#121212",
dialogBackground = "#181818",
optionBackground = "#1c1c1c",
optionHover = "#262626",
-- Custom Text Colors (used only if style == "custom")
titleColor = "#ffffff",
descriptionColor = "#d0d0d0",
textColor = "#ffffff",
subTextColor = "#b0b0b0",
iconColor = "#ffffff",
Lifestyles Config Preview Example
Config.Debug = false
Config.EnableCommand = false -- For testing usually, if enabled players can use it
Config.CommandName = "lifestyle"
Config.Notify = "qb" -- options: "ox", "qb"
Config.TargetSystem = "auto" -- auto, "ox", or "qb"
Config.Ped = {
enabled = false, -- Toggle ped interaction on/off (Disable players from switching lifestyles)
model = "a_m_m_business_01",
coords = vector3(-532.48, -200.22, 38.22),
heading = 302.67
}
Config.Lifestyles = {
civilian = {
label = "Civilian", -- Lifestyle name
items = { -- Items received upon first creation
{ item = "water_bottle", amount = 5 },
{ item = "phone", amount = 1 }
}
},
gang = {
label = "Gang", -- Lifestyle name
items = { -- Items received upon first creation
{ item = "weapon_pistol", amount = 1 }
}
}
}
Config.UI = {
-- Choose preset style: "custom", "dark", "blue", "neon"
style = "custom", -- Only when "custom", the below color values are used
cardStyle = "rounded", -- options: "rounded", "square", "pill"
-- Custom Theme Colors (used only if style == "custom")
primaryColor = "#ff0808",
primaryColorHover = "#d90606",
backgroundColor = "#121212",
dialogBackground = "#181818",
optionBackground = "#1c1c1c",
optionHover = "#262626",
-- Custom Text Colors (used only if style == "custom")
titleColor = "#ffffff",
descriptionColor = "#d0d0d0",
textColor = "#ffffff",
subTextColor = "#b0b0b0",
iconColor = "#ffffff",
-- UI Text
title = "Lifestyles Selection",
description = "Every choice shapes your future. Will you chase stability or risk it all? Choose wisely.",
civilianTitle = "Civilian Lifestyle",
civilianDescription = "Build a life through discipline and strategy. Connect, grow, and make your mark.",
civilianButton = "Choose Civilian",
gangTitle = "Gang Lifestyle",
gangDescription = "Power isn’t given, it’s taken. Earn respect, take risks, and define your name.",
gangButton = "Choose Gang",
confirmTitle = "Confirm Lifestyle",
confirmMessage = "Are you sure you want to choose the {lifestyle} lifestyle?",
confirmButton = "Confirm",
cancelButton = "Cancel",
-- Notifications
invalidLifestyle = "Invalid lifestyle selected.",
selectedLifestyle = "You have chosen the {lifestyle} lifestyle!",
playerDataNotFound = "Player data not found!",
currentLifestyle = "Your current lifestyle: {lifestyle}",
-- Help Popup
help = {
title = "Getting Started in the City",
items = {
{ icon = "fa-scale-balanced", text = "Respect the city, follow the rules, and keep it realistic." },
{ icon = "fa-house", text = "Your starting apartment has storage & a closet for clothing." },
{ icon = "fa-id-card", text = "Get a driver’s license from the DMV to stay off police radar." },
{ icon = "fa-briefcase", text = "Check City Hall for jobs or carve your own path in the streets." },
{ icon = "fa-cart-shopping", text = "Stock up on essentials from stores around the city." },
{ icon = "fa-road", text = "Have fun and start your lifestyle now." }
}
}
Last updated