🎯 [PAID] [QBCORE] Target Practice

A script by Re1ease1

No reviews yet.
🎯 [PAID] [QBCORE] Target Practice main image

Full Description

targetpractice_forum

Description

This script provides a competitive firing range that allows players to select between four different difficulties while practicing or competing against each other.

The score from the range is automatically calculated and saved to your database after each and every round, giving the players an opportunity to compete on the leaderboards.

How does it work?

When a round has started, a prop is spawned on a randomized coordinate from the list of coordinates in your config. The player’s task is to aim and shoot at this prop to score a hit. The total score is calculated by taking the player’s accuracy divided by the number of hits on the targets.

Based on the selected difficulty, the prop despawns within a certain timeframe.
Long story short, if the difficulty is set to “hard”, the prop despawns quicker, creating a tough environment for the toughest players.


Features

  • Game Mechanics
    – A prop automatically spawns when starting a round.
    – The prop automatically despawns after X amount of time depending on the selected difficulty.
    – The prop despawns if the player hits the target, which adds to the score of the player.
    – Only one round can be active at any point.
    – The props are displayed for everyone standing close by.

  • Frontend
    – is-statushud is used to display information about the ongoing round and is only shown to the client that started the round.
    – The player is able to change the difficulty for each round through a menu.
    – The player is able to view a leaderboard of each difficulty through a menu.
    – You (developer) have the ability to set the coordinates of the props through the config file.

  • Backend
    – Data from the player is saved into the database after each round.
    – Data from the database is pulled when creating the leaderboard.
    – Data does not create multiple insertions but overwrites when the score exceeds the player’s previous score.
    – *Coordinates are saved into a .txt file located within the resource when using a specific command.

*A command is provided to assist in the creation of coordinates for the props of the config. The command creates an X amount of props with random locations based on the player coordinates. The coordinates are then automatically saved to a .txt file for quick access.
  • Other
    – Per default, the menu is accessible through a command (/targetmenu). You can, however, comment out the command and instead use a provided event to trigger the menu, if you’d like to use your own ped or something similar.

Config Showcase

Show/Hide (shared/config.lua)
local QBCore = exports['qb-core']:GetCoreObject()
R1 = {}
R1.Target = {}
R1.Target.Create = {}

--===================================================================================================--
--===================================================================================================--

-- 	Accuracy Calculation: (hits/shots)*100
--	   Score Calculation: (hits*accuracy)/10

--===================================================================================================--
--===================================================================================================--

-- 	What is the name of the prop that we should spawn?
R1.Target.Object = "prop_target_ora_purp_01"	

-- 	How long one round should last, in seconds. 
R1.Target.GameTime = 15	

-- 	How long a prop should appear, in seconds, before they are removed and then re-added during a game. 
-- 	You can change the names and the numbers. You cannot add or remove groups.
R1.Target.Difficulty = { 	
	["Easy"] 		= 2.0,
	["Mediocre"] 	= 1.0,
	["Hard"]		= 0.7,
	["Aimbot"]		= 0.3,
}

--===================================================================================================--
--===================================================================================================--

-- 	Which user group should be able to use the command to create random coordinates?
--	The randomized coordinates are saved in a text file in the resource file for quick access.
-- 	Command: /createtargets [amount]
R1.Target.Create.CommandAuth = "admin" 

--	The offsets randomizes a number between set values to then create a random set of coordinates based on your ped coordinates.
--	The Z axis is randomized within a value of 1 (e.g. 0.1-1).
R1.Target.Create.PositionOffset = {x = 5, y = 5}

--  Static offset for height.
R1.Target.Create.PositionZOffset = 1

