Coder Social home page Coder Social logo

don-shootingrange's Introduction

don-shootingrange

Don's Shooting Range for Weapons Training on QBCore! This is a paid script, available on my Tebex.

Dependencies

Features

  • Optimised code, resmon of 0.0ms in rest, 0.2ms peak whilst displaying each target, 0.6ms if using DrawText instead of QB Target.
  • Fully Configurable Shooting Range Script
  • Add as many Locations as you want, meaning you could use Gabz Ammunation or any suitable MLO.
  • Add as many Tests and whether they are Practice tests or License tests
  • Change Their Target Limits, Target Display Times and Required Weapon
  • Change the License to anything you want that makes sense, i.e. Weapons and Hunting
  • Set up your own Custom Games through the Menu, choosing the Weapon, Target Limit, and Target Display Time
  • Players need to fill out a Waiver form before they can use the range
  • Set the Accuracy Required to pass a License Test
  • When a Player passes the shooting part of a License Test, they must complete a Questionnaire to actually get a License
  • Leaderboards; Top 10 Best Scores (per person) for each Test, Time Leaderboards (Top 10 Daily, Top 10 Weekly, Top 10 Monthly and Top 10 All Time) and the Players best Scores for each test
  • The Leaderboards are updated in real time, so if you get a new best score, it will show up on the Leaderboards instantly
  • The Timed Leaderboards are only for Practice Tests and License Tests, not Custom Games
  • Players can use the Range as many Times as they want, but they can only pass a License Test once
  • Config Option to log Granted Licenses to Discord
  • Code is Escrowed but the questionare.lua, menu.lua and config.lua is not so you can edit Freely!

Preview

Important Config

Config.UseTarget = true -- Use qb-target interactions // Set to false if you are using DrawText3Ds
Config.ShowBlips = true -- Set to true if you want to show blips on the map
Config.UniqueNames = false -- Set to true if you want to use unique names for each blip
Config.BlipName = "Shooting Range" -- Set to the name you want to use for the blips if not using unique names
Config.RequiresWaiver = true -- Set to true if you want to require a waiver to use the range
Config.ScoreLimit = 0 -- Based on the amount of targets // Set to 0 if you want to disable the score limit // Set to 1 if you want to require a perfect hit percentage

Config.ShootingRange = {
    Easy = {
        testName = 'Easy', -- Name of the test in the menu
        icon = 'fas fa-bullseye', -- Fontawesome icon used in the menu // https://fontawesome.com/v5.15/icons?d=gallery&p=2
        weapon = 'WEAPON_COMBATPISTOL', -- Weapons List: https://wiki.rage.mp/index.php?title=Weapons
        displayTime = 500, -- Amount of time in milliseconds the player has to hit the target
        targetLimit = 10, -- Amount of targets to shoot
        practice = true, -- Set to true if the test does not count towards the license
    },
    License = {
        testName = 'Weapon\'s License',
        icon = 'fas fa-bullseye',
        weapon = 'WEAPON_COMBATPISTOL',
        displayTime = 150,
        targetLimit = 20,
        practice = false,
        license = 'weapon', -- Set to the name of the license you want to give the player
    },
    -- Add as many as you want
}

Config.AllowedWeapons = { -- Allowed weapons for custom games // I'd stick to pistols otherwise the animations will look weird
    'WEAPON_COMBATPISTOL',
    'WEAPON_PISTOL',
    'WEAPON_PISTOL50',
    'WEAPON_SNSPISTOL',
    'WEAPON_HEAVYPISTOL',
    'WEAPON_VINTAGEPISTOL',
    'WEAPON_MARKSMANPISTOL',
    'WEAPON_REVOLVER',
}

Images

  • Add the images here to \bcs_questionare\html\images

QB Anti Cheat Fix

  • Open qb-anticheat\server\main.lua
  • Find the following code:
QBCore.Functions.CreateCallback('qb-anticheat:server:HasWeaponInInventory', function(source, cb, WeaponInfo)
    local src = source
    local Player = QBCore.Functions.GetPlayer(src)
    local PlayerInventory = Player.PlayerData.items
    local retval = false

    for k, v in pairs(PlayerInventory) do
        if v.name == WeaponInfo["name"] then
            retval = true
        end
    end
    cb(retval)
end)
  • Replace it with the following code:
QBCore.Functions.CreateCallback('qb-anticheat:server:HasWeaponInInventory', function(source, cb, WeaponInfo)
    local src = source
    local Player = QBCore.Functions.GetPlayer(src)
    local PlayerInventory = Player.PlayerData.items
    local retval = not Player.Functions.GetMetaData('inShootingRange') and false or true

    for k, v in pairs(PlayerInventory) do
        if v.name == WeaponInfo["name"] then
            retval = true
        end
    end
    cb(retval)
end)

Support

  • Join my discord and use the relative support channels.
  • Open a ticket and please have your Tebex Transation ID ready 🙂.

Changelog

  • v1.0.9 - More Bug Fixes, Added Safeguards for Score or Hit Percent being a nil Value
  • v1.0.8 - Added French Locale and Fixed Bugs from New Update
  • v1.0.7 - Added Config Option for Clothes IDs
  • v1.0.6 - Fixed Database Error for Score being a nil value
  • v1.0.5 - Linting
  • v1.0.4 - Added Locales for Notifications, DrawText and QB Target
  • v1.0.3 - Updated the Database check function
  • v1.0.2 - Added Config Option to log Granted Licenses to Discord
  • v1.0.1 - Unescrowed the Menu and added a Clothes Config option
  • v1.0.0 - Initial Release

don-shootingrange's People

Contributors

donhulieo avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar

don-shootingrange's Issues

Misleading GitHub Repository

The point of GitHub is that you upload your code free of charge and it's open source; what's the point of this? I see everyone praising it, yet you have to go to to your tebex.

I could understand advertising it on the FiveM forums but this seems pointless as hell.

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.