Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Character spawning inside multicharacter preview rooms #347

Open
mafewtm opened this issue Feb 7, 2024 · 4 comments
Open

Character spawning inside multicharacter preview rooms #347

mafewtm opened this issue Feb 7, 2024 · 4 comments
Labels
bug Something isn't working need repro This bug report needs confirmation

Comments

@mafewtm
Copy link
Member

mafewtm commented Feb 7, 2024

Summary

Sometimes if you leave your server after you see the character selection screen, once you rejoin and spawn in at last location, itll spawn you inside the room

Reproduction

  1. Load into your server
  2. (Not sure if you need to select your character first or if you just load in and touch nothing...or both might cause it maybe)
  3. Log out of your server
  4. Load back into your server
  5. Select a character
  6. Select a spawn or if you arent using qbx_spawn, do nothing
  7. You'll load into the multicharacter character selection room instead of previous last location

Expected behavior

Your characters last location shouldnt be saved while in character selection

Actual behavior

It saves

Additional context

Might be something in the multicharacter or just how the last location is saved. Not too sure

Current Version

v1.6.1

Custom Resources

N/A

@mafewtm mafewtm added bug Something isn't working need repro This bug report needs confirmation labels Feb 7, 2024
@qbox-duck qbox-duck bot added this to Issues Feb 7, 2024
@github-project-automation github-project-automation bot moved this to Todo in Issues Feb 7, 2024
@rasm945i
Copy link

rasm945i commented Feb 7, 2024

I'm pretty confident this is where the issue lies. A check if the user is "logged in" should probably be performed before getting the users location: https://github.com/Qbox-project/qbx_core/blob/main/server/player.lua#L492

@rasm945i
Copy link

rasm945i commented Feb 7, 2024

I managed to replicate it.

  1. Introduce error that causes a crash pretty much as soon as the user picks a character (in example theres a delay, see step 5) I used this code on a client-side script:
AddEventHandler('populationPedCreating', function(x, y, z)
	Wait(500)	-- Give the entity some time to be created
        local handle = GetClosestPed(vec3(x,y,z)) -- This is an invalid native call, not enough arguments passed
	SetPedDropsWeaponsWhenDead(handle, false)
end)
  1. Join server
  2. Pick character
  3. Hit play
  4. At this point you are among pedestrians and will crash due to them spawning (because thats how i implemented my crash)
  5. Disable the resource causing the crash
  6. Log in
  7. Spawn in the previous "Spawn Preview" location when selecting "Last Location" rather than the intended actual "Last Location"

@SKITTLE6969
Copy link
Contributor

Summary

Sometimes if you leave your server after you see the character selection screen, once you rejoin and spawn in at last location, itll spawn you inside the room

Reproduction

  1. Load into your server
  2. (Not sure if you need to select your character first or if you just load in and touch nothing...or both might cause it maybe)
  3. Log out of your server
  4. Load back into your server
  5. Select a character
  6. Select a spawn or if you arent using qbx_spawn, do nothing
  7. You'll load into the multicharacter character selection room instead of previous last location

Expected behavior

Your characters last location shouldnt be saved while in character selection

Actual behavior

It saves

Additional context

Might be something in the multicharacter or just how the last location is saved. Not too sure

Current Version

v1.6.1

Custom Resources

N/A

can confirm this, i though it was my multichar issue but apparently its not @_@

@0Programmer
Copy link

So when selecting a character SetMetaData gets triggert 3 times because of: https://github.com/Qbox-project/qbx_medical/blob/main/server/main.lua#L35 and https://github.com/Qbox-project/qbx_police/blob/main/server/main.lua#L325 qbx_medical wil trigger the Save() function because: https://github.com/Qbox-project/qbx_core/blob/main/server/player.lua#L1004

Here we store the last location: https://github.com/Qbox-project/qbx_core/blob/main/server/player.lua#L1006
Now it is possible that before you load in fully that sometimes https://github.com/Qbox-project/qbx_core/blob/main/server/loops.lua#L3 will run and save the pos from the multicharacter location and state inApartment or inProperty is true and therefore will not update the last location?

After you select a character it will save the multicharacter location 2 times because of isdead and inlaststand from qbx_medical server/main.lua#L35 but whatever i try i cannot reproduce this issue because the last location will update correctly.

Does anyone has this issue with the latest version?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working need repro This bug report needs confirmation
Projects
Status: Todo
Development

No branches or pull requests

4 participants