qbcore-framework / qb-multicharacter

Multi-Character System Used With QB-Core :man: :woman:
GNU General Public License v3.0
32 stars 235 forks source link

[BUG] When entering the server the multicharacter interface does not load #80

Closed AlexR1712 closed 2 years ago

AlexR1712 commented 2 years ago

Some users keep reporting me that when they enter the server they get stuck in the screen before loading the list of characters, and in some cases some of them more than others, look at the console of each of them but there is no visible error in F8.

To Reproduce Steps to reproduce the behavior:

  1. Enter to the server
  2. See the issue you're stucked (blurred screen)

Expected behavior Load all characters of the player.

Screenshots

https://user-images.githubusercontent.com/8460736/152469131-34a569f9-1798-45a2-8489-781f71a0af3d.mp4

Questions (please complete the following information):

As a side note, I have been updating this script and making some style modifications, but personally I have never had this problem, but it is reported a lot, even by people who had just formatted their computer.

Related #70

tsegkos commented 2 years ago

On my server some people trying to connect and have the same problem too. Any solution yet?

wickednz commented 2 years ago

Ive found the loading screen has an effect on it, like different ones can cause longer multi character loading. When we didn't have any loading screen some users couldn't join at all.

SupremeCatOG commented 2 years ago

I think I've fixed this issue on our server by increasing the time at line 59 to 1500ms and by adding another Wait(1500) after line 86 (Using this as reference for lines: https://github.com/qbcore-framework/qb-multicharacter/blob/main/client/main.lua). I used to have the bug happen to me very frequently, but now since those changes it hasn't happened once (hope I didn't jinx it now.)

SupremeCatOG commented 2 years ago

Well, I jinxed it, lessgo, it didn't fix shit, although I didn't have the bug happen to me for like, the last 20 connects to the server...

AlexR1712 commented 2 years ago

I solved the problem on my own using a NUICallback

-- sample code
RegisterNUICallback('fix', function(data, cb)
    Wait(0)
    if NetworkIsSessionStarted() then
        TriggerEvent('qb-multicharacter:client:chooseChar')
        return
    end
    cb(data)
end)

And then on the javascript add the call to the NUI Callback with a delay of 1000 ms, for now is working on all cases. PD: You can improve this code of course.

// sample code
setTimeout(() => {
    fetch(`https://${GetParentResourceName()}/fix`, {
        method: 'POST',
        headers: {
            'Content-Type': 'application/json; charset=UTF-8',
        },
        body: JSON.stringify({})
    }).then(resp => resp.json()).then(resp => console.log('Fixed', resp));    
}, 1000);
JordanBScott commented 2 years ago

Hey guys, I am having the same issue unfortunately. I have my server up and running. It is a localhost one and I play in it with my roommates. What is weird is that I can load into the server just fine, and so can one of my roommates... BUT for some reason every time my other roommate joins he is brought to the qb-multicharacter menu but it just shows the background image blurry (see screenshot). We have tried letting it load to see if that fixed the issue, but nothing. Does anyone have a solution to this issue? Any and all help is appreciated! Thanks!Screenshot_25

tiagofcp commented 2 years ago

Im also facing the same issue, with our server some or players have this issue, i tried a lot of things already but none solved it yet. But some other users never had a issue im not understanding the cause of this if any one can help

tiagofcp commented 2 years ago

I solved the problem on my own using a NUICallback

-- sample code
RegisterNUICallback('fix', function(data, cb)
    Wait(0)
    if NetworkIsSessionStarted() then
        TriggerEvent('qb-multicharacter:client:chooseChar')
        return
    end
    cb(data)
end)

And then on the javascript add the call to the NUI Callback with a delay of 1000 ms, for now is working on all cases. PD: You can improve this code of course.

// sample code
setTimeout(() => {
    fetch(`https://${GetParentResourceName()}/fix`, {
        method: 'POST',
        headers: {
            'Content-Type': 'application/json; charset=UTF-8',
        },
        body: JSON.stringify({})
    }).then(resp => resp.json()).then(resp => console.log('Fixed', resp));    
}, 1000);

in wich place do you put the js code? inside some function or outside?

AlexR1712 commented 2 years ago

@tiagofcp I simply added it to the end of the file.

SemperCertusetFidelis commented 2 years ago

Yeah I'm having the same issue, as far is I can tell the first time connecting is always fine. But after disconnecting once and reconnecting this starts becoming a issue. Sometimes it works, sometimes it won't

GeekHamza1 commented 2 years ago

this issue become a serious problem for some players

corrupt3k commented 2 years ago

Same issue here. Maybe a screen resolution issue?

twigmasters commented 2 years ago

any official fix for this yet? My friend is having this problem but I am not and never have. @AlexR1712 Where do you put the two pieces of code? What files and where?

GeekHamza1 commented 2 years ago

Same issue here. Maybe a screen resolution issue? yes its resoulutin issue but you can fix it by @tiagofcp soulution

twigmasters commented 2 years ago

but where do I put that code to fix it?

GeekHamza1 commented 2 years ago

but where do I put that code to fix it?

for the first one add it under CreateThread(function() while true do Wait(0) if NetworkIsSessionStarted() then TriggerEvent('qb-multicharacter:client:chooseChar') return end end end)

in client second one for js add it after all the lines

BerkieBb commented 2 years ago

btd-multicharacter?

twigmasters commented 2 years ago

we are not using btd-multicharacter. this is QBcore

GeekHamza1 commented 2 years ago

we are not using btd-multicharacter. this is QBcore

sorry yes its qb-multicharacter

Rockzey3 commented 2 years ago

is there an offical fix for this?

GhzGarage commented 2 years ago

Should be fixed now, re-download

SeriumTW commented 2 years ago

@GhzGarage does not work

GhzGarage commented 2 years ago

I go in and out of my server all night long and never once had the issue happen so i have no way to reproduce it or know what causes it. If someone can add some prints to debug it then i can fix it but otherwise i have no idea.

JordanBScott commented 2 years ago

I had this issue on my previous server and found out that the issue was I had a corrupted resource that I had added in. I had to replace it with a similar resource that wasn't corrupted and then it worked fine. Hopefully this helps!

AlexR1712 commented 2 years ago

I go in and out of my server all night long and never once had the issue happen so i have no way to reproduce it or know what causes it. If someone can add some prints to debug it then i can fix it but otherwise i have no idea.

in fact it is precisely the problem, it is very difficult to reproduce, in my case it only happened to some people only, And it does not show an error in the console but with what I indicated above it stopped happening practically in all cases with the cost of waiting a few extra seconds

Mongoljingoo25 commented 1 year ago

but where do I put that code to fix it?

for the first one add it under CreateThread(function() while true do Wait(0) if NetworkIsSessionStarted() then TriggerEvent('qb-multicharacter:client:chooseChar') return end end end)

in client second one for js add it after all the lines

like this ? https://media.discordapp.net/attachments/945047713249116220/1070332362900119702/asdasd.png