Scripting/Squirrel/Functions/ResetWeaponData: 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 "This function will reset a weapon's settings to the defaults. (damage, range, etc) == Syntax == <pre>ResetWeaponData( weaponID )</pre> == Arguments == * ''integer'' '''wea...")
(No difference)

Revision as of 12:24, 20 February 2015

This function will reset a weapon's settings to the defaults. (damage, range, etc)

Syntax

ResetWeaponData( weaponID )

Arguments

  • integer weaponID - model ID of weapon

Example

The following example will check if the data value of the weapon, from player's hand, was edited.

function onPlayerCommand( player, cmd, text );
{
     if( cmd == "resetdatawep" )
     {
          if( !text || !IsNum(text) ) MessagePlayer( "Error - Correct syntax - '/" + cmd + " <weaponID>' !", player );
          else if( text >= 1 || text <= 25 ) MessagePlayer( "Error - Weapon IDs are from 0 to 33 !", player );
          else
          {
               ResetWeaponData( text.tointeger );
               Message( "NEWS -> Weapon " + GetWeaponName( text ) + " received the default settings !" );
          }
     }
}

Notes

Call onPlayerCommand were used in this example. More info about them in the corresponding pages.

Related Functions