I was creating a podium system, and suddenly I came across this topic this morning: [ESX] [QBCORE] The Top Donators and Ranking Players NPC Spotlight Script!
So I made some modifications to my code and created a proof of concept.
Really easy script, It’s made with esx but easily changeable to qb or your favorite framework (18$ for this and not code accesible I think isn’t fair)
vipsnpc.zip (3.6 KB)
|
|
Code is accessible |
Yes |
Subscription-based |
No |
Lines (approximately) |
230 |
Requirements |
ESX |
Support |
No |
12 Likes
Definetly cool, but you could use some serious optimization here, plus its not live updated, Good work Though!
1 Like
"I did it in a couple of hours in the noon and didn’t want to spend more time making it live-updated. It’s just a POC.
But I’m interested in optimization. Could you write the optimized code or provide pseudocode?
Thank you, buddy! I really appreciate it
Of course, you could cache the players Apearrance and create the peds only when the player needs to see them, for example, if the distacne to the presetted locations is smaller tha 30.0 then if the peds do not exist then create them, else if they do exist delete them, you are creating a thread for each text that should be drawn, insted put them all in one and with the same logic that you applied with the sleep draw the text only when the player can see the ped or when the player is close to the ped,
A common thing is that Hashkey is faster than GetHashKey, instead of issuing a callback to pass the info, hook it serverside on the playerLoaded event, that’s it pretty much off the small look i had in your code
2 Likes
Also very impotrant thing that i saw here is that you are using the GetDistanceBetweenCoords which is known to be a bad native to use, you could use vector math like that #(playerCoords - coords)
2 Likes
I haven’t a qb server ready and not so much free time. So don’t expect a qb version soon. But it’s a 3 lines change to make it work with qb so feel free to modify it
1 Like
If you are using ESX and want to modify which people appears (In the code is made for top money users) for example you want to make appear the top time played people you just need modify the server.lua and change the sql query.
In the other side if you want to use with QB you need to change the callback function and the dependencies to use the QB and modify the sql query. I will try next week to make it standalone so you don’t need to use the framework callback dependency. Just need to modify the sql query.
@iMaluOfficial is this work in illenium-appearance?