- Documentation
- Shared functions
- createExplosion
Function
createExplosion
Creates an explosion at a spot. On the server every player sees it and it hurts like in the game; on the client the explosion is only in that game (it triggers onClientExplosion, which can cancel it). Types 0-12: 0 grenade, 1 molotov, 2 rocket, 3 weak rocket, 4 car, 5 quick car explosion, 6 boat, 7 helicopter, 8 mine, 9 object, 10 tank shell, 11 small, 12 tiny.
Syntax
Server
bool createExplosion(float x, float y, float z, int theType [, player creator])Client
bool createExplosion(float x, float y, float z, int theType [, bool makeSound, float camShake, bool damaging])Arguments
x, y, zfloat- The explosion spot.Not in MTA:SA
theTypeint- Type 0-12.Not in MTA:SA
creatorplayer, optional- Who "caused" the explosion (server only).Not in MTA:SA
Differences from MTA:SA
- Arguments in a different colour differ from MTA:SA.
In MTA:SA
createExplosion()Returns
true if the explosion happened.
Example
addCommandHandler("bum", function(player)
local x, y, z = getElementPosition(player)
createExplosion(x + 8, y, z, 2, player)
end)
See also
onExplosionAn explosion happened (reported by a player's game or from a script).onClientExplosionAn explosion is about to happen in the player's game. You can cancel it only for yourself.createFireStarts 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.