JustScripts
  • Welcome to JustScripts Documentation
  • JustCarWash
    • Installation
    • Config Setup
  • JustHud
    • Configuration
    • Features
    • Chat
    • Placeholders
    • Elements
    • Custom Elements
    • Exports
  • JustHud(Old)
    • Installation
    • Config Setup
    • Events
  • JustTrucker
    • Installation
    • Config Setup
  • JustSecurity
    • Installation
  • JustDrugs
    • Installation
  • JustFarmer
    • Installation
  • JustCases
    • Configuration
    • Exports
    • Tebex integration
  • JustBank
    • Configuration
    • Exports
    • Society Accounts
  • JustDataSync
  • JustFishing
  • JustNotify
    • Exports
Powered by GitBook
On this page
  • Identifier and profile
  • Player rewards
  • Offers
  • Case Categories
  • Cases
  • Rewards
  • Grant
  1. JustCases

Configuration

JustCases is highly customizable and letting you to change almost everything within the script

Identifier and profile

-- / Which identifier script should use to save player data
-- | Possible values:
-- | character for esx or qbcore character ids (will lose everything on death)
-- \ or simply use other fivem supported identifiers (steam, discord,license)
Config.Identifier = "steam"

Config.Profile = {
    -- Player name could be steam or character
    Name = "steam",
    -- Steam or nil for avatars 
    -- For steam you should have steam_webApiKey in your server.cfg
    Avatar = nil 
}

You can decide which player identifier JustCases use to save your players data. When you change Config.Identifier to character, JustCases use character id from your framework to save player data such as coins and cases, So players will lose everything on JustCases when they die and recreate their character.

By changing Config.Profile.Name you will decide what name is displayed in script menu for users, by choosing steam it will be player public steam name and by choosing character the chatacter name from your framework will be displayed.

By default, script uses static image for player profiles on server but you can use player steam avatars by setting Config.Profile.Avatar to steam

Note: for using steam names, profiles or identifiers you should set your steam web api key in your server.cfg.

Player rewards

-- / Default grants upon player join 
-- \ Cases should be validated case Ids defined in Config.Cases section
Config.FirstTimeJoin = {
    Silvers = 0,
    Golds = 0,
    Cases = {"money_1", "weapon_1"}
}

Config.PlayTimeRewards = {
    PreventAfk = false,
    Coins = {
        Type = "silvers",
        Time = 2, -- seconds
        Grant = 1, 
    },
    Cases = {
        Enable = true,
        Time = 60, -- seconds  
        -- Rewards = {["test1"] = 30, ["test1_key"] = 10},  Will grant a random case reward (test1_key represents test1 key item)
        Rewards = {["money_1"] = 100}
    }
}

You can reward your players for spending time in your server. If you set PreventAfk true, player would not receive rewards when they are not moving.

For disabling coins rewards, set Config.PlayTimeRewards.Coins.Grant to 0.

Offers

-- / Configuration of case shop special offer (chrismas, etc)
-- | Set Active to false to completely disable it
-- \ The items of this offer should be defined in Config.Cases.Special
Config.SpecialOffer = {
    Active = true,
    Title = "Test event",
    Color = "#34eb49",
    End = "2025-09-29 23:00" -- Event end time 
}

In special events such as Christmas, halloween etc. you can enable this option and sell limited time cases to your players.

Offer title and color are customizable and you can set specific end time for countdown.

The cases should be defined in Config.Cases.Special category

Case Categories

Config.CaseCategories = {
    {
        title = "Money",
        icon = "Money" -- Icons can be select from https://iconsax-react.pages.dev/
    },
    {
        title = "Cars",
        icon = "Car"
    }
}

Each case should have category, you can set category names and icons. Select your icons from iconsax

Cases

Config.Cases = {
    Money = { -- Category Name
        {
            id = "money_1",
            is_in_store = true,
            name = "Money Case 1",
            rarity = "common", -- common, rare, epic, mythic, legendary
            silver_price = 10, -- Set 0 to disable it
            gold_price = 10,
            image = "images/money_1.webp",
            rewards = {}
        }
    }
}

First step to define a case is to create a category. Objects of cases should be in their categories.

id - Should be a unique string that identifies case (id is not visible to players) name - String that is visible to players is_in_store - Some of the cases are not purchasable from main menu and are only grantable from commands, for hiding cases in main menu set is_in_store to false rarity - the rarity of case (also the background color of image) silver_price, gold_price - you can sale cases with both currencies, for disabling each currency or both set their value to 0 image - The case icon, it could be an internal path in web/images or a direct link to your custom image justscripts already provided a number of custom icons in web/images rewards - An array of rewards

Rewards

local reward = 
{
    id = "reward1", -- Unique id for this case rewards
    name = "Demo item #1",
    rarity = "common", -- common, rare, epic, mythic, legendary
    chance = 30,
    display_chance = 30,
    icon = "images/money-reward.png",
    grant = {},
    -- Recycle the reward for coins 
    -- only one value can be registered (gold or silver)
    recycle = {
        golds = 1,
        silvers = 1
    },
}

id - Should be unique string in case rewards name - visible reward name to player rarity - rarity of reward (this would not modify the chance of this item) chance - chance percentage of obtaining this item display_chance - displayed chance to player icon - The case icon, it could be an internal path in web/images or a direct link to your custom image justscripts already provided a number of custom icons in web/images grant - a grant object recycle - you can create recyclable rewards, players can choose to recycle or keep the granted reward

Grant

local grant = 
{
        type = "money", -- Item, weapon, money, custom
        amount = 1000, -- 1000$ reward
        item = "item_name",
        weapon = "weapon_name",
        custom = function (source)
        end
}

For delivering rewards to players, you need to create a grant

type - The grant type, can be item, weapon,vehicle, money or a custom function Note: You can't set type to item, weapon or money in custom frameworks amount - The amount of items, money or weapon item - the item name (if grant type is item) weapon - the weapon name (if grant type is weapon) vehicle - the vehicle model (if grant type is vehicle) custom - the custom function for custom items deliveries

Custom function take source argument which is the server id of the item winner Note: the custom function will execute on server-side so you can't use client-side exports or natives.

local customItemGrant = function(source)
    print(source .. " Won a reward !") -- This message will be printed on server console
    exports.CustomFramework:AddMoney(source, 9999999)
end

PreviousJustCasesNextExports

Last updated 6 months ago