CreateExplosion: Difference between revisions
Jump to navigation
Jump to search
(Updated example for a11 scripts) |
|||
Line 18: | Line 18: | ||
This code will create an explosion at the player's position when they spawn. | This code will create an explosion at the player's position when they spawn. | ||
<syntaxhighlight lang="lua">root = getRootElement () | <syntaxhighlight lang="lua">root = getRootElement () | ||
addEventHandler ( "onPlayerSpawn", root, "onPlayerSpawn" ) | |||
function onPlayerSpawn ( spawnpoint ) | |||
createExplosion ( getElementPosition ( source ), 6, source ) | |||
end</syntaxhighlight> | |||
<syntaxhighlight lang="lua" lua n>root = getRootElement () | |||
addEventHandler ( "onPlayerSpawn", root, "onPlayerSpawn" ) | addEventHandler ( "onPlayerSpawn", root, "onPlayerSpawn" ) | ||
function onPlayerSpawn ( spawnpoint ) | function onPlayerSpawn ( spawnpoint ) |
Revision as of 10:33, 21 March 2007
Creates an explosion of a certain type at a specified point in the world.
Syntax
createExplosion ( float x, float y, float z, int type, [ player creator ] )
Required Arguments
- x: A float value that specifies the X coordinate where the object is spawned at in the world
- y: A float value that specifies the Y coordinate where the object is spawned at in the world
- z: A float value that specifies the Z coordinate where the object is spawned at in the world
- type: A integer specifying the explosion type. Valid types are:
- 0: Grenade
- 1: Molotov
- 2: Rocket
- 3: Rocket Weak
- 4: Car
- 5: Car Quick
- 6: Boat
- 7: Heli
- 8: Mine
- 9: Object
- 10: Tank Grenade
- 11: Small
- 12: Tiny
Optional Arguments
- creator: The explosion's simulated creator, responsible for it.
Example
This code will create an explosion at the player's position when they spawn.
root = getRootElement () addEventHandler ( "onPlayerSpawn", root, "onPlayerSpawn" ) function onPlayerSpawn ( spawnpoint ) createExplosion ( getElementPosition ( source ), 6, source ) end
root = getRootElement () addEventHandler ( "onPlayerSpawn", root, "onPlayerSpawn" ) function onPlayerSpawn ( spawnpoint ) createExplosion ( getElementPosition ( source ), 6, source ) end
See Also