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

[BUG] isdead metadata not applied on death #23

Closed
mockdot opened this issue Aug 28, 2023 · 5 comments
Closed

[BUG] isdead metadata not applied on death #23

mockdot opened this issue Aug 28, 2023 · 5 comments
Labels
bug Something isn't working need repro This bug report needs confirmation

Comments

@mockdot
Copy link
Contributor

mockdot commented Aug 28, 2023

Summary

isdead metadata not applied on death

Reproduction

Try dying

Expected behavior

Update isdead metadata to true

Actual behavior

value stays as false

Additional context

Was creating a take hostage script and creating the condition to disallow grabbing a person in isdead metadata and noticed after death that isdead parameter is not being moved from false to true. inlaststand is being updated correctly.

Last Updated

n/a

Custom Resources

n/a

Resource Rename

n/a

@mockdot mockdot added bug Something isn't working need repro This bug report needs confirmation labels Aug 28, 2023
@D4isDAVID D4isDAVID added this to Issues Aug 28, 2023
@github-project-automation github-project-automation bot moved this to Todo in Issues Aug 28, 2023
@mockdot mockdot changed the title isdead metadata not applied on death [BUG] isdead metadata not applied on death Aug 28, 2023
@Manason
Copy link
Contributor

Manason commented Aug 28, 2023

I suspect #24 might fix this. Or possibly it's unrelated.

@mockdot
Copy link
Contributor Author

mockdot commented Aug 28, 2023

from qbx-medical/server/main.lua:

starting line 100:

RegisterNetEvent('qbx-medical:server:playerDied', function()
	if GetInvokingResource() then return end
	print('source')
	print(source)
	local src = source
	print('src')
	print(src)
	local player = QBCore.Functions.GetPlayer(src)
	if not player then return end
	print(player.PlayerData.metadata.isdead)
	player.PlayerData.metadata.isdead = true
	print(player.PlayerData.metadata.isdead)
end)

removed source from function, as the id was not passing, additionally it looks like:

player.Functions.SetMetaData('isdead', true)

Is not applying the metadata, if I do:

player.PlayerData.metadata.isdead = true

It does work well

print before

[  script:qbx-medical] source
[  script:qbx-medical] nil
[  script:qbx-medical] src
[  script:qbx-medical] nil
[  script:qbx-medical] false
[  script:qbx-medical] false

print after

[  script:qbx-medical] source
[  script:qbx-medical] 2
[  script:qbx-medical] src
[  script:qbx-medical] 2
[  script:qbx-medical] false
[  script:qbx-medical] true

@mockdot
Copy link
Contributor Author

mockdot commented Aug 28, 2023

Looking further I see that the value does not get saved to the DB when changed at that moment, it is doing a save after X amount of minutes, meaning for example if you go into laststand, it will take several seconds/minutes for the inlaststand in the DB to update, possibly updating while you are at the end of the laststand, I think it should be quicker, since if you logout, you want to save this?

@mockdot
Copy link
Contributor Author

mockdot commented Aug 28, 2023

This Qbox-project/qbx_core#114 and this #25 should do the trick

@mockdot
Copy link
Contributor Author

mockdot commented Sep 9, 2023

This has been fixed with the above PRs, closing this.

@mockdot mockdot closed this as completed Sep 9, 2023
@github-project-automation github-project-automation bot moved this from Todo to Done in Issues Sep 9, 2023
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: Done
Development

No branches or pull requests

2 participants