CreateFire: Difference between revisions

From Multi Theft Auto: Wiki
Jump to navigation Jump to search
No edit summary
Line 18: Line 18:
== Example ==
== Example ==


<section name="Client" class="client" show="true">
This example adds a /fire command, which creates a patch of fire in the position of the player that types it.
This example adds a /fire command, which creates a patch of fire in the position of the player that types it.


Line 33: Line 32:
addCommandHandler("fire", burn)
addCommandHandler("fire", burn)
</syntaxhighlight>
</syntaxhighlight>
</section>


==See Also==
==See Also==
{{Client fire functions}}
{{Client fire functions}}

Revision as of 10:32, 17 May 2014

Creates a patch of fire that will spread a bit and die out after a while. Because it's a client side only function, other players won't see it, so custom events or custom objects will be needed to make a fire visible to some players.

Syntax

bool createFire ( float x, float y, float z [, float size = 1.8 ] )

Required Arguments

  • x, y, z: the coordinates when the initial patch of fire will be created.

Optional Arguments

  • size: a float value indicating the size of the initial patch of fire. It will also make the fire to stay alive more or less time.

Returns

Returns true if successful, false if bad arguments were passed or the limit of active fires was reached. There can be a maximum of 60 active fires.

Example

This example adds a /fire command, which creates a patch of fire in the position of the player that types it.

function burn(commandName, theSize)
   if theSize then
        local x, y, z = getElementPosition(getLocalPlayer())
        createFire(x, y, z, theSize)
        outputChatBox("Burn, buuuuurn >:]")
   else
        outputChatBox("Syntax: /fire <size>")
   end
end
addCommandHandler("fire", burn)

See Also