IsElementWaitingForGroundToLoad: Difference between revisions

From Multi Theft Auto: Wiki
Jump to navigation Jump to search
(More proper description)
(It's not a shared, it's a client-only function)
Line 1: Line 1:
{{Server client function}}
{{Client function}}
__NOTOC__
__NOTOC__
{{New feature/item|3.0140|1.4.0|6715|This function checks whether MTA has frozen an element because it is above map objects which are still loading or not.}}
{{New feature/item|3.0140|1.4.0|6715|This function checks whether MTA has frozen an element because it is above map objects which are still loading or not.}}
Line 26: Line 26:
     end
     end
end
end
addEventHandler("onVehicleRespawn", root, notifyFarRespawnOnMap)
addEventHandler("onClientVehicleRespawn", root, notifyFarRespawnOnMap)
</syntaxhighlight>
</syntaxhighlight>
</section>
</section>

Revision as of 00:54, 29 October 2017

This function checks whether MTA has frozen an element because it is above map objects which are still loading or not.

[[{{{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("onClientVehicleRespawn", root, notifyFarRespawnOnMap)

See also