Scripting/Squirrel/Functions/IsWeaponDataModified: 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 check a weapon for changed data values. (damage, range, etc) == Syntax == <pre>IsWeaponDataModified( weaponID , fieldID )</pre> == Arguments == * ''inte...")
 
mNo edit summary
Line 22: Line 22:
           {
           {
               if( IsWeaponDataModified( player.Weapon.ID, text.tointeger() ) == true )
               if( IsWeaponDataModified( player.Weapon.ID, text.tointeger() ) == true )
                     MessagePlayer( "Yes, Data value of field " + text + " of " + GetWeaponName( player.Weapon.ID ) + "is edited !!", player );
                     MessagePlayer( "Yes, data " + text + " of " + GetWeaponName( player.Weapon.ID ) + "is edited !!", player );
               else  
               else  
                     MessagePlayer( "Nope, data value of field " + text + " of " + GetWeaponName( player.Weapon.ID ) + " is not edited.", player );
                     MessagePlayer( "Nope, data " + text + " of " + GetWeaponName( player.Weapon.ID ) + " is not edited.", player );


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

Revision as of 12:12, 20 February 2015

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