Giter Site home page Giter Site logo

ps-buffs's Introduction

ps-buffs

Dependencies


General Information


  • Buffs are new effects that a player can get. Example: Stamina Buff makes a 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

-- Function signature - buffName: string, time: int (1 second = 1000)
exports['ps-buffs']:AddBuff(buffName, time)

-- 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

-- 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

Buff Effects


  • We currently have the following buff effects implemented that you can call:
    • Stamina Buff - Makes a player run faster and generate a random partial amount of stamina
        -- Function signature - time: int (1 second = 1000), value: double (float)
        exports['ps-buffs']:StaminaBuffEffect(time, value)
      
        -- Example -- Adds a stamina buff for 15 seconds and a player runs 1.4 faster.
        exports['ps-buffs']:StaminaBuffEffect(15000, 1.4)
    • Swimming Buff - Makes a player swim faster and generate a random partial amount of stamina
      -- Function signature - time: int (1 second = 1000), value: double (float)
      exports['ps-buffs']:SwimmingBuffEffect(time, value)
      
      -- Example -- Adds a swimming buff for 20 seconds and a player swims 1.4 faster.
      exports['ps-buffs']:SwimmingBuffEffect(20000, 1.4)
    • Health Buff - Makes a player's health partially regenerate periodically
      -- Function signature - time: int (1 second = 1000), value: int
      exports['ps-buffs']:AddHealthBuff(time, value)
      
      -- Example -- Adds a health buff for 10 seconds and a player periodically gains 10 health.
      exports['ps-buffs']:AddHealthBuff(10000, 10)
    • Armor Buff - Makes a player's armor partially regenerate periodically
      -- Function signature - time: int (1 second = 1000), value: int
      exports['ps-buffs']:AddArmorBuff(time, value)
      
      -- Example -- Adds a armor buff for 30 seconds and a player periodically gains 10 armor.
      exports['ps-buffs']:AddArmorBuff(30000, 10)
    • Stress Buff - Makes a player's stress partially decrease periodically
      -- Function signature - time: int (1 second = 1000), value: int
      exports['ps-buffs']:AddStressBuff(time, value)
      
      -- Example -- Removes stress for 30 seconds and removes 10 units every 5 seconds
      exports['ps-buffs']:AddStressBuff(30000, 10)

Credits

  • The majority of the lua code comes from qb-enhancements by IdrisDose
  • Credits to my boys Silent, Snipe and fjamzoo for help with getting things in place for this to all be possible

ps-buffs's People

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

ps-buffs's Issues

SwimmingBuffEffect not working?

When I use the SwimmingBuffEffect(time, value) it doesn't work same for this StrengthBuffEffect that I added.

The "enhancements" are working fine like the armor, the stress but the buffs are not working.

local hasStrengthBuffActive = false
local function StrengthBuffEffect(time, value)
    AddBuff("strength", time)
    print(time, hasStrengthBuffActive) -- not printing
    if not hasStrengthBuffActive then 
        hasStrengthBuffActive = true
        CreateThread(function()
            SetPedMaxHealth(PlayerPedId(), 200)
            while exports['ps-buffs']:HasBuff("strength") do
                Wait(500)
                SetPedMaxHealth(PlayerPedId(), 800)
                print(GetPedMaxHealth(PlayerPedId()))
            end
            hasStrengthBuffActive = false
        end)
    end
end exports('StrengthBuffEffect', StrengthBuffEffect)

and the buff is in the "config"

        ['strength'] = {
            iconColor = "#ffffff",
            iconName = 'dumbbell',
            maxTime = 3600000,
            progressColor = "#FFD700",
            type = 'buff'
        },

Dependencies

Leave a note at the top of the read me to tell people they must have ps-hud to use this script. Also add the link to ps-hud next to it.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.