📚HRLib
FiveM library, used in all HRScripts resources, focused in providing common code in different scripts as functions to ensure better performance and optimization
Installation
Download HRLib
Configure its
config.lua
fileAdd
ensure HRLib
to the top of the list with resources to start in yourserver.cfg
Restart your server
Configuration
Here we allow you to see what you're about to configure before starting HRLib
local config = {}
config.defaultWebHook = 'https://discord.com/api/webhooks/********************' -- Default webhook URL for the `HRLib.DiscordMsg` function (not required)
config.defaultNotificationsPosition = 'left-center' -- available positions - 'top-right', 'center-right', 'bottom-right', 'frombelow-right', 'top-left', 'left-center', 'frombelow-left'
config.defaultProgressBarPosition = 'bottom-center' -- available positions - 'center-left', 'center', 'center-right', 'bottom-left', 'bottom-center', 'bottom-right'
config.alertDialogueTranslation = {
agreeButton = 'Agree',
cancelButton = 'Cancel'
}
config.inputDialogueTranslation = {
confirmButton = 'Confirm',
cancelButton = 'Cancel'
}
config.debug = {
enable = true,
commandName = 'hrlib_debug',
commandHelp = 'Debug command of HRLib',
args = {
type = {
name = 'functionType',
help = 'Available types: showTextUI, isTextUIOpen, hideTextUI, progressBar, alertDialogue, inputDialogue, notify'
},
secondParameter = {
name = '...',
help = 'it changes according to the chosen function type'
}
}
}
Get functions list methods
Export method
HRLib = exports.HRLib:getLibFunctions()
Import method
Add this to your fxmanifest.lua:
shared_script '@HRLib/import.lua'
Translation system
The translation system allows you to translate your scripts, more organized and optimized.
Installation
Create your own translation.lua file directly into your script's folder
Add this to your fxmanifest.lua
file 'translation.lua'
Create your own config.lua file which should provide global variable
Config
or local one and should return it at the end of the file (as import module) but it's supposed to return the config table with a fieldlanguage
if not in that way, the globalConfig
variable must have thelanguage
field in it so the translation can work properlyAdd this to your fxmanifest.lua If you choose to do it with global variable, add this:
shared_script 'config.lua'
(add it after the row with adding the import method) If you choose to do it with the local variable and return the config, add this:files { 'translation.lua', 'config.lua' }
Refresh & Restart the script
The translation is only available in import method!
Last updated