SetWeaponState: Difference between revisions

From Multi Theft Auto: Wiki
Jump to navigation Jump to search
(Added OOP syntax and Needs Example template)
mNo edit summary
Line 2: Line 2:
{{Client function}}
{{Client function}}
{{Needs_Example}}
{{Needs_Example}}
This function sets a custom weapons state.
This function sets a [[Element/Weapon|custom weapon]]'s state.


==Syntax==
==Syntax==
<syntaxhighlight lang="lua">bool setWeaponState ( weapon theWeapon, string theState )</syntaxhighlight>
<syntaxhighlight lang="lua">bool setWeaponState ( weapon theWeapon, string theState )</syntaxhighlight>
{{OOP||[[Element/Weapon|weapon]]:setState|state|getWeaponState}}


===Required Arguments===
===Required Arguments===
* '''theWeapon:''' the weapon you wish to change the state of
* '''theWeapon''': the weapon you wish to set the state of.
* '''theState:''' the state you wish to set:
* '''theState''': the state you wish to set:
** '''reloading''': make the weapon reload.
** '''reloading''': makes the weapon reload.
** '''firing''': make the weapon constantly fire its target (unless any shooting blocking flags are set) according to its assigned firing rate.
** '''firing''': makes 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.
** '''ready''': makes the weapon stop reloading or firing.


===Returns===
===Returns===

Revision as of 17:49, 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 weapon's state.

Syntax

bool setWeaponState ( weapon theWeapon, string theState )

OOP Syntax Help! I don't understand this!

Method: weapon:setState(...)
Variable: .state
Counterpart: getWeaponState


Required Arguments

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

Returns

Returns true on success, false otherwise.

Requirements

This template will be deleted.

See also