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


{{Scripting/Squirrel/Functions/Weapon Functions}}
{{Scripting/Squirrel/Functions/Weapon Functions}}
[[Category:Scripting/Squirrel/Functions/Weapon_Functions]]

Latest revision as of 22:06, 30 January 2017

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