SetWeaponState: Difference between revisions

From Multi Theft Auto: Wiki
Jump to navigation Jump to search
No edit summary
(Added OOP syntax and Needs Example template)
Line 1: Line 1:
__NOTOC__
__NOTOC__
{{Client function}}
{{Client function}}
Sets a custom weapons state.
{{Needs_Example}}
This function sets a custom weapons state.


==Syntax==
==Syntax==
Line 9: Line 10:
* '''theWeapon:''' the weapon you wish to change the state of
* '''theWeapon:''' the weapon you wish to change the state of
* '''theState:''' the state you wish to set:
* '''theState:''' the state you wish to set:
** "reloading" - the weapon is reloading
** '''reloading''': make the weapon reload.
** "firing" - the weapon will constantly fire ( unless any shooting blocking flags are set ) according to its assigned firing rate
** '''firing''': make the weapon constantly fire its target (unless any shooting blocking flags are set) according to its assigned firing rate.
** "ready" - the weapon is idle
** '''ready''': make the weapon stop reloading or firing.


===Returns===
===Returns===
Line 19: Line 20:
{{Requirements|n/a|1.3.0-9.04555|}}
{{Requirements|n/a|1.3.0-9.04555|}}


==See Also==
==See also==
{{Client weapon creation functions}}
{{Client weapon creation functions}}

Revision as of 16:54, 23 December 2014

Accessories-text-editor.png Script Example Missing Function SetWeaponState needs a script example, help out by writing one.

Before submitting check out Editing Guidelines Script Examples.

This function sets a custom weapons state.

Syntax

bool setWeaponState ( weapon theWeapon, string theState )

Required Arguments

  • theWeapon: the weapon you wish to change the state of
  • theState: the state you wish to set:
    • reloading: make the weapon reload.
    • firing: make the weapon constantly fire its target (unless any shooting blocking flags are set) according to its assigned firing rate.
    • ready: make the weapon stop reloading or firing.

Returns

Returns true on success, false otherwise.

Requirements

Minimum server version n/a
Minimum client version 1.3.0-9.04555

Note: Using this feature requires the resource to have the above minimum version declared in the meta.xml <min_mta_version> section. e.g. <min_mta_version client="1.3.0-9.04555" />

See also