Scripting/Squirrel/Functions/Player.RemoveWeapon: Difference between revisions

From Vice City Multiplayer
Jump to navigation Jump to search
Caution icon
This wiki is using an old backup from 2020
Some information may be old/missing
(Created page with "==Usage== Removes a weapon from the player's inventory. ==Syntax== <code> player.RemoveWeapon(WEAPON_ID)</code> ==Example== <code>function onPlayerCommand( player, cmd, te...")
 
 
(3 intermediate revisions by one other user not shown)
Line 1: Line 1:
==Usage==
==Usage==
Removes a weapon from the player's inventory.
Removes a weapon from the player's inventory. Returns void.


==Syntax==
==Syntax==
<code> player.RemoveWeapon(WEAPON_ID)</code>
<code> player.RemoveWeapon(int WEAPON_ID)</code>


==Example==
==Example==
 
<source lang=squirrel>
 
function onPlayerCommand(player, cmd, text) {
<code>function onPlayerCommand( player, cmd, text )
  if (cmd == "remweps") {
{
    try {
if (cmd == "remweps")
      for (local i = 0; i < 9; ++i) {
{
        player.RemoveWeapon(i);
  try
      }
  {
    }
  for (local i = 0 ; i <200 ; i++)
    catch(e) {
  {
    }
    player.RemoveWeapon(i);
  }
  }
  catch(e)
  {
   }
   }
}
}
}</code>
</source>

Latest revision as of 10:49, 26 April 2019

Usage

Removes a weapon from the player's inventory. Returns void.

Syntax

player.RemoveWeapon(int WEAPON_ID)

Example

function onPlayerCommand(player, cmd, text) {
  if (cmd == "remweps") {
    try {
      for (local i = 0; i < 9; ++i) {
        player.RemoveWeapon(i);
      }
    }
    catch(e) {
    }
  }
}