Skip to content

Commit

Permalink
feat: ems can place player in bed
Browse files Browse the repository at this point in the history
* feat: ems can place player in bed

* remove force off duty

* Update server/main.lua

Co-authored-by: Manason <[email protected]>

* Update client/hospital.lua

Co-authored-by: Manason <[email protected]>

---------

Co-authored-by: Manason <[email protected]>
  • Loading branch information
solareon and Manason authored Dec 1, 2023
1 parent b64edce commit 3dc9496
Show file tree
Hide file tree
Showing 15 changed files with 38 additions and 0 deletions.
19 changes: 19 additions & 0 deletions client/hospital.lua
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,10 @@ RegisterNetEvent('qbx_ambulancejob:client:onPlayerRespawn', function(hospitalNam
putPlayerInBed(hospitalName, bedIndex, true, true)
end)

RegisterNetEvent('qbx_ambulancejob:client:putPlayerInBed', function(hospitalName, bedIndex)
putPlayerInBed(hospitalName, bedIndex, false, true)
end)

---Notifies doctors, and puts player in a hospital bed.
local function checkIn(hospitalName)
local canCheckIn = lib.callback.await('qbx_ambulancejob:server:canCheckIn', false, hospitalName)
Expand Down Expand Up @@ -157,6 +161,21 @@ if config.useTarget then
icon = "fas fa-clipboard",
label = Lang:t('text.bed'),
distance = 1.5,
},
{
canInteract = function()
return QBX.PlayerData.job.name == 'ambulance'
end,
onSelect = function()
local player = GetClosestPlayer()
if player then
local playerId = GetPlayerServerId(player)
TriggerServerEvent('hospital:server:putPlayerInBed', playerId, hospitalName, i)
end
end,
icon = "fas fa-clipboard",
label = Lang:t('text.put_bed'),
distance = 1.5,
}
}
})
Expand Down
1 change: 1 addition & 0 deletions locales/ar.lua
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,7 @@ local Translations = {
check = 'ﻖﻘﺤﺗ',
lie_bed = '[E] - ﺮﻳﺮﺴﻟﺍ ﻰﻠﻋ ﺀﺎﻘﻠﺘﺳﺍ',
bed = 'Lay in bed',
put_bed = 'Place citizen in bed',
bed_out = '[E] - ﺮﻳﺮﺴﻟﺍ ﻦﻣ ﺽﻮﻬﻨﻟﺍ',
alert = 'Alert!'
},
Expand Down
1 change: 1 addition & 0 deletions locales/cs.lua
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,7 @@ local Translations = {
check = 'Přihlásit se',
lie_bed = '[E] - Lehnout si do postele',
bed = 'Lehnout si do postele',
put_bed = 'Uložení občana do postele',
bed_out = '[E] - Vstát z postele..',
alert = 'Upozornění!'
},
Expand Down
1 change: 1 addition & 0 deletions locales/de.lua
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,7 @@ local Translations = {
check = 'Einchecken',
lie_bed = '[E] - Um ins Bett zu legen',
bed = 'Lay in bed',
put_bed = 'Bürger ins Bett legen',
bed_out = '[E] - Um aus dem Bett zu steigen..',
alert = 'Alert!'
},
Expand Down
1 change: 1 addition & 0 deletions locales/en.lua
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,7 @@ local Translations = {
check = 'Check In',
lie_bed = '[E] - To lay in bed',
bed = 'Lay in bed',
put_bed = 'Place citizen in bed',
bed_out = '[E] - To get out of bed..',
alert = 'Alert!'
},
Expand Down
1 change: 1 addition & 0 deletions locales/es.lua
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,7 @@ local Translations = {
check = 'Check-in',
lie_bed = '[E] - Para acostarse en la cama',
bed = 'Acostarse en la cama',
put_bed = 'Acostar al ciudadano en la cama',
bed_out = '[E] - Para salir de la cama..',
alert = 'Alert!'
},
Expand Down
1 change: 1 addition & 0 deletions locales/fi.lua
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,7 @@ local Translations = {
check = 'Hoito',
lie_bed = '[E] - Makaa sängyssä',
bed = 'Lay in bed',
put_bed = 'Aseta kansalainen sänkyyn',
bed_out = '[E] - Nouse ylös sängystä..',
alert = 'Alert!'
},
Expand Down
1 change: 1 addition & 0 deletions locales/fr.lua
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,7 @@ local Translations = {
check = 'Enregistrement',
lie_bed = '[E] - Pour s\'allonger dans un lit',
bed = 'Lay in bed',
put_bed = 'Placer le citoyen dans son lit',
bed_out = '[E] - Pour sortir du lit..',
alert = 'Alert!'
},
Expand Down
1 change: 1 addition & 0 deletions locales/is.lua
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,7 @@ local Translations = {
check = 'Innritun',
lie_bed = '[E] - Að liggja í rúminu',
bed = 'Lay in bed',
put_bed = 'Place citizen in bed',
bed_out = '[E] - Til að fara fram úr rúminu..',
alert = 'Alert!'
},
Expand Down
1 change: 1 addition & 0 deletions locales/it.lua
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,7 @@ local Translations = {
check = 'Check In',
lie_bed = '[E] - Sdraiarsi sul letto',
bed = 'Lay in bed',
put_bed = 'Posizionare il cittadino a letto',
bed_out = '[E] - Per alzarti dal letto..',
alert = 'Alert!'
},
Expand Down
1 change: 1 addition & 0 deletions locales/pt.lua
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,7 @@ local Translations = {
check = 'Entrada',
lie_bed = '[E] - Deitar na cama',
bed = 'Lay in bed',
put_bed = 'Colocar o cidadão na cama',
bed_out = '[E] - Sair da cama...',
alert = 'Alert!'
},
Expand Down
1 change: 1 addition & 0 deletions locales/sk.lua
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,7 @@ local Translations = {
check = 'Prihlásiť sa',
lie_bed = '[E] - Ľahnutie na postel',
bed = 'Lay in bed',
put_bed = 'Umiestnite občana do postele',
bed_out = '[E] - Vstatie z postele..',
alert = 'Alert!'
},
Expand Down
1 change: 1 addition & 0 deletions locales/sv.lua
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,7 @@ local Translations = {
check = 'Checka In',
lie_bed = '~INPUT_CONTEXT~ - Ligg på sängen',
bed = 'Ligg på sängen',
put_bed = 'Placera medborgaren i sängen',
bed_out = '~INPUT_CONTEXT~ - Gå ur sängen..',
alert = 'LARM!'
},
Expand Down
1 change: 1 addition & 0 deletions locales/vn.lua
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,7 @@ local Translations = {
check = 'Nhập viện',
lie_bed = '[E] - Nằm xuống giường',
bed = 'Lay in bed',
put_bed = 'Đặt công dân lên giường',
bed_out = '[E] - Rời khỏi giường..',
alert = 'Alert!'
},
Expand Down
6 changes: 6 additions & 0 deletions server/main.lua
Original file line number Diff line number Diff line change
Expand Up @@ -150,6 +150,12 @@ RegisterNetEvent('hospital:server:RevivePlayer', function(playerId)
TriggerClientEvent('hospital:client:Revive', patient.PlayerData.source)
end)

---@param playerId number
RegisterNetEvent('hospital:server:putPlayerInBed', function(playerId, hospitalName, bedIndex)
if GetInvokingResource() then return end
TriggerClientEvent('qbx_ambulancejob:client:putPlayerInBed', playerId, hospitalName, bedIndex)
end)

local function sendDoctorAlert()
if doctorCalled then return end
doctorCalled = true
Expand Down

0 comments on commit 3dc9496

Please sign in to comment.