mascotte-scripts / cache

A FiveM native cache that reduces the number of native calls from the client!
https://forum.cfx.re/t/wip-native-cache/2827109
Creative Commons Zero v1.0 Universal
5 stars 6 forks source link

Possible issues (2) #1

Closed iSentrie closed 3 years ago

iSentrie commented 3 years ago

1. Issue - loop without checks

https://github.com/KingMascotte/mascotte-cache/blob/15687ae325b36479876274cb45c830076be49ba4/client/cl_cache.lua#L41-L51

Error: Currently if you just join the server, player ped id won't be assigned for next 30s, untill loop executes again. This might and will cause various problems on a fully working servers. Sugestion: maybe add a check when player ped has been spawned. Further investigation: there is few scripts that might use ped id much more often that 30s, maybe even every second, changing player model can cause issues.

2. Issue - slow natives

So GetPlayerPed(-1) is used in this while PlayerPedId() does completely the same job and is faster. Suggestion: use only 1 faster native, clean and fast, gg.

mascotte-scripts commented 3 years ago

Instead I just changed the time on the Wait. Apparently PlayerPedId does change value. The eventual goal is to have everything neatly put into threads similar to the format I'm trying to follow which I've set.

Also thanks for the suggestion about GetPlayerPed(-1) being inferior to PlayerPedId() while the latter still gets the same data as the first