Main/resources/[carscripts]/slashtires/bridge/dispatch/ps/client.lua
2025-06-07 08:51:21 +02:00

40 lines
1.6 KiB
Lua

---@param vehicle integer
---@return table
local function getVehicleData(vehicle)
return {
name = GetLabelText(GetDisplayNameFromVehicleModel(GetEntityModel(vehicle))),
plate = GetVehicleNumberPlateText(vehicle)
}
end
---Sends a dispatch alert about the slashing of tires
---@param coords vector3
---@param vehicleNetId integer
local function sendDispatchAlert(coords, vehicleNetId)
local vehicle = NetToVeh(vehicleNetId)
local vehicleData = getVehicleData(vehicle)
exports['ps-dispatch']:CustomAlert({
message = GetLocalization('dispatch_label'), -- Title of the alert
codeName = "NONE", -- Unique name for each alert
code = "10-66", -- Code that is displayed before the title
icon = 'fas fa-car', -- Icon that is displaed after the title
coords = coords, -- Coords of the player
priority = 2, -- Changes color of the alert ( 1 = red, 2 = default )
vehicle = vehicleData.name, -- Vehicle name
plate = vehicleData.plate, -- Vehicle plate
automaticGunfire = false, -- Automatic Gun or not
radius = 0, -- Radius around the blip
sprite = 432, -- Sprite of the blip
color = 2, -- Color of the blip
scale = 1.0, -- Scale of the blip
length = 2, -- How long it stays on the map
sound = 'Lose_1st', -- Alert sound
sound2 = 'GTAO_FM_Events_Soundset', -- Alert sound
offset = 'false', -- Blip / radius offset
flash = 'false', -- Blip flash
jobs = { 'leo' },
})
end
RegisterNetEvent('slashtires:sendDispatchAlert', sendDispatchAlert)