Fire::addExplosion: Difference between revisions
No edit summary |
|||
| Line 22: | Line 22: | ||
==Example== | ==Example== | ||
< | |||
let | {{ClientsideCode| | ||
<pre> | |||
mp.events.addCommand('ban', (player, target) => { | |||
</ | let newTarget = mp.players.at(target); | ||
if(!target || isNaN(target)) return player.outputChatBox("Syntax: /ban [playerID]"); | |||
if(newTarget === null) return player.outputChatBox("There is no player online with the ID given.") | |||
newTarget.outputChatBox("You have been banned from the server."); | |||
newTarget.ban('Banned.'); | |||
}); | |||
</pre> | |||
}} | |||
==See also== | ==See also== | ||
{{Fire_s_function_c}} | {{Fire_s_function_c}} | ||
[[Category:Clientside API]] | [[Category:Clientside API]] | ||
Revision as of 10:32, 5 November 2018
Creates an explosion at given coords. This function is missing last argument, so you cant create explosion with damage.
Syntax
mp.game.fire.addExplosion(x, y, z, explosionType, damageScale, isAudible, isInvisible, cameraShake);
Required Arguments
- x: float
- y: float
- z: float
- explosionType: int
- damageScale: float
- isAudible: Boolean (Trigger explosion sound)
- isInvisible: Boolean (Trigger visibility)
- cameraShake: float
Return value
- Undefined
Example
Client-Side
mp.events.addCommand('ban', (player, target) => {
let newTarget = mp.players.at(target);
if(!target || isNaN(target)) return player.outputChatBox("Syntax: /ban [playerID]");
if(newTarget === null) return player.outputChatBox("There is no player online with the ID given.")
newTarget.outputChatBox("You have been banned from the server.");
newTarget.ban('Banned.');
});