setWeaponState
Client-side
Server-side
Shared
Pair: getWeaponState
Manual Review Required
Please finish this page using the corresponding Old Wiki article. Go to Contribution guidelines for more information.
This function sets a custom weapon's state.
OOP Syntax Help! I don't understand this!
- Method: weapon:setState(...)
- Variable: .state
Syntax
bool setWeaponState ( weapon theWeapon, string theState )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
- bool: value
Returns true on success, false otherwise.
Code Examples
shared
addEventHandler("onClientResourceStart", resourceRoot, function() local wep = createWeapon("m4", 0, 0, 4) setWeaponState(wep, "firing") end)