SetWeaponProperty: Difference between revisions
Jump to navigation
Jump to search
No edit summary |
Cazomino05 (talk | contribs) No edit summary |
||
Line 7: | Line 7: | ||
==Syntax== | ==Syntax== | ||
<syntaxhighlight lang="lua">bool success = setWeaponProperty ( int weaponID, string weaponType, string property, int theValue )</syntaxhighlight> | <syntaxhighlight lang="lua">bool success = setWeaponProperty ( int weaponID/string weaponName, string weaponType, string property/int property, int/float theValue )</syntaxhighlight> | ||
==Required Arguments== | ==Required Arguments== | ||
Line 14: | Line 14: | ||
*'''property:''' The property you want to get the value of: | *'''property:''' The property you want to get the value of: | ||
** "weapon_range" | ** "weapon_range" - float | ||
** "target_range" | ** "target_range" - float | ||
** "accuracy" | ** "accuracy" - float | ||
** "damage" | ** "damage" - int | ||
** "maximum_clip_ammo" - int | |||
** "flags" - int (specify a flag to toggle it on/off) | |||
** "move_speed" - float | |||
** "maximum_clip_ammo" | |||
** "flags" | |||
** " | |||
==Returns== | ==Returns== |
Revision as of 00:12, 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 weaponName, string weaponType, string property/int property, int/float 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" - float
- "target_range" - float
- "accuracy" - float
- "damage" - int
- "maximum_clip_ammo" - int
- "flags" - int (specify a flag to toggle it on/off)
- "move_speed" - float
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