Last active
September 13, 2023 17:02
-
-
Save CaptainStabs/bf0a5539e7cff376d177eb7d6752b0c7 to your computer and use it in GitHub Desktop.
cd_dispatch custom 111 command
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
RegisterNetEvent('cd_dispatch:PillboxBell') | |
AddEventHandler('cd_dispatch:PillboxBell', function() | |
QBCore.Functions.Notify('You rang the bell letting NHS know that you are here.', "primary", 7500) | |
local data = exports['cd_dispatch']:GetPlayerInfo() | |
TriggerServerEvent('cd_dispatch:AddNotification', { | |
job_table = {'ambulance'}, | |
coords = data.coords, | |
title = 'Somebody rang the bell at Pillbox', | |
message = 'Somebody rang the bell at Pillbox', | |
flash = 0, | |
unique_id = data.unique_id, | |
sound = 1, | |
blip = { | |
sprite = 630, | |
scale = 1.2, | |
colour = 3, | |
flashes = false, | |
text = 'Bell', | |
time = 1, | |
radius = 0, | |
} | |
}) | |
end) | |
local function menu() | |
exports['qb-menu']:openMenu({ | |
{ | |
header = 'Local Doctor', | |
icon = 'fas fa-code', | |
isMenuHeader = true, -- Set to true to make a nonclickable title | |
}, | |
{ | |
header = 'Call a local doctor (Press ESC if in scene)', | |
txt = 'Costs £10,000', | |
params = { | |
event = 'ai_doctor:help', | |
args = { | |
} | |
} | |
}, | |
}) | |
end | |
RegisterCommand('111', function(source, args, rawCommand) | |
local data = exports['cd_dispatch']:GetPlayerInfo() | |
local msg = table.concat(args, " ") | |
if not msg then | |
return | |
end | |
QBCore.Functions.TriggerCallback('dispatch:doctorCount', function(doctorCount) | |
if doctorCount >= 1 then | |
QBCore.Functions.Notify('Your call has been placed.', 'notify') | |
TriggerServerEvent('cd_dispatch:AddNotification', { | |
job_table = {'ambulance'}, | |
coords = data.coords, | |
title = 'Dispatch - Incoming Call', | |
message = 'From '..data.name..' at '..data.street..': '..msg, | |
flash = 0, | |
unique_id = data.unique_id, | |
sound = 1, | |
blip = { | |
sprite = 61, | |
scale = 1.2, | |
colour = 3, | |
flashes = false, | |
text = 'Ambulance Call', | |
time = 5, | |
radius = 0, | |
} | |
}) | |
else -- If there are yyyyy online | |
QBCore.Functions.Notify('There are no NHS on duty, calling local doctor', 'notify') | |
menu() | |
end | |
end) | |
end) | |
TriggerEvent('chat:addSuggestion', '/111', 'Call the paramedics', { | |
{ name="msg", help="Message" }, | |
}) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment