Coder Social home page Coder Social logo

rz-gym's Introduction

image

rz-gym

  • Buff And Skill System GYM [QBCORE]
  • New QBCore

Video Showcase

Discord

Update

  • Fixed some known bugs and updated the setup lines

Features

  • If you eat redbull and chocolate and do sports, you will gain more stamina and strength. (2x)
  • If you drive your vehicle at the speed you set, your driving ability will skill
  • If you front-lift on the motorcycle, your Wheelie ability will skill
  • You need to rest after exercising
  • Sports area and shops can be duplicate
  • You can see the progress of your character with the help of the UI
  • Easy configurable Config (everything is adjustable)
  • Script using full qb-target

Dependencies

Installation

Items

  • Add the following code to your qb-core/shared/ıtems.lua
    redbull                     = { name = 'redbull', label = 'Redbull', weight = 100, type = 'item', image = 'redbull.png', unique = false, useable = true, shouldClose = true, combinable = nil, description = 'Redbull' },
    chocolate                     = { name = 'chocolate', label = 'Chocolate', weight = 100, type = 'item', image = 'chocolate.png', unique = false, useable = true, shouldClose = true, combinable = nil, description = 'Chocolate' },

Consumables.Eat

  • Add the following code to your qb-smallresources/config/Config.Consumables.eat
["chocolate"] = math.random(10, 15),

Consumables.Drink

  • Add the following code to your qb-smallresources/config/Config.Consumables.drink
["redbull"] = math.random(10, 15),

Buffs Setup (Eat)

  • Find the consumables:client:Eat line and do as follows
RegisterNetEvent('consumables:client:Eat', function(itemName)
    QBCore.Functions.Progressbar('eat_something', Lang:t('consumables.eat_progress'), 5000, false, true, {
        disableMovement = false,
        disableCarMovement = false,
        disableMouse = false,
        disableCombat = true
    }, {
        animDict = 'mp_player_inteat@burger',
        anim = 'mp_player_int_eat_burger',
        flags = 49
    }, {
        model = 'prop_cs_burger_01',
        bone = 60309,
        coords = vec3(0.0, 0.0, -0.02),
        rotation = vec3(30, 0.0, 0.0),
    }, {}, function() -- Done

        if itemName == "chocolate" then
            exports['ps-buffs']:AddBuff("gym-stamina", 300000)
        end
        
        TriggerEvent('inventory:client:ItemBox', QBCore.Shared.Items[itemName], 'remove')
        TriggerServerEvent('consumables:server:addHunger', QBCore.Functions.GetPlayerData().metadata.hunger + Config.Consumables.eat[itemName])
        TriggerServerEvent('hud:server:RelieveStress', math.random(2, 4))
    end)
end)

Buffs Setup (Drink)

  • Find the consumables:client:Drink line and do as follows
RegisterNetEvent('consumables:client:Drink', function(itemName)
    QBCore.Functions.Progressbar('drink_something', Lang:t('consumables.drink_progress'), 5000, false, true, {
        disableMovement = false,
        disableCarMovement = false,
        disableMouse = false,
        disableCombat = true
    }, {
        animDict = 'mp_player_intdrink',
        anim = 'loop_bottle',
        flags = 49
    }, {
        model = 'vw_prop_casino_water_bottle_01a',
        bone = 60309,
        coords = vec3(0.0, 0.0, -0.05),
        rotation = vec3(0.0, 0.0, -40),
    }, {}, function() -- Done
        
        if itemName == "redbull" then
            exports['ps-buffs']:AddBuff("gym-strength", 300000)
        end

        TriggerEvent('inventory:client:ItemBox', QBCore.Shared.Items[itemName], 'remove')
        TriggerServerEvent('consumables:server:addThirst', QBCore.Functions.GetPlayerData().metadata.thirst + Config.Consumables.drink[itemName])
    end)
end)

Items

  • Add the following code to your ps-buffs/shared/config/Config.Buffs
    ['gym-stamina'] = {
        iconColor = "#ffffff",
        iconName = 'wind',
        maxTime = 300000,
        progressColor = "#FFD700",
        type = 'buff'
    },

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

Skill System Setup

  • Find the qb-core/server/player and open, find the function QBCore.Player.CheckPlayerData(source, PlayerData) line and do as follows
    PlayerData.metadata["skill"]  = PlayerData.metadata["skill"]  ~= nil and PlayerData.metadata["skill"] or {
		["Stamina"] = {["Current"] = 10.0, ["Stat"] = "MP0_STAMINA", ["RemoveAmount"] = 0}, 
		["Strength"] = {["Current"] = 5.0, ["Stat"] = "MP0_STRENGTH", ["RemoveAmount"] = 0 },
        ["Lung Capacity"] = {["Current"] = 5.0, ["Stat"] = "MP0_LUNG_CAPACITY", ["RemoveAmount"] = 0 },
        ["Driving"] = {["Current"] = 0.0, ["Stat"] = "MP0_DRIVING_ABILITY", ["RemoveAmount"] = 0 },
        ["Wheelie"] = {["Current"] = 0.0, ["Stat"] = "MP0_WHEELIE_ABILITY", ["RemoveAmount"] = 0 }
	}

Item Images

  • Download the script and open images folder, put it in the qb-inventory or lj-inventory/html/images directory.

Script

  • Download the script and put it in the [qb] directory.
  • Add the following code to your server.cfg/resouces.cfg
ensure rz-gym
ensure gamz-skillsystem
ensure ps-buffs

Image Showcase

image image image image image image image image

rz-gym's People

Contributors

chefrz avatar

Stargazers

Yao avatar snajdan avatar RivickyS avatar  avatar Mundstock avatar  avatar 0zul avatar Xennare avatar Ollz avatar Chiantine P. Manigos avatar Roman Hossain Shaon avatar  avatar  avatar  avatar Yevhenii Lukashov avatar rpRIGGS avatar mockdot avatar Pratco avatar Second Thought  avatar  avatar  avatar  avatar Yamada Taro avatar Nik avatar Coby.Hツ avatar

Watchers

 avatar

rz-gym's Issues

No such export AddBuff in resource ps-buffs

[ 133578] [b2802_GTAProce] MainThrd/ SCRIPT ERROR: @qb-smallresources/client/consumables.lua:190: No such export AddBuff in resource ps-buffs
[ 133578] [b2802_GTAProce] MainThrd/ > ref (@qb-core/client/functions.lua:135)
[ 133578] [b2802_GTAProce] MainThrd/ > fn (@progressbar/client/main.lua:124)
[ 133578] [b2802_GTAProce] MainThrd/ SCRIPT ERROR: citizen:/scripting/lua/scheduler.lua:479: attempt to concatenate a nil value (local 'err')
[ 133578] [b2802_GTAProce] MainThrd/ > fn (@progressbar/client/main.lua:124)
[ 133578] [b2802_GTAProce] MainThrd/ SCRIPT ERROR: error object is not a string

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.