Scripting/Squirrel/Functions/IsWeaponDataModified
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 value of field " + text + " of " + GetWeaponName( player.Weapon.ID ) + "is edited !!", player );
else
MessagePlayer( "Nope, data value of field " + 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() ) );
}
}
}
Notes
Call onPlayerCommand were used in this example. More info about them in the corresponding pages.