IsElementWaitingForGroundToLoad: Difference between revisions

From Multi Theft Auto: Wiki
Jump to navigation Jump to search
No edit summary
Line 1: Line 1:
{{Needs_Checking|Example is wrong? --[[User:MrTasty|MrTasty]] ([[User talk:MrTasty|talk]]) 18:45, 7 August 2014 (UTC)}}
{{Server client function}}
{{Server client function}}
__NOTOC__
__NOTOC__
Line 16: Line 17:


==Example==
==Example==
<section name="Server" class="server" show="true">
<section name="Serverside example" class="server" show="true">
The next code snippet outputs a message when a vehicle respawns far away from players.
The next code snippet outputs a message when a vehicle respawns far away from players.



Revision as of 18:45, 7 August 2014

Dialog-information.png This article needs checking.

Reason(s): Example is wrong? --MrTasty (talk) 18:45, 7 August 2014 (UTC)

This function checks if an element is frozen (unable to move without scripting) waiting until a client loads collisions of the area it is in. This allows MTA to automatically freeze vehicles when nobody is near them so they don't fall through the map, for example.

[[{{{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 )

Required arguments

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

Returns

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

Example

Click to collapse [-]
Serverside example

The next code snippet outputs a message when a vehicle respawns far away from players.

function notifyFarRespawn()
    outputChatBox("* A " .. getVehicleName(source) .. " respawned far away! Find it quick!", root, 128, 255, 0)
end
addEventHandler("onVehicleRespawn", root, notifyFarRespawn)

See also