The first step is to download the product we have just purchased. To do this we will go to our KEYMASTER account and search for "Buty-License".
2. DEPENDENCIES AND INSTALLATION
This script does not need any dependencies or progress bar.
Just place the script under your CORE and your core scripts:
ensure Buty-license
So that there is no mess or overlap, you will have to delete any other license script you have. Same with database tables.
And when you have everything clean without another license script, you will have to install the Buty-license SQL.
3. CONFIG
The following will explain all the settings, one of the most important things that I recommend you spend a few minutes to understand in order to offer your users the best possible experien
Config = { }
Config.Framework = { -- All the information of your framework
FrameworkName = 'esx', -- esx or qb
FileName = 'es_extended',
SQLWrapper = 'oxmysql' -- oxmysql / mysql-async / ghmattimysql
}
UseAnimation = {true, "paper_1_rcm_alt1-9", "player_one_dual-9"} -- Change the animation that the character does to show a license
DrawMarker = {type = 1,color = {106, 3, 247}} -- Change the marker that appears on the head of the player you want to show a license to
Config.Open = {
Key = {
Active = true,
Key = 56,
},
Command = {
Active = true,
Name = 'licenses'
}
}
Config.CustomLicenses = { -- Here you can create all the licenses you want. Like a hunting license...
{
Type = 'test', -- This is the type of license that you will later add in the export. It's the name too.
Style = { -- The design of the license that will appear on the screen.
Border = 'red',
Color = 'red'
}
}
}
Config.UI = { -- Translate interface
YourLicenses = 'Your Licenses',
SeeLicense = 'See',
ShowLicense = 'Show'
}
Config.Translation = { -- More translations
drivinglicense = 'Driving',
identitylicense = 'Identity',
weaponlicense = 'Weapon',
AlreadyHaveLicense = 'You / the player already have this license',
NoOneAround = 'There is no one around to show',
StopShow = 'To stop showing press BACKSPACE'
ShowLicense = 'Press ~d~ENTER~s~ to show the license',
StopShowing = 'Press ~d~BACKSPACE~s~ to stop showing',
}
```
This SCRIPT does not need many open functions since everything is already self-configured.
It is recommended that many of the modifications to the OPENFUNCTION files be made by a programmer with LUA and FiveM ideas.
-- This is for you to add the export of your notification system.
Notify = function(type, text, time)
-- time = 10000
-- if type == 'success' then
-- exports["Venice-Notification"]:Notify(text, time, "check", options)
-- elseif type == 'error' then
-- exports["Venice-Notification"]:Notify(text, time, "error", options)
-- elseif type == 'info' then
-- exports["Venice-Notification"]:Notify(text, time, "info", options)
-- end
if Config.Framework.FrameworkName == 'esx' then
ESX.ShowNotification(text)
else
QBCore.Functions.Notify(text)
end
end
if Config.Framework.FrameworkName == 'esx' then
ESX.RegisterCommand('givelicense', 'admin', function(xPlayer, args, showError)
if not args.player then return end
local hasLicense = CheckIfHasLicense(args.player.identifier, args.type)
if hasLicense and args.type == 'driving' then
AddLicense(args.player.identifier, args.type, args.vehicletype)
else
if not hasLicense then
AddLicense(args.player.identifier, args.type, args.vehicletype)
else
TriggerClientEvent('buty-licenses:notify', xPlayer.source, Config.Translation.AlreadyHaveLicense)
end
end
end, false, {help = 'Give license to player', validate = true, arguments = {
{ name = 'player', help = 'Player ID', type = 'player' },
{ name = 'type', help = 'License Type (driving, weapon, etc...)', type = 'string' },
{ name = 'vehicletype', help = 'Vehicle Type (none, car, truck, motorcycle, boat, plane, helicopter)', type = 'string' }
}})
ESX.RegisterCommand('removelicense', 'admin', function(xPlayer, args, showError)
if not args.player then return end
RemoveLicense(args.player.identifier, args.type)
end, false, {help = 'Remove license from player', validate = true, arguments = {
{ name = 'player', help = 'Player ID', type = 'player' },
{ name = 'type', help = 'License Type (driving, weapon, etc...)', type = 'string' }
}})
else
QBCore.Commands.Add('givelicense', 'Give license to player', {
{ name = 'player', help = 'Player ID' },
{ name = 'type', help = 'License Type (driving, weapon, etc...)' },
{ name = 'vehicletype', help = 'Vehicle Type (none, car, truck, motorcycle, boat, plane, helicopter)' }
}, false, function(source, args)
local playerId = args[1]
local licenseType = args[2]
local vehicleType = args[3]
if not playerId or not licenseType or not vehicleType then return end
local qbPlayer = QBCore.Functions.GetPlayer(playerId)
local hasLicense = CheckIfHasLicense(qbPlayer.PlayerData.citizenid, licenseType)
if hasLicense and licenseType == 'driving' then
AddLicense(qbPlayer.PlayerData.citizenid, licenseType, vehicleType)
else
if not hasLicense then
AddLicense(qbPlayer.PlayerData.citizenid, licenseType, vehicleType)
else
TriggerClientEvent('buty-licenses:notify', source, Config.Translation.AlreadyHaveLicense)
end
end
end, 'admin')
QBCore.Commands.Add('removelicense', 'Remove license from player', {
{ name = 'player', help = 'Player ID' },
{ name = 'type', help = 'License Type (driving, weapon, etc...)' }
}, false, function(source, args)
local playerId = args[1]
local licenseType = args[2]
if not playerId or not licenseType then return end
local qbPlayer = QBCore.Functions.GetPlayer(playerId)
RemoveLicense(qbPlayer.PlayerData.citizenid, licenseType)
end, 'admin')
end
If you want to edit the aesthetics or design. You have the HTML open so you can modify the style and everything as you want.
The script is RESPONSIVE for all resolutions as well.