autodoc_client_functions
JO Functions > jo.utils.loadGameData() > Syntax
jo.utils.loadGameData(name, waiter)
JO Functions > jo.utils.loadGameData() > Parameters
name : string|integer
The name of the file <br> Compatible with animation dictionaries, models (hashed or string), and texture dictionaries
waiter : boolean <BadgeOptional />
If the function has to wait after the loading to be completed
JO Functions > jo.utils.loadGameData() > Example
local model = "A_C_Horse_Morgan_Bay"
jo.utils.loadGameData(model, true)
JO Functions > jo.utils.releaseGameData() > Syntax
jo.utils.releaseGameData(name)
JO Functions > jo.utils.releaseGameData() > Parameters
name : string|integer
The name of the file
JO Functions > jo.utils.releaseGameData() > Example
local model = "A_C_Horse_Morgan_Bay"
jo.utils.releaseGameData(model)
JO Functions > jo.utils.screenToWorld()
Converts screen coordinates to world coordinates using camera raycasting <br> This function casts a ray from the camera through the specified screen position and returns information about what it hits in the 3D world <br>
JO Functions > jo.utils.screenToWorld() > Syntax
jo.utils.screenToWorld(distance, flags, toIgnore, mouseX, mouseY)
JO Functions > jo.utils.screenToWorld() > Parameters
distance : number <BadgeOptional />
Maximum raycast distance in game units <br> default:
100
flags : integer <BadgeOptional />
Flags for the raycast <br> default:
1|2|8|16
toIgnore : integer <BadgeOptional />
Entity to ignore in the raycast <br> default:
PlayerPedId()
mouseX : number <BadgeOptional />
X screen coordinate normalized between 0-1 <br> default:
0.5screen center
mouseY : number <BadgeOptional />
Y screen coordinate normalized between 0-1 <br> default:
0.5screen center
JO Functions > jo.utils.screenToWorld() > Return Value
Type : boolean,vector3,vector3,integer
hit, endCoords, surfaceNormal, entityHit
JO Functions > jo.utils.screenToWorld() > Example
CreateThread(function()
local distance = 2.0
local flags = 0 -- Intersect with nothing
local toIgnore = jo.pl()
local screenX = 0.5 -- Center of the screen
local screenY = 0.5 -- Center of the screen
while true do
local hit, endCoords, surfaceNormal, entityHit = jo.utils.screenToWorld(distance, flags, toIgnore, screenX, screenY)
Wait(0)
end
end)
JO Functions > jo.utils.waiter()
A function to wait after a satisfying condition with a waiting duration <br>
JO Functions > jo.utils.waiter() > Syntax
jo.utils.waiter(cb, maxDuration, loopTimer)
JO Functions > jo.utils.waiter() > Parameters
cb : function
If the function returns
truea new timer value is waited
maxDuration : integer <BadgeOptional />
The maximum duration the function will wait <br> default: 1000
loopTimer : integer <BadgeOptional />
The delay between tests of cb function in ms <br> default: 0
JO Functions > jo.utils.waiter() > Return Value
Type : boolean
Returns
trueif the function is satisfied,falseif the waiter was killed by the maxDuration value
JO Functions > jo.utils.waiter() > Example
local value = 0
local cb = function()
value = math.random(1, 10)
return value == 5
end
local maxDuration = 2000
local timer = 10
local startWait = GetGamerTimer()
print
killer = jo.utils.waiter(cb, maxDuration, timer)
print("Killer: ", killer, "Value: ", value, "Duration: ", GetGamerTimer() - startWait)
-- Expected output: Killer: true, Value : 5, Duration: (duration < 2000)
--OR
-- Expected output: Killer: false, Value : (<> 5), Duration: 2000