weathersync
weathersync copied to clipboard
QB Weathersync issues.
Hi Again,
You make such amazing stuff, so yep, we use them a lot. But now I started to use your weather sync because of the map. But since we are on QB it kinda flashes at some times, I tried to disable the QB one but some other resources such as houses and apartments are depending on it.
Is there a way to let them both work together? Maybe a method for your plugin to look if QB or esx is weather sync is installed, then do use that one or kill it without losing other dependencies?
I'm not familiar with QB(core?) or it's weather sync system, I assume you mean this? https://github.com/qbcore-framework/qb-weathersync
And is this the housing system you mentioned? https://github.com/qbcore-framework/qb-houses
From what I can tell from a quick glance at the code, the housing system disables weather syncing while you're inside the house, is that correct? My weathersync has a similar feature, so I think it would be possible to replace calls like this:
https://github.com/qbcore-framework/qb-houses/blob/053f87a3b931d95e7a29f66f1714d7e8a65573c0/client/main.lua#L154
TriggerEvent('qb-weathersync:client:EnableSync')
with:
TriggerEvent("weathersync:setSyncEnabled", true)
Although, I'm slightly confused as to why there is no instance of that resource using qb-weathersync:client:DisableSync
to turn off the weather sync in the first place, it seems to only be re-enabling the weather sync.
I think maybe a simpler solution than making weathersync intermingle with with qb-weathersync (and potentially dozens of other weather sync systems out there for other frameworks) would be to create a small compatibility layer resource, which would be named qb-weathersync
but would replace the normal events with calls to equivalent weathersync events/exports, like this:
AddEventHandler("qb-weathersync:client:EnableSync", function()
TriggerEvent("weathersync:setSyncEnabled", true)
end)
AddEventHandler("qb-weathersync:client:DisableSync", function()
TriggerEvent("weathersync:setSyncEnabled", false)
end)
What other resources that you use depend on qb-weathersync?
I'm not familiar with QB(core?) or it's weather sync system, I assume you mean this? https://github.com/qbcore-framework/qb-weathersync
And is this the housing system you mentioned? https://github.com/qbcore-framework/qb-houses
From what I can tell from a quick glance at the code, the housing system disables weather syncing while you're inside the house, is that correct? My weathersync has a similar feature, so I think it would be possible to replace calls like this:
https://github.com/qbcore-framework/qb-houses/blob/053f87a3b931d95e7a29f66f1714d7e8a65573c0/client/main.lua#L154
TriggerEvent('qb-weathersync:client:EnableSync')
with:
TriggerEvent("weathersync:setSyncEnabled", true)
Although, I'm slightly confused as to why there is no instance of that resource using
qb-weathersync:client:DisableSync
to turn off the weather sync in the first place, it seems to only be re-enabling the weather sync.I think maybe a simpler solution than making weathersync intermingle with with qb-weathersync (and potentially dozens of other weather sync systems out there for other frameworks) would be to create a small compatibility layer resource, which would be named
qb-weathersync
but would replace the normal events with calls to equivalent weather sync events/exports, like this:AddEventHandler("qb-weathersync:client:EnableSync", function() TriggerEvent("weathersync:setSyncEnabled", true) end) AddEventHandler("qb-weathersync:client:DisableSync", function() TriggerEvent("weathersync:setSyncEnabled", false) end)
What other resources that you use depend on qb-weathersync?
Yes, With QB I mean QBCore and also the housing and apartments (two scripts) are both QB.
As for the depending on resources, those are the only two for QB vanilla, lots of custom frameworks are actually based on QBCore and there is ESX as well.
Replacing the triggers seems to work but don't forget to change the fxmanifest as well, change the dependencies, or you will have other issues…
dependencies {
'rbp-core',
'rbp-interior',
'rbp-clothing',
--'rbp-weathersync',
'weathersync'
}
Replacing the triggers seems to work but don't forget to change the fxmanifest as well, change the dependencies, or you will have other issues…
That is another way to do it. The way I was suggesting was to replace the rbp-weathersync
resource, in your case, with basically a shell resource that hands off the qb-weathersync:...
event triggers to weathersync:...
ones. That way, you don't need to modify the qb-houses resource or its manifest, just the resource you're replacing anyways (qb-weathersync).
Here's a more complete example: https://gist.github.com/kibook/3b2178b168a0f31f7be6cf46e7c7f8f4
If you replace your rbp-weathersync
resource with this, assuming you haven't also renamed events like qb-weathersync:client:EnableSync
to rbp-weathersync:client:EnableSync
or whatever, it should also work (make sure to update weathersync as well, since the exports used were just added today). Now when other resources trigger qb-weathersync:client:EnableSync
, it just gets handed off to exports.weathersync:setSyncEnabled
.
Replacing the triggers seems to work but don't forget to change the fxmanifest as well, change the dependencies, or you will have other issues…
That is another way to do it. The way I was suggesting was to replace the
rbp-weathersync
resource, in your case, with basically a shell resource that hands off theqb-weathersync:...
event triggers toweathersync:...
ones. That way, you don't need to modify the qb-houses resource or its manifest, just the resource you're replacing anyways (qb-weathersync).
Yeah, i was definitely thinking about that, but rather did a clean job, so I made a back-up of the original ones, then I did a switcheroo within the code.
Event fix ClockTime in RedM ->
NetworkClockTimeOverride(14, 30, 0, 10000, false);