From 4242d3dc1a5ea388dad5abe2d5a3cea910e3776a Mon Sep 17 00:00:00 2001 From: Lexinor Date: Tue, 21 Nov 2023 02:48:14 +0100 Subject: [PATCH 1/3] Added a forgotten thing, we are now setting the player state onduty to the correct state --- server/main.lua | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/server/main.lua b/server/main.lua index 417699a..5636681 100644 --- a/server/main.lua +++ b/server/main.lua @@ -22,8 +22,11 @@ end) RegisterServerEvent('esx_service:disableService') AddEventHandler('esx_service:disableService', function(name) + local source = source InService[name][source] = nil GlobalState[name] = GetInServiceCount(name) + Player(source).state:set('onduty', false, true) + TriggerClientEvent('esx:showNotification', source, "Vous n'ĂȘtes plus en service") -- Need to add translation system end) RegisterServerEvent('esx_service:notifyAllInService') @@ -43,6 +46,8 @@ ESX.RegisterServerCallback('esx_service:enableService', function(source, cb, nam else InService[name][source] = true GlobalState[name] = GetInServiceCount(name) + Player(source).state:set('onduty', true, true) + --TriggerClientEvent('esx:showNotification', source, "Vous avez pris votre service") -- Need to add translation system cb(true, MaxInService[name], inServiceCount) end end) From 74d02c9b0e430ff9daed0daad6da9f546f29e2c5 Mon Sep 17 00:00:00 2001 From: Lexinor <28725795+lexinor@users.noreply.github.com> Date: Wed, 22 Nov 2023 14:05:05 +0100 Subject: [PATCH 2/3] Uncommented showNotification --- server/main.lua | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/server/main.lua b/server/main.lua index 5636681..ac5d79b 100644 --- a/server/main.lua +++ b/server/main.lua @@ -25,7 +25,7 @@ AddEventHandler('esx_service:disableService', function(name) local source = source InService[name][source] = nil GlobalState[name] = GetInServiceCount(name) - Player(source).state:set('onduty', false, true) + Player(source).state:set('onduty', false, true) TriggerClientEvent('esx:showNotification', source, "Vous n'ĂȘtes plus en service") -- Need to add translation system end) @@ -47,7 +47,7 @@ ESX.RegisterServerCallback('esx_service:enableService', function(source, cb, nam InService[name][source] = true GlobalState[name] = GetInServiceCount(name) Player(source).state:set('onduty', true, true) - --TriggerClientEvent('esx:showNotification', source, "Vous avez pris votre service") -- Need to add translation system + TriggerClientEvent('esx:showNotification', source, "Vous avez pris votre service") -- Need to add translation system cb(true, MaxInService[name], inServiceCount) end end) From d5ce3133563faa0c9e6aa2542018918ff25cb04b Mon Sep 17 00:00:00 2001 From: Lexinor <28725795+lexinor@users.noreply.github.com> Date: Wed, 22 Nov 2023 14:09:09 +0100 Subject: [PATCH 3/3] Added storage for source --- server/main.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/server/main.lua b/server/main.lua index ac5d79b..0d82fef 100644 --- a/server/main.lua +++ b/server/main.lua @@ -40,7 +40,7 @@ end) ESX.RegisterServerCallback('esx_service:enableService', function(source, cb, name) local inServiceCount = GetInServiceCount(name) - + local source = source if inServiceCount >= MaxInService[name] then cb(false, MaxInService[name], inServiceCount) else