From 0554280f32d64f866fedaf48e59ed2f36b42d63b Mon Sep 17 00:00:00 2001 From: userMacieG Date: Fri, 7 Aug 2020 01:42:24 +0200 Subject: [PATCH] Check for "MaxInService == -1" (#481) If "MaxInService == -1" is true check for service is skipped --- client/main.lua | 50 ++++++++++++++++++++++++++++++++----------------- 1 file changed, 33 insertions(+), 17 deletions(-) diff --git a/client/main.lua b/client/main.lua index a3389f46..4ae3bf3a 100644 --- a/client/main.lua +++ b/client/main.lua @@ -124,25 +124,41 @@ function OpenCloakroomMenu() ESX.TriggerServerCallback('esx_service:isInService', function(isInService) if not isInService then - ESX.TriggerServerCallback('esx_service:enableService', function(canTakeService, maxInService, inServiceCount) - if not canTakeService then - ESX.ShowNotification(_U('service_max', inServiceCount, maxInService)) - else - awaitService = true - playerInService = true + if Config.MaxInService == -1 then + ESX.TriggerServerCallback('esx_service:enableService', function(canTakeService, maxInService, inServiceCount) + if not canTakeService then + ESX.ShowNotification(_U('service_max', inServiceCount, maxInService)) + else + awaitService = true + playerInService = true - local notification = { - title = _U('service_anonunce'), - subject = '', - msg = _U('service_in_announce', GetPlayerName(PlayerId())), - iconType = 1 - } + local notification = { + title = _U('service_anonunce'), + subject = '', + msg = _U('service_in_announce', GetPlayerName(PlayerId())), + iconType = 1 + } - TriggerServerEvent('esx_service:notifyAllInService', notification, 'police') - TriggerEvent('esx_policejob:updateBlip') - ESX.ShowNotification(_U('service_in')) - end - end, 'police') + TriggerServerEvent('esx_service:notifyAllInService', notification, 'police') + TriggerEvent('esx_policejob:updateBlip') + ESX.ShowNotification(_U('service_in')) + end + end, 'police') + else + awaitService = true + playerInService = true + + local notification = { + title = _U('service_anonunce'), + subject = '', + msg = _U('service_in_announce', GetPlayerName(PlayerId())), + iconType = 1 + } + + TriggerServerEvent('esx_service:notifyAllInService', notification, 'police') + TriggerEvent('esx_policejob:updateBlip') + ESX.ShowNotification(_U('service_in')) + end else awaitService = true