IsElementWaitingForGroundToLoad: Difference between revisions

From Multi Theft Auto: Wiki
Jump to navigation Jump to search
m (Improved a bit the page)
(Added OOP syntax introduced in r6987)
Line 8: Line 8:
bool isElementWaitingForGroundToLoad ( element theElement )
bool isElementWaitingForGroundToLoad ( element theElement )
</syntaxhighlight>
</syntaxhighlight>
{{New feature/item|3.0141|1.4.0|6987|{{OOP||[[element]]:isWaitingForGroundToLoad|waitingForGroundToLoad}}}}


===Required arguments===
===Required arguments===
Line 20: Line 21:


<syntaxhighlight lang="lua">
<syntaxhighlight lang="lua">
function notifyFarRespawnOnMap()
local function notifyFarRespawnOnMap()
     if isElementWaitingForGroundToLoad(source) then
     if isElementWaitingForGroundToLoad(source) then
         outputChatBox("* A " .. getVehicleName(source) .. " respawned above an object which is far away! Find it quick!", root, 128, 255, 0)
         outputChatBox("* A " .. getVehicleName(source) .. " respawned above an object which is far away! Find it quick!", root, 128, 255, 0)

Revision as of 14:01, 31 December 2014

This function returns true if MTA has frozen the element because it is above map objects which are still loading.

[[{{{image}}}|link=|]] Note: When vehicles are frozen waiting for collisions to load they do not overwrite the frozen status set by setElementFrozen.

Syntax

bool isElementWaitingForGroundToLoad ( element theElement )

OOP Syntax Help! I don't understand this!

Method: element:isWaitingForGroundToLoad(...)
Variable: .waitingForGroundToLoad

Required arguments

  • theElement: the element to check its frozen waiting for custom map objects to load status. It can be a vehicle, ped or player.

Returns

Returns true if the specified element is frozen waiting for collisions of custom map objects to load. Returns false if it's not or if the specified element is invalid.

Example

Click to collapse [-]
Serverside example

The next code snippet outputs a message when a vehicle respawns far away from players, above an object.

local function notifyFarRespawnOnMap()
    if isElementWaitingForGroundToLoad(source) then
        outputChatBox("* A " .. getVehicleName(source) .. " respawned above an object which is far away! Find it quick!", root, 128, 255, 0)
    end
end
addEventHandler("onVehicleRespawn", root, notifyFarRespawnOnMap)

See also