Scripting/Squirrel/Functions/ResetWeaponData

From Vice City Multiplayer [MIRROR]
Jump to: navigation, search

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. <source lang=squirrel> 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 !" );
         }
    }

} </source>

Notes

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

Related Functions