ServersYour serverFor creatorsForumFAQDocumentationSecurity
Download the launcher
  1. Documentation
  2. Shared functions
  3. 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