EnginePreloadWorldArea: Difference between revisions

From Multi Theft Auto: Wiki
Jump to navigation Jump to search
(Created page with "{{Client function}} __NOTOC__ This function allows a specific area to be loaded '''immediately''', which can be useful when teleporting a player. The function is not based on a radius, but a specific zone is loaded. ==Syntax== <syntaxhighlight lang="lua"> bool enginePreloadWorldArea(float x, float y, float z [, string loadingOption = "all" ] ) </syntaxhighlight> ===Required Arguments=== *'''x:''' Position in the X axis. *'''y:''' Position in the Y axis *'''z:''' Pos...")
 
mNo edit summary
Line 1: Line 1:
{{Client function}}
{{Client function}}
__NOTOC__
__NOTOC__
This function allows a specific area to be loaded '''immediately''', which can be useful when teleporting a player. The function is not based on a radius, but a specific zone is loaded.
{{New feature/item|3.0161|1.6.0|22678|This function allows a specific area to be loaded '''immediately''', which can be useful when teleporting a player. The function is not based on a radius, but a specific zone is loaded.}}


==Syntax==  
==Syntax==  

Revision as of 19:37, 18 August 2024

ADDED/UPDATED IN VERSION 1.6.0 r22678:
This function allows a specific area to be loaded immediately, which can be useful when teleporting a player. The function is not based on a radius, but a specific zone is loaded.

Syntax

bool enginePreloadWorldArea(float x, float y, float z [, string loadingOption = "all" ] )

Required Arguments

  • x: Position in the X axis.
  • y: Position in the Y axis
  • z: Position in the z axis.

Optional Arguments

NOTE: When using optional arguments, you might need to supply all arguments before the one you wish to use. For more information on optional arguments, see optional arguments.

  • loadingOption: Argument of what exactly is to be loaded. Possible values:
  • all - Loads models and collisions in a designated area.
  • models - Only loads models in the designated area.
  • collisions - Loads only collisions in the designated area.

Returns

Always returns true.

Example

enginePreloadWorldArea(1000, 500, 0)   

local z = getGroundPosition(1000, 500, 100)   
setElementPosition(localPlayer, 1000, 500, z)
enginePreloadWorldArea(1000, 500, 0, "collisions")   
local z = getGroundPosition(1000, 500, 100)   

iprint("The ground position is: "..z)

See Also