GetWeaponState: Difference between revisions
Jump to navigation
Jump to search
m (Some minor grammar fix at →Returns) |
Fernando187 (talk | contribs) (Remove obsolete Requirements section) |
||
Line 25: | Line 25: | ||
addEventHandler("onClientResourceStart", resourceRoot, testWeaponState) | addEventHandler("onClientResourceStart", resourceRoot, testWeaponState) | ||
</syntaxhighlight> | </syntaxhighlight> | ||
==See also== | ==See also== | ||
{{Client weapon creation functions}} | {{Client weapon creation functions}} |
Latest revision as of 17:08, 7 November 2024
This function gets the state of a custom weapon.
Syntax
string getWeaponState ( weapon theWeapon )
OOP Syntax Help! I don't understand this!
- Method: weapon:getState(...)
- Variable: .state
- Counterpart: setWeaponState
Required arguments
- theWeapon: the weapon to get the state of.
Returns
- A string if the weapon is valid, indicating the weapon state, which can be:
- reloading: the weapon is reloading.
- firing: the weapon is constantly shooting (unless any shooting blocking flags are set) according to its assigned firing rate.
- ready: the weapon is idle.
- false if an error occured or the weapon is invalid.
Example
This example creates a gun where the local player is and informs any player about its state.
local function testWeaponState() local weapon = createWeapon("m4", getElementPosition(localPlayer)) -- Create the weapon outputChatBox("The weapon that has just been created state is " .. getWeaponState(weapon) .. ".") -- Tell the player its state end addEventHandler("onClientResourceStart", resourceRoot, testWeaponState)
See also
- createWeapon
- fireWeapon
- getWeaponAmmo
- getWeaponClipAmmo
- getWeaponFiringRate
- getWeaponFlags
- getWeaponOwner
- getWeaponProperty
- getWeaponState
- getWeaponTarget
- resetWeaponFiringRate
- setWeaponAmmo
- setWeaponClipAmmo
- setWeaponFiringRate
- setWeaponFlags
- setWeaponProperty
- setWeaponState
- setWeaponTarget