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
No edit summary
 
Line 6: Line 6:


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

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) {
    }
  }
}