Configurables
Config
Config = {}
-- OXTarget = 'ox_target'
-- QBTarget = 'qb-target'
Config.pedmodel = 's_m_y_cop_01'
Config.locales = {
start_exam_text = 'Do you want to start the weapon license exam?',
exam_started_text = 'The weapon license exam has started. Follow the instructions provided.',
good_day_text = 'Okay, have a good day!',
insufficient_funds_text = 'Sorry, you do not have enough money to take the exam.',
yes_button = 'Yes',
no_button = 'No',
continue_button = 'Continue',
close_button = 'Close',
end_button = 'End conversation',
job_title = 'Weapon License Examiner',
officer_name = 'Officer',
blip_title = 'Weapon license',
cheater = 'Nt filthy cheater (; Greetings from samurai',
recived_weapon_license = 'You have received a weapon license!',
}
Config.framework = "esx" -- or "qbcore" -- if using qbox then still leave at qbcore (;
Config.requiredMoney = 500
Config.moneytype = 'money' -- money type
Config.distance = 10 -- the cheater distance check if a player isnt in this distance and executes a event he gets kicked (;
Config.blip = true
Config.blipsprite = 110
Config.blipcolour = 1
Config.locations = {
vector4(14.4966, -1106.5750, 28.7970, 332.7171),
}
[
{
"question": "What is the primary purpose of a gun safety mechanism?",
"image": "https://i.ibb.co/CHmdW8s/image.png",
"answers": [
{
"text": "To make the gun look more aesthetic."
},
{
"text": "To increase the gun's weight for better handling."
},
{
"text": "To improve the gun's firing speed."
},
{
"text": "To prevent accidental discharge, ensuring the gun only fires when intended.",
"correct": true
}
]
},
{
"question": "How should you store your weapon when not in use?",
"image": "https://i.ibb.co/CHmdW8s/image.png",
"answers": [
{
"text": "In a backpack or bag."
},
{
"text": "On a shelf in the garage."
},
{
"text": "In a locked safe with ammunition stored separately.",
"correct": true
},
{
"text": "In a drawer or cabinet with other household items."
}
]
},
{
"question": "What should you do if you notice a malfunction while handling your weapon?",
"image": "https://i.ibb.co/CHmdW8s/image.png",
"answers": [
{
"text": "Attempt to fix the malfunction yourself without proper knowledge."
},
{
"text": "Ignore the issue and store the weapon as usual."
},
{
"text": "Continue using the weapon despite the malfunction."
},
{
"text": "Safely unload the weapon and seek professional assistance.",
"correct": true
}
]
},
{
"question": "What is the importance of knowing your target and what is beyond it?",
"image": "https://i.ibb.co/CHmdW8s/image.png",
"answers": [
{
"text": "To ensure you do not accidentally harm unintended targets or bystanders.",
"correct": true
},
{
"text": "To increase the range of your weapon."
},
{
"text": "To make the shooting experience more enjoyable."
},
{
"text": "To improve your shooting accuracy."
}
]
},
{
"question": "What type of ammunition should be used for self-defense?",
"image": "https://i.ibb.co/CHmdW8s/image.png",
"answers": [
{
"text": "High-caliber ammunition meant for hunting."
},
{
"text": "Standard target practice ammunition."
},
{
"text": "Any available ammunition without considering its purpose."
},
{
"text": "Ammunition specifically designed for self-defense, such as hollow-point rounds.",
"correct": true
}
]
},
{
"question": "What is the best way to practice safe firearm handling?",
"image": "https://i.ibb.co/CHmdW8s/image.png",
"answers": [
{
"text": "Always point the firearm in a safe direction.",
"correct": true
},
{
"text": "Practice only with live ammunition."
},
{
"text": "Handle the firearm only when needed."
},
{
"text": "Share your firearm handling practices with others."
}
]
},
{
"question": "How often should you clean your firearm?",
"image": "https://i.ibb.co/CHmdW8s/image.png",
"answers": [
{
"text": "Only when it looks dirty."
},
{
"text": "Once a month."
},
{
"text": "After each use, especially if it has been exposed to moisture.",
"correct": true
},
{
"text": "Every few months."
}
]
},
{
"question": "What is the role of a trigger lock?",
"image": "https://i.ibb.co/CHmdW8s/image.png",
"answers": [
{
"text": "To enhance the gun's accuracy."
},
{
"text": "To prevent unauthorized use by locking the trigger mechanism.",
"correct": true
},
{
"text": "To make the firearm heavier for better control."
},
{
"text": "To improve the firearm's firing speed."
}
]
},
{
"question": "What should you do if you find a firearm while cleaning your home?",
"image": "https://i.ibb.co/CHmdW8s/image.png",
"answers": [
{
"text": "Immediately use it for self-defense."
},
{
"text": "Inform the authorities and secure the firearm safely.",
"correct": true
},
{
"text": "Dispose of the firearm."
},
{
"text": "Hide the firearm and forget about it."
}
]
},
{
"question": "What is a firearm's 'muzzle'?",
"image": "https://i.ibb.co/CHmdW8s/image.png",
"answers": [
{
"text": "The part of the firearm that houses the ammunition."
},
{
"text": "The part of the firearm where the bullet exits.",
"correct": true
},
{
"text": "The handle or grip of the firearm."
},
{
"text": "The safety mechanism."
}
]
},
{
"question": "What should you check before firing a firearm?",
"image": "https://i.ibb.co/CHmdW8s/image.png",
"answers": [
{
"text": "Ensure the firearm is properly cleaned."
},
{
"text": "Ensure there are no obstructions in the barrel.",
"correct": true
},
{
"text": "Check the weight of the firearm."
},
{
"text": "Ensure the firearm is aesthetically pleasing."
}
]
},
{
"question": "What is the correct procedure if you accidentally discharge your firearm?",
"image": "https://i.ibb.co/CHmdW8s/image.png",
"answers": [
{
"text": "Ensure the area is clear of people and seek immediate help if needed.",
"correct": true
},
{
"text": "Hide the evidence and ignore the incident."
},
{
"text": "Apologize to anyone nearby and continue using the firearm."
},
{
"text": "Continue firing to compensate for the accidental discharge."
}
]
}
]
Opensource
RegisterNetEvent('smr:success', function()
local src = source
local playerPed = GetPlayerPed(src)
local playerCoords = GetEntityCoords(playerPed)
if not isPlayerNearAnyLocation(playerCoords) then
DropPlayer(src, Config.locales.cheater) -- Kick the player
return
end
if Config.framework == "qbcore" then
QBCore = exports['qb-core']:GetCoreObject()
local targetPlayer = QBCore.Functions.GetPlayer(src)
if targetPlayer then
local licences = targetPlayer.PlayerData.metadata["licences"]
if licences["weapon"] == false then
licences["weapon"] = true
targetPlayer.Functions.SetMetaData("licences", licences)
TriggerClientEvent('QBCore:Notify', src, Config.locales.recived_weapon_license, 'success')
end
else
TriggerClientEvent('QBCore:Notify', src, "Player not found", 'error')
end
elseif Config.framework == "esx" then
ESX = exports["es_extended"]:getSharedObject()
local xPlayer = ESX.GetPlayerFromId(src)
local identifier = xPlayer.identifier
local licenseType = 'weapon'
MySQL.query('SELECT * FROM user_licenses WHERE owner = ? AND type = ?', {identifier, licenseType}, function(result)
if result[1] then
print('Player already has a weapon license.')
else
MySQL.update('INSERT INTO user_licenses (owner, type) VALUES (?, ?)', {identifier, licenseType}, function(affectedRows)
if affectedRows > 0 then
TriggerClientEvent('esx:showNotification', src, Config.locales.recived_weapon_license)
else
print('Failed to give weapon license.')
end
end)
end
end)
end
end)
RegisterNetEvent('smr:startit', function()
local src = source
local playerPed = GetPlayerPed(src)
local playerCoords = GetEntityCoords(playerPed)
if not isPlayerNearAnyLocation(playerCoords) then
DropPlayer(src, Config.locales.cheater)
return
end
local requiredMoney = Config.requiredMoney
local moneyType = Config.moneytype
if Config.framework == "esx" then
ESX = exports["es_extended"]:getSharedObject()
local xPlayer = ESX.GetPlayerFromId(src)
local money = 0
if moneyType == 'money' then
money = xPlayer.getMoney()
elseif moneyType == 'bank' then
money = xPlayer.getAccount('bank').money
elseif moneyType == 'black_money' then
money = xPlayer.getAccount('black_money').money
end
if money >= requiredMoney then
xPlayer.removeAccountMoney(moneyType, requiredMoney)
TriggerClientEvent('smr:moneyRemoved', src, true)
else
TriggerClientEvent('smr:moneyRemoved', src, false)
end
elseif Config.framework == "qbcore" then
QBCore = exports['qb-core']:GetCoreObject()
local Player = QBCore.Functions.GetPlayer(src)
local money = 0
if moneyType == 'cash' then
money = Player.PlayerData.money['cash']
elseif moneyType == 'bank' then
money = Player.PlayerData.money['bank']
elseif moneyType == 'crypto' then
money = Player.PlayerData.money['crypto']
end
if money >= requiredMoney then
Player.Functions.RemoveMoney(moneyType, requiredMoney)
TriggerClientEvent('smr:moneyRemoved', src, true)
else
TriggerClientEvent('smr:moneyRemoved', src, false)
end
end
end)
Last updated