--	Where should the prop spawn during a game? These coordinates are randomized during a game.
R1.Target.Positions = {	
	vector4(-856.5874, -1267.312, 5.601651, 226.5529),
	vector4(-845.9772, -1267.244, 5.258786, 226.5529),
	vector4(-851.7142, -1261.172, 5.582089, 226.5529),
	vector4(-849.4623, -1264.933, 5.033139, 226.5529),
	vector4(-856.5007, -1262.501, 5.625515, 226.5529),
	vector4(-851.7576, -1259.666, 5.549222, 226.5529),
	vector4(-856.1859, -1263.494, 5.136746, 226.5529),
	vector4(-847.8832, -1259.66, 5.263363, 226.5529),
	vector4(-850.2307, -1260.643, 5.848355, 226.5529),
	vector4(-848.7767, -1264.811, 5.303769, 226.5529),
	vector4(-855.4943, -1265.564, 5.194851, 226.5529),
	vector4(-846.277, -1268.799, 5.650479, 226.5529),
	vector4(-845.9697, -1258.881, 5.82211, 226.5529),
	vector4(-846.746, -1260.932, 5.559689, 226.5529),
	vector4(-847.1125, -1266.426, 5.074795, 226.5529),
	vector4(-853.1111, -1258.78, 5.325802, 226.5529),
	vector4(-851.2924, -1259.554, 5.806424, 226.5529),
	vector4(-848.6081, -1263.113, 5.975094, 226.5529),
	vector4(-850.3981, -1260.838, 5.355282, 226.5529),
	vector4(-848.0074, -1263.181, 5.98489, 226.5529),
	vector4(-847.129, -1262.946, 5.030179, 226.5529),
	vector4(-855.6033, -1261.87, 5.621762, 226.5529),
	vector4(-854.0032, -1263.958, 5.949673, 226.5529),
	vector4(-852.7476, -1265.761, 5.992733, 226.5529),
	vector4(-847.6128, -1260.922, 5.578488, 226.5529),
	vector4(-849.2111, -1261.62, 5.403042, 226.5529),
	vector4(-847.1601, -1268.917, 5.805142, 226.5529),
	vector4(-852.1506, -1260.368, 5.114377, 226.5529),
	vector4(-853.8026, -1260.424, 5.904141, 226.5529),
	vector4(-848.9664, -1261.03, 5.097073, 226.5529),
	vector4(-852.8413, -1266.256, 5.226834, 226.5529),
	vector4(-852.8279, -1262.73, 5.870419, 226.5529),
	vector4(-846.2808, -1266.858, 5.964474, 226.5529),
	vector4(-856.1515, -1260.239, 5.024472, 226.5529),
	vector4(-846.7944, -1263.241, 5.827206, 226.5529),
	vector4(-846.8112, -1260.112, 5.5173, 226.5529),
	vector4(-851.6252, -1266.339, 5.983059, 226.5529),
	vector4(-850.3616, -1264.956, 5.341458, 226.5529),
	vector4(-853.4525, -1265.06, 5.100186, 226.5529),
	vector4(-851.0571, -1265.848, 5.653042, 226.5529),
	vector4(-845.7578, -1262.829, 5.836514, 226.5529),
	vector4(-855.9467, -1268.435, 5.957821, 226.5529),
	vector4(-849.7192, -1259.885, 5.620358, 226.5529),
	vector4(-852.8259, -1264.758, 5.447445, 226.5529),
	vector4(-849.1667, -1265.134, 5.065945, 226.5529),
	vector4(-850.3281, -1268.318, 5.079861, 226.5529),
	vector4(-850.629, -1263.815, 5.867215, 226.5529),
	vector4(-855.9353, -1264.426, 5.497708, 226.5529),
	vector4(-853.0038, -1265.786, 5.514035, 226.5529),
	vector4(-855.1898, -1264.361, 5.378293, 226.5529),
}

--===================================================================================================--
--===================================================================================================--

function R1.Target.Notification(text, style, time)
	QBCore.Functions.Notify(text, style, time)
end

Video Showcase

Gameplay
Creating Objects


Requirements

Script/Framework Required
QBCore [Framework] Yes
is-statushud [Script] Yes
At this point in time, only “QBCore” is supported as a framework.

Code is accessible No*
Subscription-based No
Lines (approximately) 570+
Requirements View “Requirements”
Support Yes
*The config file is open for customization.

Purchase [TEBEX]

Click here to purchase!

Would you like to test the script before buying?
Select the trial to test the script free for 1 day.