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)-- endif Config.Framework.FrameworkName =='esx' then ESX.ShowNotification(text)else QBCore.Functions.Notify(text)endend
if Config.Framework.FrameworkName =='esx' then ESX.RegisterCommand('givelicense', 'admin', function(xPlayer,args,showError)ifnot args.player thenreturnendlocal hasLicense =CheckIfHasLicense(args.player.identifier, args.type)if hasLicense and args.type =='driving' thenAddLicense(args.player.identifier, args.type, args.vehicletype)elseifnot hasLicense thenAddLicense(args.player.identifier, args.type, args.vehicletype)elseTriggerClientEvent('buty-licenses:notify', xPlayer.source, Config.Translation.AlreadyHaveLicense)endendend, 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)ifnot args.player thenreturnendRemoveLicense(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]ifnot playerId ornot licenseType ornot vehicleType thenreturnendlocal qbPlayer = QBCore.Functions.GetPlayer(playerId)local hasLicense =CheckIfHasLicense(qbPlayer.PlayerData.citizenid, licenseType)if hasLicense and licenseType =='driving' thenAddLicense(qbPlayer.PlayerData.citizenid, licenseType, vehicleType)elseifnot hasLicense thenAddLicense(qbPlayer.PlayerData.citizenid, licenseType, vehicleType)elseTriggerClientEvent('buty-licenses:notify', source, Config.Translation.AlreadyHaveLicense)endendend, '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]ifnot playerId ornot licenseType thenreturnendlocal 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.