createExplosion
Client-side
Server-side
Shared
Creates an explosion of a certain type at a specified point in the world. If creator is specified, the explosion will occur only in its dimension.
Client Syntax
bool createExplosion ( float x, float y, float z, int theType, [ bool makeSound = true, float camShake = -1.0, bool damaging = true ] )Required arguments
- x: A float value that specifies the X world coordinate where the explosion is created at.
- y: A float value that specifies the Y world coordinate where the explosion is created at.
- z: A float value that specifies the Z world coordinate where the explosion is created at.
- theType: An integer specifying the explosion type, see: Explosion types.
Optional arguments
Note: when using optional arguments, you might need to supply all arguments before the one you wish to use.
- makeSound (default: true): A boolean specifying whether the explosion should be heard or not.
- camShake (default: -1.0): A float specifying the camera shake's intensity.
- damaging (default: true): A boolean specifying whether the explosion should cause damage or not.
Returns
Return true if the explosion was created. false if invalid parameters were passed.
- bool: result
Server Syntax
bool createExplosion ( float x, float y, float z, int theType, [ player creator = nil ] )Required arguments
- x: A float value that specifies the X world coordinate where the explosion is created at.
- y: A float value that specifies the Y world coordinate where the explosion is created at.
- z: A float value that specifies the Z world coordinate where the explosion is created at.
- theType: An integer specifying the explosion type, see: Explosion types.
Optional arguments
Note: when using optional arguments, you might need to supply all arguments before the one you wish to use.
- creator (default: nil): The explosion's simulated creator, the player responsible for it.
Returns
Return true if the explosion was created. false if invalid parameters were passed.
- bool: result
Code Examples
client
This code will create an explosion for the local player when they spawn.
function explosionOnSpawn() -- get the spawned player's position local pX, pY, pZ = getElementPosition(source) -- and create an explosion there createExplosion(pX, pY, pZ, 6)end-- add this function as a handler for any player that spawnsaddEventHandler("onClientPlayerSpawn", localPlayer, explosionOnSpawn)