Game Utils
Utilities are support functions to improve mission creation, make it simpler and easier.
Util.CustomThread()
This function allows you to create Loop Threads that work with the system, that is, if the mission ends, these Threads will die with the game. (Using Citizen Threads will cause them to run forever unless you use methods to stop them)
timer:
number
(in milliseconds)onTick:
function
condition:
function
Example
Sumary: This example checks the player's health every one second while the condition is true.
The onTick function allows you to execute code inside the Thread to do validations, countdowns, calculate game time, etc.
Util.SecondsToClock()
This function returns a HH:MM:SS format based on the number of seconds delivered.
seconds:
number
Example
Util.NotifyDown()
This function allows us to display a text on the screen (such as game subtitles). It is not an obligation to call it from a Thread, since a text can be displayed for every second or more.
Util.CreateMarker()
This function allows you to create a game marker and with a helper function to see the distance of the player to the marker. (Must be created in a loop function)
Util.CreateMultipleMarkers()
This function is the same as CreateMarker, but the difference is that you can create multiple markers at once. (Think of a resource where you have to go mining and many mining points appear)
Util.DrawScreenText()
This function allows you to draw text on the screen at a selected position. (Requires a loop function)
Util.Draw3dText()
This function allows to write text in 3d (Requires a loop function)
Util.PlaySound()
This function allows us to play sounds from the Frontend of the game.
Util.CreateThinking()
This function makes a box (as a thought) appear above the player or some entity (ped)
Util.LoadAnimDicts()
This function allows us to load animation dictionaries (it's just one more load function)
Last updated
Was this helpful?