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

refactor: use esx cache #1338

Closed
wants to merge 1 commit into from
Closed

refactor: use esx cache #1338

wants to merge 1 commit into from

Conversation

MoskalykA
Copy link
Contributor

No description provided.

@Gellipapa
Copy link
Member

Gellipapa commented Apr 13, 2024

Hi! It might be a bit misleading to say id, independent since the user would probably think of it as source, it should be called something else because it is an id but it is not the source, it would need wrapping GetPlayerServerId(PlayerId()) this is return player source.

So I would suggest that we rename it and then I think it will be appropriate.

if playerId ~= PlayerId() then
playerId = PlayerId()

ESX.SetPlayerData("id", playerId)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think this should be in a loop as the player id never changes - it is static. Same goes for the server id.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@tomiichx Hi! Ohh yes nice catch it's true thanks.

@mikigoalie
Copy link

playerid doesnt change but pedid changes... :D Just saying it's probably better to just get PlayerPedId() directly than caching in case of ped mismatch (either changed ped or whatever)

@Gellipapa
Copy link
Member

playerid doesnt change but pedid changes... :D Just saying it's probably better to just get PlayerPedId() directly than caching in case of ped mismatch (either changed ped or whatever)

The PlayerPedId is already cached, but there's no point in caching the PlayerId, it's just more confusing if you enter the cached PlayerPedId and it doesn't work, so we won't merge it.

Thanks for your understanding and comments.

@Gellipapa Gellipapa closed this May 3, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: Done
Development

Successfully merging this pull request may close these issues.

4 participants