Upgrade Scripts Docs

#Installation

#Drop the files in your server

Start by dropping the files included in the resource from keymaster into your resources folder, make sure to ensure the resource in your server.cfg

ensure sparks-consumables

#Setup Config

The config is relatively simple to setup, set your framework, and inventory. Then you can setup the consumables you want in the script.

#Visual Effects

The different options for consumable effects are

  • 'alcohol'
  • 'weed'
  • 'acid'
  • 'meth'
  • 'coke'
  • 'crack'
  • 'heroin'
  • 'lean'
  • 'medicine'
  • 'ecstasy'

#Status Effect

  • thirst
  • hunger
  • armor
  • stress
  • addStress
  • health

These effect can be setup at {x, y} to give a random amount between x and y, as just a number to give an exact amount, or as a negative to give a negative amount to the status.

Config = {}

-- Core Settings
Config.Framework = 'qb' -- 'qb' for QBCore, 'esx' for ESX
Config.Inventory = 'ox_inventory' -- 'qb-inventory', 'ox_inventory', 'esx_inventory'
Config.ControlItemUse = true

-- Effect Durations (in milliseconds)
Config.Effects = {
    Acid = 30000,
    Weed = 60000,
    Meth = 8000,
    Coke = 20000,
    Crack = 8000,
    Heroin = 8000,
    Lean = 30000,
    Ecstasy = 30000,
    Alcohol = 45000
}

-- Animation Configurations
Config.Animations = {
    pill = {
        dict = "mp_suicide",
        anim = "pill",
        flag = 49,
        duration = 1500
    },
    smoke = {
        dict = "switch@trevor@trev_smoking_meth",
        anim = "trev_smoking_meth_loop",
        flag = 49,
        duration = 1500
    },
    drink = {
        dict = "mp_player_intdrink",
        anim = "loop_bottle",
        flag = 49,
        duration = 3000,
        prop = {
            model = "prop_cs_beer_bot_40oz",
            bone = 60309,
            coords = vector3(0.0, 0.0, -0.05),
            rotation = vector3(0.0, 0.0, -40.0)
        }
    },
    inject = {
        dict = "rcmpaparazzo1ig_4",
        anim = "miranda_shooting_up",
        flag = 49,
        duration = 1500,
        prop = {
            model = "prop_syringe_01",
            bone = 18905,
            coords = vector3(0.11, 0.03, 0.0),
            rotation = vector3(-124.0, 0.0, 0.0)
        }
    },
    eat = {
        dict = "mp_player_inteat@burger",
        anim = "mp_player_int_eat_burger",
        flag = 49,
        duration = 5000
    }
}

-- Item Configurations
Config.Items = {
    -- ALCOHOL EXAMPLES
    ["beer"] = {
        category = "alcohol",
        animation = "drink",
        effects = {
            thirst = {2, 4},     -- Random value between 2-4
            hunger = 0,          -- Fixed value
            armor = {1, 2},      -- Random value between 1-2
            stress = {1, 2}      -- Random value between 1-2
        }
    },
    ["vodka"] = {
        category = "alcohol",
        animation = "drink",
        effects = {
            thirst = {20, 40},
            armor = {1, 2},
            stress = {5, 10}
        }
    },

    -- WEED EXAMPLES
    ["joint"] = {
        category = "weed",
        animation = "smoke",
        effects = {
            stress = {15, 25},
            hunger = {-5, -30}  -- Negative values reduce stats
        }
    },
    ["weed_brownie"] = {
        category = "weed",
        animation = "eat",
        effects = {
            hunger = {20, 30},
            stress = {15, 25}
        },
        delay = 30  -- Delay in seconds before effects kick in
    },

    -- ACID EXAMPLES
    ["acid_tab"] = {
        category = "acid",
        animation = "pill",
        effects = {
            armor = {30, 50},
            stress = {20, 30}
        }
    },
    ["smiley_tabs"] = {
        category = "acid",
        animation = "pill",
        effects = {
            armor = {30, 50},
            stress = 0
        }
    },

    -- METH EXAMPLES
    ["meth"] = {
        category = "meth",
        animation = "smoke",
        effects = {
            armor = {5, 10},
            addStress = {12, 24},  -- addStress increases stress instead of reducing it
            health = {-5, -10}     -- Damages health
        }
    },
    ["crystal_meth"] = {
        category = "meth",
        animation = "smoke",
        effects = {
            armor = {10, 20},
            addStress = {24, 48}
        }
    },

    -- COCAINE EXAMPLES
    ["coke_baggy"] = {
        category = "coke",
        animation = "pill",
        effects = {
            armor = {10, 20},
            stress = {12, 24}
        }
    },
    ["crack"] = {
        category = "crack",
        animation = "smoke",
        effects = {
            armor = {25, 45},
            addStress = {24, 48}
        }
    },

    -- HEROIN EXAMPLES
    ["heroin"] = {
        category = "heroin",
        animation = "inject",
        effects = {
            health = {25, 45},
            armor = {25, 45}
        }
    },
    ["dirty_heroin"] = {
        category = "heroin",
        animation = "inject",
        effects = {
            health = {15, 25},
            armor = {15, 25},
            addStress = {5, 10}
        }
    },

    -- LEAN/PRESCRIPTION EXAMPLES
    ["lean_cup"] = {
        category = "lean",
        animation = "drink",
        effects = {
            thirst = 35,
            armor = {20, 35},
            stress = {10, 20}
        }
    },
    ["oxy"] = {
        category = "medicine",
        animation = "pill",
        effects = {
            health = {25, 35},
            stress = {10, 15}
        }
    },

    -- ECSTASY EXAMPLES
    ["ecstasy_pill"] = {
        category = "ecstasy",
        animation = "pill",
        effects = {
            armor = {5, 10},
            stress = {12, 24},
            health = {-2, -5}
        }
    },
    ["mdma"] = {
        category = "ecstasy",
        animation = "pill",
        effects = {
            armor = {10, 15},
            stress = {24, 48},
            health = {-5, -10}
        }
    },

    -- NO EFFECT ITEMS (Medical/Utility)
    ["bandage"] = {
        category = "medical",
        animation = "pill",
        effects = {
            health = {8, 10}
        }
    },
    ["firstaid"] = {
        category = "medical",
        animation = "pill",
        effects = {
            health = {35, 50},
            stress = {45, 65}
        }
    }
}

-- Language Configuration
Config.Lang = {
    Canceled = 'Canceled Use!',
    Using = 'Using %s',
    
    -- Drug-specific messages
    DoAcid = 'Letting Blotter Dissolve',
    DoMeth = 'Smoking Meth',
    DoCoke = 'Snorting Cocaine',
    DoCrack = 'Smoking Crack',
    DoEx = 'Taking Pills',
    DoAlcohol = 'Drinking',
    DoOxy = 'Taking Pain Meds',
    DoHeroin = 'Shooting Up',
    DoWeed = 'Smoking',
    DoWeedEat = 'Eating Edible',
    DoLean = 'Sipping Lean'
}