INSTALLATION
Read very well and follow all the steps below. If you find any error or have any doubt open a ticket.
Last updated
Read very well and follow all the steps below. If you find any error or have any doubt open a ticket.
Last updated
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-Trucker".
To install it add the resource to your scripts folder and put the following in your SERVER.CFG:
ensure Buty-Trucker
You will also need to install the SQL in your database before starting the script, in order to save the experience of each player.
To make it easier for you to configure, this script comes with several configuration files, each one for one thing. You can see it explained below:
Here you will only have to configure your framework, your database and some extra settings.
In UseKeys, UseFuel, UseDeleteVehicle you activate it in case you have filled some of the integrations in functions.
Config = {}
Config.framework = "esx" -- esx or qbcore
Config.ESX = 'es_extended'
Config.QB = 'qb-core'
Config.Mysql = "oxmysql" -- oxmysql, mysql-async or ghmattisql
Config.job = {
needjob = false,
jobname = 'trucker'
}
Config.BattlePass = {
Active = false,
xp = 1000
}
Config.Target = {UseTarget = false, TargetExport = 'qb-target', Coords = vector3(-780.44, -2636.88,13.8), Text = 'START JOB', Icon = 'fa fa-truck'}
Config.UseFuel = false--Set to true if you use a different system. You will have to add the export in config_functions.
Config.UseKeys = false--Set to true if you use a different system. You will have to add the export in config_functions.
Config.UseDeleteVehicle = false--Set to true if you use a different system. You will have to add the export in config_functions.
Config.NPCHOME = {{x = -780.44, y = -2636.88, z = 13.8, h = 146.76}}
Config.NPCS = {
['home'] = {
model = 'cs_floyd', --npc model (https://docs.fivem.net/docs/game-references/ped-models/)
anim = 'WORLD_HUMAN_CLIPBOARD' --npc animation (https://wiki.rage.mp/index.php?title=Scenarios)
}
}
Config.Truck = {
[1] = "phantom",
[2] = "hauler2",
[3] = "packer",
[4] = "phantom3",
}
Config.Transport = {
['legal'] = {
createtruck = vector3(-744.36, -2544.12, 14.04),
gocoords = vector3(-773.36, -2637.16, 13.4),
gocoordsnpc = vector3(-773.88, -2612.32, 13.92),
createTrailers = vector3(-794.52, -2673.24, 13.8),
trailer = 'trailers2',
key1 = 38,
key2 = 47
},
['ilegal'] = {
createtruck = vector3(-744.36, -2544.12, 14.04),
gocoords = vector3(-773.36, -2637.16, 13.4),
gocoordsnpc = vector3(-773.88, -2612.32, 13.92),
Probabilityenemies = 10,
Probabilitycallpolice = 10,
enemiesvehicle = 'sanchez',
enemiesweapon = 'WEAPON_PISTOL',
trailer = 'trailers2',
typemoney = 'crypto' -- only use QB
}
}
Config.RoboCargamento = {
['Peds'] = {
[1]={x = 1678.12, y = -2033.08, z = 99.8,h = 130.4, ped},
[2]={x = 1679.36, y = -2021.88, z = 101.04, h = 130.4, ped},
[3]={x = 1684.36, y = -2015.92, z = 101.84, h = 130.4, ped},
}
}
Config.locationstrailerlegal = {
[1] = {x = 1146.68, y = -3281.16, z = 5.92},
[2] = {x = 1146.68, y = -3281.16, z = 5.92},
[3] = {x = 844.6, y = -2350.92, z = 30.32, h = 284.88},
[4] = {x = 1723.28, y = -1576.48, z = 112.56, h = 295.48},
[5] = {x = 2588.24, y = 414.24, z = 108.44, h = 178.32},
[6] = {x = 2536.08, y = 2584.4, z = 37.96, h = 358.52},
[7] = {x = 2671.32, y = 3529.92, z = 52.28, h = 65.6},
[8] = {x = -270.12, y = 6035.44, z = 31.68, h = 49.8},
[9] = {x = -1171.44, y = -2200.92, z = 13.2, h = 295.28}
}
Config.locationstrailerilegal = {
[1] = {x = 1146.68, y = -3281.16, z = 5.92},
[2] = {x = 1146.68, y = -3281.16, z = 5.92},
[3] = {x = 844.6, y = -2350.92, z = 30.32, h = 284.88},
[4] = {x = 1723.28, y = -1576.48, z = 112.56, h = 295.48},
[5] = {x = 2588.24, y = 414.24, z = 108.44, h = 178.32},
[6] = {x = 2536.08, y = 2584.4, z = 37.96, h = 358.52},
[7] = {x = 2671.32, y = 3529.92, z = 52.28, h = 65.6},
[8] = {x = -270.12, y = 6035.44, z = 31.68, h = 49.8},
[9] = {x = -1171.44, y = -2200.92, z = 13.2, h = 295.28}
}
Config.locationstransportlegal = {
[1] = {x = -826.4, y = -2690.2, z = 13.88},
[2] = {x = 1146.68, y = -3281.16, z = 5.92},
[3] = {x = 844.6, y = -2350.92, z = 30.32, h = 284.88},
[4] = {x = -806.4, y = -2679.64, z = 13.8},
[5] = {x = -826.4, y = -2690.2, z = 13.88},
[6] = {x = -806.4, y = -2679.64, z = 13.8},
[7] = {x = -826.4, y = -2690.2, z = 13.88},
[8] = {x = -806.4, y = -2679.64, z = 13.8},
[9] = {x = -826.4, y = -2690.2, z = 13.88}
}
Config.locationstransportilegal = {
[1] = {x = -826.4, y = -2690.2, z = 13.88},
[2] = {x = 1146.68, y = -3281.16, z = 5.92},
[3] = {x = 844.6, y = -2350.92, z = 30.32, h = 284.88},
[4] = {x = -806.4, y = -2679.64, z = 13.8},
[5] = {x = -826.4, y = -2690.2, z = 13.88},
[6] = {x = -806.4, y = -2679.64, z = 13.8},
[7] = {x = -826.4, y = -2690.2, z = 13.88},
[8] = {x = -806.4, y = -2679.64, z = 13.8},
[9] = {x = -826.4, y = -2690.2, z = 13.88}
}
Config.LegalPackagePoints = {
totalpackage = 6, -- if you add more packages, add the number of packages there are in total to pick up
{x = 61.84, y = -2674.16, z = 5.0},
{x = 60.08, y = -2674.16, z = 5.0},
{x = 58.24, y = -2674.16, z = 5.0},
{x = 58.32, y = -2675.76, z = 5.0},
{x = 58.36, y = -2677.32, z = 5.0},
{x = 58.4, y = -2679.08, z = 5.0}
}
Config.IlegalWeaponsPoints = {
totalweapon = 6, -- if you add more weapons, add the total number of weapons to collect
{x = 1508.0, y = -2095.52, z = 75.84},
{x = 1509.28, y = -2095.32, z = 75.84},
{x = 1509.6, y = -2100.96, z = 75.68},
{x = 1510.96, y = -2101.4, z = 75.68},
{x = 1504.68, y = -2107.88, z = 75.36},
{x = 1497.16, y = -2102.12, z = 75.52}
}
Config.Level = {
['legal'] = {
[1] = {
money = 100, -- money that it will give you if you are at level 1
exp = 10, -- exp that it will give you if you are at level 1
exprequired = 1000 -- exp required to level up (legal and ilegal)
},
[2] = {
money = 200,
exp = 20,
exprequired = 2000
},
[3] = {
money = 300,
exp = 30,
exprequired = 3000
},
[4] = {
money = 400,
exp = 40,
exprequired = 4000
},
[5] = {
money = 500,
exp = 50,
exprequired = 5000
},
[6] = {
money = 600,
exp = 60,
exprequired = 6000
},
[7] = {
money = 700,
exp = 70,
exprequired = 7000
},
[8] = {
money = 800,
exp = 80,
exprequired = 8000
},
[9] = {
money = 900,
exp = 90,
exprequired = 9000
},
[10] = {
money = 1000,
exp = 100,
exprequired = 100000 -- do not touch
}
},
['ilegal'] = {
paywithitem = false, -- will pay you with an item if it is set to "true".
item = 'black_money', -- item name.
[1] = {
money = 100,
exp = 10,
},
[2] = {
money = 2000,
exp = 20,
},
[3] = {
money = 3000,
exp = 30,
},
[4] = {
money = 4000,
exp = 40,
},
[5] = {
money = 5100,
exp = 50,
},
[6] = {
money = 6100,
exp = 60,
},
[7] = {
money = 7100,
exp = 70,
},
[8] = {
money = 8100,
exp = 80,
},
[9] = {
money = 9100,
exp = 90,
},
[10] = {
money = 1100,
exp = 100,
},
}
}
Config.Translations = {
['language'] = "EN", --You can choose which language the notifications will be in. (EN, ES, FR)
['EN'] = {
[1] = "Press ~b~E~w~ to open",
[2] = "Go to the gps coordinates, and pick up the cargo.",
[3] = "~r~[E]~s~ - pick up package",
[4] = "This was the last box, load it and go to the new location to download.",
[5] = "~g~[E]~s~ - Open Doors",
[6] = "~g~[E]~s~ - Close Doors | ~g~[G]~s~ - Put package",
[7] = "Packages: ~g~",
[8] = "/6 ~s~",
[9] = "You already have a job to do.",
[10] = "You have been caught and the police have been called.",
[11] = "They are making illegal loadings, we have marked on your gps the area where it was last seen.",
[12] = "~r~[E]~s~ - collect weapons",
[13] = "These were the last weapons, load them and go to the new location to unload it.",
[14] = "Weapons: ~g~",
[15] = "/6 ~s~",
[16] = "A worker is on his way with the truck, wait for him to arrive.",
[17] = "Now you have to go and pick up the goods, we have marked it on the gps.",
[18] = "The gun owners have found out and are after you, kill them.",
[19] = "You need to have a truck driver's job for this."
},
['ES'] = {
[1] = "Pulsa ~b~E~w~ para abrir",
[2] = "Ve a las coordenadas gps, y recoge la carga",
[3] = "~r~[E]~s~ - recoger el paquete",
[4] = "Esta era la Ãēltima caja, cÃĄrgala y ve a la nueva ubicaciÃŗn para descargarla",
[5] = "~g~[E]~s~ - Abrir puertas",
[6] = "~g~[E]~s~ - Cerrar Puertas | ~g~[G]~s~ - Poner paquete",
[7] = "Paquetes: ~g~",
[8] = "/6 ~s~",
[9] = "Ya tienes un trabajo que hacer",
[10] = "Te han pillado y han llamado a la policÃa",
[11] = "EstÃĄn haciendo cargas ilegales, hemos marcado en su gps la zona donde fue visto por Ãēltima vez",
[12] = "~r~[E]~s~ - recoger las armas",
[13] = "Estas fueron las Ãēltimas armas, cÃĄrgalas y ve a la nueva ubicaciÃŗn para descargarlas",
[14] = "Armas: ~g~",
[15] = "/6 ~s~",
[16] = "Un trabajador estÃĄ en camino con el camiÃŗn, espere a que llegue.",
[17] = "Ahora tienes que ir a recoger la mercancÃa, la hemos marcado en el gps.",
[18] = "Los propietarios de armas se han enterado y van a por ti, mÃĄtalos.",
[19] = "Para esto hay que tener un trabajo de camionero."
},
['FR'] = {
[1] = "Appuyez sur ~b~E~w~ pour ouvrir",
[2] = "Allez aux coordonnÊes gps, et prenez la cargaison",
[3] = "~r~[E]~s~ - ramasse le paquet.",
[4] = "C'Êtait la dernière boÎte, chargez-la et allez au nouvel emplacement pour la dÊcharger",
[5] = "~g~[E]~s~ - Ouvrir les portes.",
[6] = "~g~[E]~s~ - Close Doors | ~g~[G]~s~ - Put Package",
[7] = "Paquets : ~g~",
[8] = "/6 ~s~",
[9] = "Vous avez dÊjà un travail à faire",
[10] = "Vous avez ÊtÊ pris et la police a ÊtÊ appelÊe.",
[11] = "Ils font des accusations illÊgales, nous avons marquÊ sur votre GPS la zone oÚ vous avez ÊtÊ vu pour la dernière fois",
[12] = "~r~[E]~s~ - ramasse les armes.",
[13] = "Ce sont les dernières armes, chargez-les et allez au nouvel emplacement pour les dÊcharger",
[14] = "Armes : ~g~",
[15] = "/6 ~s~",
[16] = "Un ouvrier est en route avec le camion, attendez qu'il arrive",
[17] = "Maintenant vous devez aller chercher les marchandises, nous l'avons marquÊ sur le gps",
[18] = "Les propriÊtaires d'armes à feu en ont entendu parler et sont après vous, tuez-les.",
[19] = "Il faut avoir un mÊtier de chauffeur routier pour cela."
},
}
Here are the important functions open. You will be able to set your Key System, Fuel System, Blips...
đYou will have to know the EXPORT of your system (e.g. from your fuel script) and add it, replacing the existing one.
For example if you don't use LegacyFuel and you use BitFuel, then replace exports["LegacyFuel"]:SetFuel(fuelvehicle, 100)
with your BitFuel export.
if Config.UseFuel == true then
function fuel()
exports["LegacyFuel"]:SetFuel(vehicle, 100)
end
function fuel2()
exports["LegacyFuel"]:SetFuel(vehicle2, 100)
end
end
if Config.BattlePass.Active then
function battlepass()
TriggerEvent("BattlePass-Server:AddXP",Config.BattlePass.xp ,"Trucker")
end
end
if Config.UseKeys == true then
function keys()
TriggerEvent('cd_garage:AddKeys', exports['cd_garage']:GetPlate(vehicle))
end
function keys2()
TriggerEvent('cd_garage:AddKeys', exports['cd_garage']:GetPlate(vehicle2))
end
end
if Config.UseDeleteVehicle then
function delete(vehicle)
exports["AdvancedParking"]:DeleteVehicle(vehicle)
end
function delete2(vehicle2)
exports["AdvancedParking"]:DeleteVehicle(vehicle2)
end
end
function hintToDisplay(text,coords)
local dist = Vdist(coords.x,coords.y,coords.z,GetEntityCoords(PlayerPedId(-1)))
if dist < 1.5 then
DrawText3Ds(coords.x,coords.y,coords.z + 1.05,text, 0, 0.1, 0.1,255)
else
DrawText3Ds(coords.x,coords.y,coords.z + 1.05,text, 0, 0.1, 0.1,100)
end
end
function DrawText3Ds(x, y, z, text)
SetTextScale(0.35, 0.35)
SetTextFont(4)
SetTextProportional(1)
SetTextColour(255, 255, 255, 215)
SetTextEntry("STRING")
SetTextCentre(true)
AddTextComponentString(text)
SetDrawOrigin(x,y,z, 0)
DrawText(0.0, 0.0)
ClearDrawOrigin()
end
-- Client notifications
function SendClientNotification(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 == 'esx' then
ESX.ShowNotification(text)
elseif Config.framework == 'qbcore' then
QBCore.Functions.Notify(text)
end
end
-- Server side notifications
function SendServerNotification(source, type, text, time)
-- time = 10000
-- if type == 'success' then
-- TriggerClientEvent('codem-notification', source, text, time, 'check', options)
-- elseif type == 'error' then
-- TriggerClientEvent('codem-notification', source, text, time, 'error', options)
-- elseif type == 'info' then
-- TriggerClientEvent('codem-notification', source, text, time, 'info', options)
-- end
if Config.framework == 'esx' then
TriggerClientEvent('esx:showNotification', source, text)
elseif Config.framework == 'qbcore' then
TriggerClientEvent('QBCore:Notify', source, text)
end
end
--Blip Police
RegisterNetEvent("BCall:polblip")
AddEventHandler("BCall:polblip", function(ubi)
blip = AddBlipForRadius(ubi.x, ubi.y, ubi.z , 50.0)
SetBlipHighDetail(blip, true)
SetBlipColour(blip, 1)
SetBlipAlpha (blip, 128)
Citizen.Wait(25000)
RemoveBlip(blip)
end)
function home()
local coords = Config.NPCHOME
for k in pairs(coords) do
bliphome = AddBlipForCoord(coords[k].x, coords[k].y, coords[k].z)
SetBlipSprite(bliphome, 479)
SetBlipColour(bliphome, 24)
SetBlipScale(bliphome, 0.8)
SetBlipAsShortRange(bliphome, true)
BeginTextCommandSetBlipName("STRING")
AddTextComponentSubstringPlayerName('Trucker Job')
EndTextCommandSetBlipName(bliphome)
end
end
function blip1()
SetNewWaypoint(Point2.x, Point2.y, Point2.z)
blipdescargar = AddBlipForCoord(Point2.x, Point2.y, Point2.z)
SetBlipSprite(blipdescargar, 479)
SetBlipColour(blipdescargar, 24)
SetBlipScale(blipdescargar, 0.4)
SetBlipAsShortRange(blipdescargar, true)
BeginTextCommandSetBlipName("STRING")
AddTextComponentSubstringPlayerName('transport')
EndTextCommandSetBlipName(blipdescargar)
end
function blip2()
SetNewWaypoint(Point2.x, Point2.y, Point2.z)
blipdescargar = AddBlipForCoord(Point2.x, Point2.y, Point2.z)
SetBlipSprite(blipdescargar, 479)
SetBlipColour(blipdescargar, 24)
SetBlipScale(blipdescargar, 0.4)
SetBlipAsShortRange(blipdescargar, true)
BeginTextCommandSetBlipName("STRING")
AddTextComponentSubstringPlayerName('transport')
EndTextCommandSetBlipName(blipdescargar)
end
function blip3()
SetNewWaypoint(Point.x, Point.y, Point.z)
bliptrailer = AddBlipForCoord(Point.x, Point.y, Point.z)
SetBlipSprite(bliptrailer, 479)
SetBlipColour(bliptrailer, 50)
SetBlipScale(bliptrailer, 1.4)
SetBlipAsShortRange(bliptrailer, true)
BeginTextCommandSetBlipName("STRING")
AddTextComponentSubstringPlayerName('trailer')
EndTextCommandSetBlipName(bliptrailer)
end
function blip4()
SetNewWaypoint(Point.x, Point.y, Point.z)
bliptrailer = AddBlipForCoord(Point.x, Point.y, Point.z)
SetBlipSprite(bliptrailer, 479)
SetBlipColour(bliptrailer, 50)
SetBlipScale(bliptrailer, 1.4)
SetBlipAsShortRange(bliptrailer, true)
BeginTextCommandSetBlipName("STRING")
AddTextComponentSubstringPlayerName('trailers')
EndTextCommandSetBlipName(bliptrailer)
end
function creapackage()
SetNewWaypoint(57.88, -2667.32, 6.0)
for i, v in ipairs(Config.LegalPackagePoints) do
v.package2 = CreateObject(GetHashKey('prop_cs_cardbox_01'), v.x, v.y, v.z)
FreezeEntityPosition(v.package2, true)
v.blip = AddBlipForCoord(v.x, v.y, v.z)
SetBlipSprite(v.blip, 1)
SetBlipColour(v.blip, 24)
SetBlipScale(v.blip, 0.4)
SetBlipAsShortRange(v.blip, true)
BeginTextCommandSetBlipName("STRING")
AddTextComponentSubstringPlayerName('package')
EndTextCommandSetBlipName(v.blip)
end
end
function creapackage2()
SetNewWaypoint(1541.92, -2085.64, 77.08)
for i, v in ipairs(Config.IlegalWeaponsPoints) do
v.package2 = CreateObject(GetHashKey('ex_office_swag_guns03'), v.x, v.y, v.z)
FreezeEntityPosition(v.package2, true)
v.blip = AddBlipForCoord(v.x, v.y, v.z)
SetBlipSprite(v.blip, 1)
SetBlipColour(v.blip, 24)
SetBlipScale(v.blip, 0.4)
SetBlipAsShortRange(v.blip, true)
BeginTextCommandSetBlipName("STRING")
AddTextComponentSubstringPlayerName('weapon')
EndTextCommandSetBlipName(v.blip)
end
end
Here you can configure if you want to use a DISPATCH or police alert system different from the one included in the script.
You will have to find the documentation of the DISPATCH or SCRIPT you use and replace it here.
RegisterServerEvent("ButyTrucker:policecall")
AddEventHandler("ButyTrucker:policecall", function()
if Config.framework == 'esx' then
local xPlayer = ESX.GetPlayerFromId(source)
local xPlayers = ESX.GetPlayers()
local ubi = xPlayer.getCoords()
for i=1, #xPlayers, 1 do
local xPlayer = ESX.GetPlayerFromId(xPlayers[i])
if xPlayer.job.name == 'police' then
SendServerNotification(xPlayers[i], "info", Config.Translations[Config.Translations['language']][11], time)
TriggerClientEvent('ButyTrucker:polblip', xPlayers[i], ubi)
end
end
elseif Config.framework == 'qbcore' then
local src = source
local get = GetPlayerPed(src)
local coords = GetEntityCoords(get)
local Player = QBCore.Functions.GetPlayer(src)
local xPlayers = QBCore.Functions.GetPlayers()
local ubi = GetEntityCoords(get, coords)
for i=1, #xPlayers, 1 do
local xPlayer = QBCore.Functions.GetPlayers(xPlayers[i])
if Player.PlayerData.job.name == 'police' then
SendServerNotification(xPlayers[i], "info", Config.Translations[Config.Translations['language']][11], time)
TriggerClientEvent('ButyTrucker:polblip', xPlayers[i], ubi)
end
end
end
end)