IsElementInWater: Difference between revisions

From Multi Theft Auto: Wiki
Jump to navigation Jump to search
m (Dedicated to Talidan. <3)
Line 19: Line 19:
<syntaxhighlight lang="lua">
<syntaxhighlight lang="lua">


function waterCheck(player)
function waterCheck(thePlayer)
     if isElementInWater(player) then
     if isElementInWater(thePlayer) then
         outputChatBox("Wet.", player)
         outputChatBox("Wet.", thePlayer)
     else
     else
         outputChatBox("Dry.", player)
         outputChatBox("Dry.", thePlayer)
     end
     end
end
end

Revision as of 12:15, 23 May 2009

This function checks whether an element is submerged in water.

Syntax

Click to collapse [-]
Server and client
bool isElementInWater ( element theElement )

Required Arguments

  • theElement: The element to check.

Returns

Returns true if the passed element is in water, false if it isn't, or if the element is invalid.

Example

Creates a command that checks if the player is in water or not.

Click to collapse [-]
Server

function waterCheck(thePlayer)
    if isElementInWater(thePlayer) then
        outputChatBox("Wet.", thePlayer)
    else
        outputChatBox("Dry.", thePlayer)
    end
end

addCommandHandler("check", waterCheck)

See Also