EZ Scripts
DiscordTebex
  • 💡Welcome To EZ Scripts
  • FIVEM
    • 🍀EZ White Widow
      • Config File
      • Add more locations
      • Common Issues
    • 🟣EZ Lean Drug
      • Config File
      • Add more locations
    • ❄️EZ Coke & Crack Drug
      • Config File
      • Add more locations
    • 🔠EZ Plate Changer
      • Config File
    • 📑Ez Lib
      • Config File
    • 🛡️Ez Admin Authority
      • Config File
    • 🫳Ez Item Spawner
      • Config File
      • Permission Check
      • Add Item
      • Get Items
  • RedM
    • 💼EZ Society & Job Meny
      • Config File
      • Exports
      • Syn Society
    • 🌍EZ Fast Travel
      • Config File
    • 🛡️Ez Admin Authority
      • Config File
    • 🍖Ez Consumables
      • Config File
    • 📺Ez HUD
      • Config File
      • Exports and Events
    • 🚷EZ Combat Logging
      • Config File
    • 🗽EZ Life Style
      • Getting Life Style
      • Config File
    • ☢️EZ Radial Menu
      • Config File
    • 🫳Ez Item Spawner
      • Config File
      • Permission Check
      • Add Item
      • Get Items
Powered by GitBook
On this page

Was this helpful?

  1. RedM
  2. EZ Life Style

Config File

PreviousGetting Life StyleNextEZ Radial Menu

Last updated 4 months ago

Was this helpful?

🗽
https://github.com/EZ-Scripts/ez_lifestyle/blob/main/config.lua
Config = {}
Core = exports.vorp_core:GetCore()
Config.DefaultLifeStyle = "civilian" -- What is returned when lifestyle is null. 
Config.StarterItemsOnlyFirstTime = true -- If true, players can only get starter items once when they first create chararacter. Prevent Exploit.
Config.ChooseLifeStyleOnce = true -- If true, players can only choose lifestyle once. This will automatically turn on Config.StarterItemsOnlyFirstTime

Config.LifeSyles = {
    outlaw = {
        name= "The Outlaw",
        description=  "A life of crime and rebellion. Rob, smuggle, and live by your own rules, always evading the law.",
        spawnLocation = vector3(1227.77, -1304.7, 76.95), -- Set to spawn location to spawn at
        spawnHeading = 140.49, -- Set to heading to spawn at
        starterItems = {
            {
                label = "Cattleman Revolver",
                quantity = 1,
                name = 'WEAPON_REVOLVER_CATTLEMAN',
                type = 'weapon'
            },
            {
                label = "Lockpick",
                quantity = 7,
                name = 'lockpick'
            },
            {
                label = "Whiskey Bottle",
                quantity = 5,
                name = 'whisky'
            },
            {
                label = "Cash",
                quantity = 50,
                type = 'money'
            }
        }
    },
    bounty_hunter = {
        name= "The Bounty Hunter",
        description=  "A skilled tracker paid to bring criminals to justice, dead or alive.",
        spawnLocation = vector3(-174.3, 621.18, 114.08),
        spawnHeading = 240.38,
        starterItems = {
            {
                label = "Cattleman Revolver",
                quantity = 1,
                name = 'WEAPON_REVOLVER_CATTLEMAN',
                type = 'weapon'
            },
            {
                label = "Lasso",
                quantity = 1,
                name = 'WEAPON_LASSO',
                type = 'weapon'
            },
            {
                label = "Whiskey Bottle",
                quantity = 5,
                name = 'whisky'
            },

        }
    },
    hunter = {
        name= "The Hunter",
        description=  "A self-reliant wanderer who hunts for food, trade, and survival in the wilderness.",
        spawnLocation = vector3(-687.3, -1242.249, 43.1),
        spawnHeading = 90.58,
        starterItems = {
            {
                label = "Bow",
                quantity = 1,
                name = 'WEAPON_BOW',
                type = 'weapon'
            },
            {
                label = "Arrows",
                quantity = 7,
                name = 'ammoarrownormal'
            },
            {
                label = "Hunting Knife",
                quantity = 5,
                name = 'WEAPON_MELEE_KNIFE',
                type = 'weapon'
            },
            {
                label = "Cash",
                quantity= 100,
                type = 'money'
            }
        }
    },
    civilian = {
        name= "The Civilian",
        description=  "An honest worker focused on stability, making a living through trade or craft.",
        starterItems = {
            {
                label = "Lantern",
                quantity = 1,
                name = 'WEAPON_MELEE_LANTERN',
                type = 'weapon'
            },
            {
                label = "Pocket Watch",
                quantity = 1,
                name = 'pocket_watch'
            },
            {
                label = "Food",
                quantity = 5,
                name = 'consumable_peach'
            },
            {
                label = "Water",
                quantity = 15,
                name = 'water'
            },
            {
                label = "Cash",
                quantity= 200,
                type = 'money'
            }
        }
    },
}

Config.GiveStarterItems = function(source, id)
    local VORPInv = exports.vorp_inventory
    local user = Core.getUser(source)
    if not user then
        return
    end
    local character = user.getUsedCharacter
    if not Config.LifeSyles[id] or not Config.LifeSyles[id].starterItems then
        return
    end

    for k, v in pairs(Config.LifeSyles[id].starterItems) do
        if v.type == "weapon" then
            local canCarry = VORPInv:canCarryWeapons(source, v.quantity, nil, v.name)
            if not canCarry then
                goto continue
            end

            local result = VORPInv:createWeapon(source, v.name, {})
            if not result then
                goto continue
            end
        elseif v.type == "money" then
            character.addCurrency(0, v.quantity)
        elseif v.type == "gold" then
            character.addCurrency(1, v.quantity)
        elseif v.type == "rol" then
            character.addCurrency(2, v.quantity)
        else
            local itemCheck = VORPInv:getItemDB(v.name)
            local canCarry = VORPInv:canCarryItems(source, v.quantity)
            local canCarry2 = VORPInv:canCarryItem(source, v.name, v.quantity)

            if not itemCheck or not canCarry or not canCarry2 then
                goto continue
            end

            VORPInv:addItem(source, v.name, v.quantity)
        end
        ::continue::
    end
    return true
end


Config.GetUniqueIdentifierForCharacter = function(source)
    local Core = exports.vorp_core:GetCore()
    local user = Core.getUser(source)
    if not user then return end
    local character = user.getUsedCharacter
    return character.charIdentifier
end