SetWeaponProperty: Difference between revisions

From Multi Theft Auto: Wiki
Jump to navigation Jump to search
mNo edit summary
No edit summary
Line 4: Line 4:


==Syntax==
==Syntax==
<syntaxhighlight lang="lua">bool setWeaponProperty ( int weaponID/string weaponName, string weaponType, string property/int property, int/float theValue )</syntaxhighlight>
<syntaxhighlight lang="lua">bool setWeaponProperty ( int weaponID/string weaponName, string weaponSkill, string property/int property, int/float theValue )</syntaxhighlight>


==Required Arguments==
==Required Arguments==
*'''weaponID:''' The ID of the [[Weapons|weapon]] you want to set a property of
*'''weaponID:''' The ID of the [[Weapons|weapon]] you want to set a property of
*'''weaponType:''' Either: "pro", "std" or "poor"
{{Weapon Types}}
*'''weaponSkill:''' Either: "pro", "std" or "poor"
*'''property:''' The property you want to set the value of:
*'''property:''' The property you want to set the value of:
** "weapon_range" - float
** "weapon_range" - float

Revision as of 06:10, 28 February 2012

This function sets the weapon property of the specified weapons specified weapon type.

Syntax

bool setWeaponProperty ( int weaponID/string weaponName, string weaponSkill, string property/int property, int/float theValue )

Required Arguments

  • weaponID: The ID of the weapon you want to set a property of

Template:Weapon Types

  • weaponSkill: Either: "pro", "std" or "poor"
  • property: The property you want to set the value of:
    • "weapon_range" - float
    • "target_range" - float
    • "accuracy" - float
    • "damage" - int
    • "maximum_clip_ammo" - int
    • "move_speed" - float
    • "flags" - int (specify a flag to toggle it on/off) See Weapon Flags
    • "anim_loop_start" - float
    • "anim_loop_stop" - float
    • "anim_loop_bullet_fire" - float
    • "anim2_loop_start" - float
    • "anim2_loop_stop" - float
    • "anim2_loop_bullet_fire" - float
    • "anim_breakout_time" - float
  • theValue: The value to set the property to.

Returns

On success:

bool: Returns true if the weapon property was successfully set

On failure:

bool: Returns false if the weapon property was unable to be set

Example

This example sets the weapon range of the M4 at poor skill level to 75

local rangeSet = setWeaponProperty(31, "poor", "weapon_range", 75)
if (rangeSet) then
    outputChatBox("M4 range at poor skill is set now 75!")
end

This example makes the silenced pistol dual wielded at pro skill level

setWeaponProperty(23, "pro", "flags", 0x000800)
setWeaponProperty(23, "pro", "flags", 0x000002)
setWeaponProperty(23, "pro", "maximum_clip_ammo", 34)

This examples doubles the range of the colt 45 hand gun

setWeaponProperty(22, "poor", "weapon_range", 70)
setWeaponProperty(22, "std", "weapon_range", 70)
setWeaponProperty(22, "pro", "weapon_range", 70)

This example makes the minigun able to fire all its ammo without the short reload time

setWeaponProperty("minigun", "pro", "maximum_clip_ammo", 1000)

Requirements

This template will be deleted.

See Also