- Documentation
- Shared functions
- createFire
Function
createFire
Starts a fire. On the server every player sees it, including players who join later, and the function returns the fire's number. On the client the fire burns only in that one game.
Syntax
Server
createFire(x, y, z [, size = 2, duration = 0, dimension = 0])Client
createFire(x, y, z [, size = 1.8])Arguments
xfloat- X position.
yfloat- Y position.
zfloat- Z position.
sizefloat, optional = 2- Size from 1 to 5 (1.8 by default on the client).
durationint, optional = 0- Server only: burn time in ms, 0 = until put out.Not in MTA:SA
dimensionint, optional = 0- Server only: dimension.Not in MTA:SA
Differences from MTA:SA
- In MTA:SA this function is client-side only.
- Arguments in a different colour differ from MTA:SA.
In MTA:SA
createFire(float x, float y, float z, float size = 1.8)Returns
Server: the fire number or false (e.g. when the fire limit is reached). Client: true or false.
Example
A campfire for 30 seconds where the player stands.
addCommandHandler("ognisko", function(player)
local x, y, z = getElementPosition(player)
local id = createFire(x + 2, y, z - 0.5, 2, 30000)
if id then
outputChatBox("Rozpalono ogień nr " .. id, player)
end
end)
See also
extinguishFirePuts out fire. On the server it does so for everyone: by fire number, all fires within a radius of a point, or all at once (no arguments). On the client it only puts out locally started fires.isFireBurningChecks whether the fire with the given number is still burning.onFireCreateA fire was created (by a script or in the game).