SetWeaponProperty: Difference between revisions
Jump to navigation
Jump to search
No edit summary |
No edit summary |
||
Line 4: | Line 4: | ||
Only available in MTA:SA v1.2 and onwards. | Only available in MTA:SA v1.2 and onwards. | ||
}} | }} | ||
This function sets the weapon property of the specified weapons specified weapon type. | |||
==Syntax== | ==Syntax== | ||
<syntaxhighlight lang="lua">int | <syntaxhighlight lang="lua">bool success = setWeaponProperty ( int weaponID, string weaponType, string property, int theValue )</syntaxhighlight> | ||
==Required Arguments== | ==Required Arguments== | ||
*''' | *'''weaponID:''' The ID of the weapon you want to get info of see [[Weapons]] | ||
*''' | *'''weaponType:''' Either: "pro", "std" or "poor" | ||
*'''property:''' The property you want to get the value of: | |||
** "weapon_range" | |||
** "target_range" | |||
** "accuracy" | |||
** "damage" | |||
** "life_span" // Disabled for release | |||
** "firing_speed" // Disabled for release | |||
** "spread" // Disabled for release | |||
** "maximum_clip_ammo" ) | |||
** "move_speed" ) | |||
** "flags" ) | |||
** "anim_group" ) // Disabled for release | |||
** // Set is Disabled >= FIRETYPE - Move above WEAPON_TYPE_SET_DISABLED to re-enable and move it above here to make it less confusing. | |||
** "fire_type" | |||
** "model" | |||
** "model2" | |||
** "weapon_slot" | |||
** "fire_offset" | |||
** "skill_level" | |||
** "required_skill_level" | |||
** "anim_loop_start" | |||
** "anim_loop_stop" | |||
** "anim_loop_bullet_fire" | |||
** "anim2_loop_start" | |||
** "anim2_loop_stop" | |||
** "anim2_loop_bullet_fire" | |||
** "anim_breakout_time" | |||
** "radius" | |||
** "aim_offset" | |||
** "default_combo" | |||
** "combos_available" | |||
==Returns== | ==Returns== | ||
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== | ==Example== | ||
<syntaxhighlight lang="lua"> | This example sets the weapon range of the M4 at poor skill level to 75 | ||
<syntaxhighlight lang="lua"> | |||
outputChatBox ( " | local rangeSet = getWeaponProperty(31, "poor", "weapon_range", 75) | ||
if (rangeSet) then | |||
outputChatBox("M4 range at poor skill is set now 75!") | |||
end | |||
</syntaxhighlight> | |||
==See Also== | ==See Also== | ||
{{ | {{Weapon functions}} |
Revision as of 00:04, 17 November 2011
Only available in MTA:SA v1.2 and onwards. This function sets the weapon property of the specified weapons specified weapon type.
Syntax
bool success = setWeaponProperty ( int weaponID, string weaponType, string property, int theValue )
Required Arguments
- weaponID: The ID of the weapon you want to get info of see Weapons
- weaponType: Either: "pro", "std" or "poor"
- property: The property you want to get the value of:
- "weapon_range"
- "target_range"
- "accuracy"
- "damage"
- "life_span" // Disabled for release
- "firing_speed" // Disabled for release
- "spread" // Disabled for release
- "maximum_clip_ammo" )
- "move_speed" )
- "flags" )
- "anim_group" ) // Disabled for release
- // Set is Disabled >= FIRETYPE - Move above WEAPON_TYPE_SET_DISABLED to re-enable and move it above here to make it less confusing.
- "fire_type"
- "model"
- "model2"
- "weapon_slot"
- "fire_offset"
- "skill_level"
- "required_skill_level"
- "anim_loop_start"
- "anim_loop_stop"
- "anim_loop_bullet_fire"
- "anim2_loop_start"
- "anim2_loop_stop"
- "anim2_loop_bullet_fire"
- "anim_breakout_time"
- "radius"
- "aim_offset"
- "default_combo"
- "combos_available"
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 = getWeaponProperty(31, "poor", "weapon_range", 75) if (rangeSet) then outputChatBox("M4 range at poor skill is set now 75!") end
See Also
- getWeaponProperty
- getPickupWeapon
- getOriginalWeaponProperty
- getSlotFromWeapon
- getWeaponIDFromName
- getWeaponNameFromID
- setWeaponAmmo
- setWeaponProperty