#Service App -> Jobs not refreshing
1 messages · Page 1 of 1 (latest)
You've been told that it has never been instant?
You mean the job changing in the database? Yeah we have already fixed that
But it does not change at all
Only after a restart of the phone
What if you wait like 2-5 minutes?
Pretty sure it wont work but I'll give it a shot
It is now 16:46 and I will change my job to ambulance without restarting the phone
I have the ambulance job now, lets wait
Job changed in the database already
Could be due to the ESX.JobsPlayerCount
I mean its right that it changes, isnt it?
But does it change?
Can you check where it is defined, because it isn't in my esx
Yea
I can only find it in the RefreshCompanies() function
function RefreshCompanies()
if ESX.JobsPlayerCount then
for i = 1, #Config.Companies.Services do
local jobData = Config.Companies.Services[i]
jobData.open = (ESX.JobsPlayerCount[jobData.job] or 0) > 0
end
return
end
local openJobs = {}
if ESX.GetExtendedPlayers then
local xPlayers = ESX.GetExtendedPlayers()
for _, xPlayer in pairs(xPlayers) do
openJobs[xPlayer.job.name] = true
end
print("^6[LB Phone] ^3[WARNING]^7: You are running an outdated version of ESX. The script will still work, but you should consider updating. (you can remove this warning in server/custom/frameworks/esx.lua)")
else
local xPlayers = ESX.GetPlayers()
for _, source in pairs(xPlayers) do
local job = ESX.GetPlayerFromId(source).job.name
openJobs[job] = true
end
print("^6[LB Phone] ^3[WARNING]^7: You are running an extremely old version of ESX. The script will still work, but you should consider updating. (you can remove this warning in server/custom/frameworks/esx.lua)")
end
for i = 1, #Config.Companies.Services do
local jobData = Config.Companies.Services[i]
jobData.open = openJobs[jobData.job] or false
end
end
-- Get open companies
local lastRefresh = 0
lib.RegisterCallback("phone:services:getOnline", function(_, cb)
if (lastRefresh + 60) < os.time() and RefreshCompanies then
RefreshCompanies()
lastRefresh = os.time()
end
cb(Config.Companies.Services)
end)
This one also seems to be working correctly, at least it tries to use the function everytime you open the app & if its at least 60 sec ago you opened the app last time
As you can see, it did not refresh
I have the ambulance job. When I restart the phone now, it will be displayed correctly.
I cant find it in my es_extended at:
es_extended/server/common.lua
es_extended/server/functions.lua
es_extended/server/main.lua
I think its only for the newer versions, but we have the latest ESX version installed.
I replaced the GetJob & the RefreshCompanies functions with the ones from one phone version older, and it works
So it has to be the new functions
does it print anything about using an outdated version of ESX?
otherwise you have ESX.JobsPlayerCount
Nope
I have the latest version of esx
1.10.5
It didnt refresh with this function
Then there's something wrong with your ESX not updating that table
or wait
nvm
or
idk
it's in server/main.lua
line 320
and a bunch of other lines
i actually might know why it isn't working
Yeah I saw that but I tried a bit but it didnt work
As I said, the old one works perfectly
Alright, perfect ^^
change it to this: ```lua
if ESX.JobsPlayerCount then
for i = 1, #Config.Companies.Services do
local jobData = Config.Companies.Services[i]
local jobKey = ("%s:count"):format(jobData.job)
jobData.open = (GlobalState[jobKey] or 0) > 0
debugprint("Job", jobData.job, "is open:", jobData.open)
end
return
end
and it should work
np, thanks for the good bug report 😄
you keep saying that but for me and my city it was instant. so....
is there a fix for qb? assuming this is ESX only fix ^^? what would the equivalent be for qb
But it has 60 sec timeout 😄
ok well it was fast enough to not be noticeable
So if you open the app it only refreshes 60secs later when you open the app again
now you can close the app, close the phone run around and open it back up and sometimes its still not updated
? as i've told you, we haven't changed the logic for qb-core
and from what i've seen you seem to be the only one with issues on qb-core
But you can change the "timeout" in server/apps/framework/services.lua ^^
thats odd how im the only one being that i literally made ZERO changes to anything besides the phone update. So make it make sense.
But I assume it will impact the performance tho
cant say its my qbcore or files or server when literally nothing else was changed. I updated the phone checked it out and first thing I noticed was services app was acting up. Had reports about it almost instantly
then please create a detailed bug report
but i also don't see how it could break (for only you? i might be wrong) when we haven't touched that part since August
Yea its definitly strange. So if neither of us made changes to qbcore files then I suppose theres no logical explanation as to why its happening.
I have no idea why it's happening, so please create a detailed bug report with debug prints etc
I can take a look on my qb server later
If anything ill do a complete wipe of the phone and reset it back up again.