Scripting/Squirrel/Functions/ResetWeaponData

From Vice City Multiplayer
Revision as of 22:06, 30 January 2017 by Thijn (talk | contribs)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search
Caution icon
This wiki is using an old backup from 2020
Some information may be old/missing

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