🪄ps-buffs

General Information

  • Buffs are new effects that a player can get. Example: Stamina Buff makes the player run faster

    • They show up as a new icon

  • Enhancements are making statuses you already have better. Example: Health Buff heals a player periodically

    • They show up as yellow on the status they are affecting. Example: Armor buffs makes the armor icon yellow

  • By default adding buffs to a player will just have the buff icon show

    • You need to add logic to give the player buff effects (below you can see examples)

  • Avaliable buffs you can pick from are in the config file (shared/config.lua)

Add a buff to a player
example-buff.lua
-- Function signature - buffName: string, time: int (1 second = 1000)
exports['ps-buffs']:AddBuff(buffName, time)
lua
-- Example -- Adds a hacking buff for 15 seconds, which the player would see a hacking buff icon on their screen
exports['ps-buffs']:AddBuff("hacking", 15000)
Check if player has a buff
example-check.lua
-- Function signature - buffName: string
exports['ps-buffs']:HasBuff(buffName)

-- Example -- Check if a player has the hacking buff and make it easier to hack something
if exports['ps-buffs']:HasBuff("hacking") then
    -- give player more time or less complicated puzzle
end

Last updated