feat(es_extended/server/modules/commands.lua): Add Validation Number#1617
Merged
Conversation
…n, and giveammo commands
…alidation for giveweapon and giveammo
FBFezz
requested changes
Feb 28, 2025
…maximum limit enforcement.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
This prevents the use of values exceeding the IEEE 754 double-precision floating-point limit.
Entering a value higher than this limit would cause ox to stop functioning and produce the following error:
SEND_NUI_MESSAGE: invalid JSON passed in frame (rapidjson error code 3).Additionally, if you attempt to remove money exceeding this limit, ox would no longer be functioning and you would no longer be able to give any more money. This would require manually resetting your money and removing cash-based items from the database to restore normal functionality.
Motivation
This change prevents admins from unintentionally or maliciously causing issues for players.
Implementation Details
Improving server-side protections is crucial, as you can never fully anticipate the intentions of people you don’t know well.
More security is always better than less.
Usage Example
When attempting to give an item, add, or remove money, an error will be displayed if the value exceeds the maximum allowed limit:
1.79769e+308.PR Checklist