Skip to content
This repository was archived by the owner on Feb 14, 2022. It is now read-only.

Fixed callback error #10

Merged
merged 3 commits into from
Mar 24, 2019
Merged

Fixed callback error #10

merged 3 commits into from
Mar 24, 2019

Conversation

benzon
Copy link

@benzon benzon commented Mar 4, 2019

Removed an invalid callback, that trow a client side error.

Found out that the callback thats called when storing the vehicle, is trowing a client side error, the reason behind this is a double cb serverside, where it calls.

cb(rowsChanged)
cb(true)

Dont think there is a reason for it to call cb(rowsChanged), should only do cb(true)

Søren Eskildsen added 2 commits March 4, 2019 20:05
Removed an invalid callback, that trow a client side error.
owned_vehicles table with changes that fixes cars not showing up, even cars not saving to db when bought.
@benzon
Copy link
Author

benzon commented Mar 4, 2019

Added a sql fix because of the current issues :)

Optimize the performance with 2 simple changes.

Added a canSleep variable to the drawmarker section stops it from running every tick unless it's needed.

Performance change 0.1-0.2ms.

Utilized the isInMarker to impose the same 500 ms delay registering if entered cirkle.

Performance change 0.1-0.2

When outside the draw distance the ms usage of the script is around 0.01 on a good computer prob 0.3 0.4 on a low end computer.
@benzon
Copy link
Author

benzon commented Mar 7, 2019

Optimized the performance with 2 small changed.

Introduced a new variable in the DrawMarker section of the script, called canSleep, this is set to true by default, in every section that checks distance a canSleep = false is added, and ad the bottom of the section a Citizen.Wait is added that only runs if canSleep is still true.

This gives better performance, since it avoids checking if you are with in distance every tick, but delays the next check by 500 ms, this will give a performance change of 0.01-0.02 ms (Can be more on lower end computers)

Next optimization is located in the section that registers if you entered the circles, used the same technique in this section, but tapping in to a variable that is already there isInMarker and did Citizen.Wait that only runs if isInMarker is false, this gives a small delay from entering the cirkle until the help text pops up.

This gives a performance change of 01-02ms again depends on computer performance.

So just with these to changes the script uses 0.04 ms less then before, for me personally when im out of DrawDistance the usage is 0.01 ms instead of 0.05 ms.

In general my honest opinion is lower the DrawDistance, there is no reason for being able to stand in the middle of the park down town, and see the markers, something like 30-50 is better, since it only loads when needed to be honest.

@HumanTree92 HumanTree92 merged commit b905355 into HumanTree92:master Mar 24, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants