Alert function triggered whenever an alert even happens. You can customize this to fit your needs
-- Purpose: Edit functions, events, and vars for the client side of the Big Rig job.-- msg [string]: Message to display in the notification-- type [string]: Type of notification to display-- timeout [int]: Time in milliseconds to display the notificationfunctionAlert(msg,type,timeout) lib.notify({ type =type, title = locale('job_name'), description = msg, icon ="fas fa-truck", duration = timeout, position ="top", })end
Help Text
This is the function triggered to display the classic help text in the top left of the screen. More frequently used in thread loops with informational messages, and/or keybind messages
-- Purpose: Function to display a help text notification.-- text [string]: Text to display in the notificationfunctionHelpText(text) SetTextComponentFormat("STRING") AddTextComponentString(text) DisplayHelpTextFromStringLabel(0, 0, 1, -1)end
Vehicle Spawned
This is triggered whenever a vehicle has been spawned. You can add framework specific functions such as adding fuel, setting doorlock keys, etc. I have already included some pre configured exports and events, but you can customize to your needs.
-- Purpose: Function trigered after vehicle is spawned.-- vehicle [int]: Vehicle to set the fuel level for etcfunctionVehicleSpawned(vehicle)--PS FUEL--exports['ps-fuel']:SetFuel(vehicle, 100.0)--Quasar Fuel--exports['qs-fuelstations']:SetFuel(vehicle, 100.0)--Legacy Fuel--exports["LegacyFuel"]:SetFuel(vehicle, 100)--OX Fuel--Entity(vehicle).state.fuel = 100--QBCore Lock system--TriggerServerEvent("qb-vehiclekeys:server:AcquireVehicleKeys", Framework.Functions.GetPlate(vehicle))--Quasar Lock system--local model = GetDisplayNameFromVehicleModel(GetEntityModel(vehicle))--local plate = GetVehicleNumberPlateText(vehicle)--exports['qs-vehiclekeys']:GiveKeys(plate, model, true) SetVehicleDirtLevel(vehicle, 0.0) SetVehicleDoorsLocked(vehicle, 1)end
Vehicle Despawn
This function is called before a car is deleted. You can use this when your framework requires specific actions to be performed when a vehicle is deleted such as removing keys from a players inventory
-- Purpose: Function trigered vehicle is despawned.-- vehicle [int]: Vehicle to set the fuel level for etcfunctionVehicleDespawned(vehicle)--Quasar Lock system--local model = GetDisplayNameFromVehicleModel(GetEntityModel(vehicle))--local plate = GetVehicleNumberPlateText(vehicle)--exports['qs-vehiclekeys']:RemoveKeys(plate, model)end
Worker Ped Spawned
Sure I could have added this with the ped spawn function, but maybe someone wants to do something differently with the work ped. This is where you do it!
-- Purpose: Function triggered after worker ped is created.-- ped [int]: Ped to set as a workerfunctionSpawnedWorkerPed(ped) SetEntityAsMissionEntity(ped, true, true) SetBlockingOfNonTemporaryEvents(ped, true) SetPedDiesWhenInjured(ped, false) SetPedCanRagdollFromPlayerImpact(ped, false) SetPedCanRagdoll(ped, false) SetEntityInvincible(ped, true) FreezeEntityPosition(ped, true) DecorSetBool(ped, 'ScriptedPed', true) TaskStartScenarioInPlace(ped, 'WORLD_HUMAN_CLIPBOARD', 0, true)end
Ped Spawned
This is triggered after peds are spawned such as cattle on the cattle job, the auto pilot ped for the cargobob, and anything else you configure to require a ped.
-- Purpose: Function triggered after ped is created.-- ped [int]: Ped to set as an autopilotfunctionPedSpawned(ped) SetBlockingOfNonTemporaryEvents(ped, true) SetPedDiesWhenInjured(ped, false) SetPedCanRagdollFromPlayerImpact(ped, false) SetPedCanRagdoll(ped, false) SetEntityInvincible(ped, true) DecorSetBool(ped, 'ScriptedPed', true)end
Dispatch
This is triggered when an illegal load is ready to move to the drop off. You can configure this to fit your own dispatch system on your server.
-- JobName [string]: Job name set in configfunctionSendDispatch(JobName)local coords = GetEntityCoords(PlayerPedId())-- PS-Dispatchlocal dispatchData = { message = JobName, codeName ='carjack', code ='10-17', icon ='fas fa-truck', priority =1, coords = coords, alertTime =nil, jobs = Config.PoliceJobs } TriggerServerEvent('ps-dispatch:server:notify', dispatchData)--CD_DISPATCH--[[ local data = exports['cd_dispatch']:GetPlayerInfo() TriggerServerEvent('cd_dispatch:AddNotification', { job_table = Config.PoliceJobs, coords = coords, title = '10-17 - ' .. JobName, message = 'A stange shipment has been spotted, please investigate.', flash = 0, unique_id = data.unique_id, sound = 1, blip = { sprite = 431, scale = 1.2, colour = 3, flashes = false, text = '10-17 - ' .. JobName, time = 5, radius = 25.0, } }) ]]end
CB Radio
Connect and disconnect functions for the CB radios. You can configure these to use whatever resource you server uses for voice.
-- Purpose: Function to connect to the CB radio.functionCBConnect()-- PMA-VOICEif IsResourceOnServer('pma-voice') then exports['pma-voice']:addPlayerToRadio(Config.CBRadioChannel)endend-- Purpose: Function to disconnect from the CB radio.functionCBDisconnect()-- PMA-VOICEif IsResourceOnServer('pma-voice') thenif LocalPlayer.state['radioChannel'] and LocalPlayer.state['radioChannel'] == Config.CBRadioChannel then exports['pma-voice']:removePlayerFromRadio()endendend