Open SL-Cortez opened 4 months ago
Are you running any sort of anti cheat or something that encrypts the net events? That code segment is failing at trying to grab the player object to get their jobs which is odd since that callback doesn't send any data from client to server so the only variable it needs is the source.
As of matter of fact I am running an anti cheat we are using FiveGuard Anti Cheat on our server. You think it could be that that’s causing it to break?
That could be causing an issue. Almost all fivem anti-cheats work by just obscuring netevents and export names to break injector menus. I don't know the particular syntax for it but you might need to add this resource to the exclusion list or maybe redo the install for the resources.
I can try to give this a try then later today since I’ll be headed to work for the day. I’ll stop the anti cheat and see what it does.
Well update: I disabled my anti cheat and gave it another go and nothing... does the same thing still.
Interesting. Right below that callback can you put a lib.print.error(source) and see if it prints your player id when opening the menu.
The reason the player is nil is because the load event gets triggered as soon as the resource is created this means the player hasn't spawned yet,
You can get if GetParentResourceName
is defined to see if it's getting loaded into lb-phone iframe, to prevent slrn_qbmultijob
from calling the load event on creation.
Add the following line above the loadJobs post request to block the event from loading outside of lb-phone.
if (typeof GetParentResourceName === "function") { return }
$.post('https://slrn_qbmultijob/getJobs', JSON.stringify({}), function(data) {
loadJobs(data);
});
@SL-Cortez can you try the updated version with @SloppyShovel's fix.
@solareon Just tried and downloaded the updated version. I still receive the F8 console error https://i.imgur.com/5eyreqz.png when I try to switch jobs. Tried to remove jobs as well they disappear but when I close the app and open it back up they are still there.
@solareon Just tried and downloaded the updated version. I still receive the F8 console error https://i.imgur.com/5eyreqz.png when I try to switch jobs. Tried to remove jobs as well they disappear but when I close the app and open it back up they are still there.
The fix is not related to the error you are getting, the fix only patches the Player is nil error, the issue you are having is most likely related to job configuration.
the failed to fetch means the RegisterNUICallback
never returned a callback which in turn means the server callback never returned and most likely you have an error server side.
Summary
I receive this error everytime the server restarts https://i.imgur.com/MHE14xv.png. Another thing the app was working fine for like an hour and then decide to switch jobs and I receive this error in the f8 console didnt mess with nothing after succesfully installing and testing it for like 10 mins. https://i.imgur.com/eoir0fb.png
Reproduction
https://github.com/solareon/slrn_qbmultijob/assets/170153861/1834e1e5-d6c4-4a82-94f7-3092feb08d09
Expected behavior
Expected to go off duty, switch jobs when clicking 'SELECT', Removed to jobs to be actually removed.
Actual behavior
Video above shows everything in detail what exactly happened.
Additional context
Pictures of the errors. https://i.imgur.com/MHE14xv.png https://i.imgur.com/FFZRBrc.png
Current Version
1.0.0
Custom Resources
LB-Phone