Scripting/Squirrel/Functions/IsWeaponDataModified

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

This function will check a weapon for changed data values. (damage, range, etc)

Syntax

IsWeaponDataModified( weaponID , fieldID )

Arguments

  • integer weaponID - model ID of weapon
  • integer fieldID - field ID of data you want to check for edits ( WeaponDataValue )

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 == "checkmywepdata" )
     {
          if( !text || !IsNum(text) ) MessagePlayer( "Error - Correct syntax - '/checkmywepdata <fieldID>' !", player );
          else if( text >= 1 || text <= 25 ) MessagePlayer( "Error - Field IDs are from 1 to 25 !", player );
          else
          {
               if( IsWeaponDataModified( player.Weapon.ID, text.tointeger() ) == true )
                    MessagePlayer( "Yes, data " + text + " of " + GetWeaponName( player.Weapon.ID ) + "is edited !!", player );
               else 
                    MessagePlayer( "Nope, data " + text + " of " + GetWeaponName( player.Weapon.ID ) + " is not edited.", player );

               MessagePlayer( "Data" + text + " of " + GetWeaponName( player.Weapon.ID ) + " is " + GetWeaponDataValue( player.Weapon.ID, text.tointeger() ) );
          }
     }
}

Notes

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

Related Functions