Player::removeAllWeapons: Difference between revisions

From RAGE Multiplayer Wiki
(Created page)
 
m (Replaced HTML with template)
 
Line 3: Line 3:
== Syntax ==
== Syntax ==


<syntaxhighlight lang="javascript">
<pre>
player.removeAllWeapons();
player.removeAllWeapons();
</syntaxhighlight>
</pre>


== Examples ==
== Examples ==
Uses /removeweapons to remove all weapons from a player. Use /weapons to give yourself weapons to test this out.
Uses /removeweapons to remove all weapons from a player. Use /weapons to give yourself weapons to test this out.


<div class="header" style="background-color: #408DAE; color: #FFFFFF; border: 2px solid #408DAE;">
{{ServersideCode|
<div style="margin: 10px 10px 10px 10px;"><b>Server-Side</b></div>
<pre>
<syntaxhighlight lang="javascript">
mp.events.addCommand('weapons', (player) => {
mp.events.addCommand('weapons', (player) => {
     player.giveWeapon(mp.joaat('weapon_pumpshotgun'), 100);
     player.giveWeapon(mp.joaat('weapon_pumpshotgun'), 100);
Line 22: Line 21:
     player.outputChatBox(`You have taken off all your weapons.`);
     player.outputChatBox(`You have taken off all your weapons.`);
});
});
</syntaxhighlight>
</pre>
</div>
}}


== See Also ==
== See Also ==
{{Player_block}}
{{Player_block}}

Latest revision as of 12:35, 26 October 2018

Removes all weapons from the player

Syntax

player.removeAllWeapons();

Examples

Uses /removeweapons to remove all weapons from a player. Use /weapons to give yourself weapons to test this out.

Server-Side
mp.events.addCommand('weapons', (player) => {
    player.giveWeapon(mp.joaat('weapon_pumpshotgun'), 100);
    player.giveWeapon(mp.joaat('weapon_microsmg'), 1000);
});

mp.events.addCommand('removeweapons', (player) => {
    player.removeAllWeapons();
    player.outputChatBox(`You have taken off all your weapons.`);
});

See Also