GetWeaponFiringRate: Difference between revisions
Jump to navigation
Jump to search
(Created page with "__NOTOC__ {{Client function}} Gets the firing rate to be used when you set the custom weapon to the firing state. ==Syntax== <syntaxhighlight lang="lua">int getWeaponFiringRate ( weapon theWeapo...") |
Fernando187 (talk | contribs) (Remove obsolete Requirements section) |
||
(7 intermediate revisions by 6 users not shown) | |||
Line 1: | Line 1: | ||
__NOTOC__ | __NOTOC__ | ||
{{Client function}} | {{Client function}} | ||
This gets the firing rate to be used when a [[Element/Weapon|custom weapon]] opens fire. | |||
==Syntax== | ==Syntax== | ||
<syntaxhighlight lang="lua">int getWeaponFiringRate ( weapon theWeapon )</syntaxhighlight> | <syntaxhighlight lang="lua">int getWeaponFiringRate ( weapon theWeapon )</syntaxhighlight> | ||
{{OOP||[[Element/Weapon|weapon]]:getFiringRate|firingRate|setWeaponFiringRate}} | |||
===Required Arguments=== | ===Required Arguments=== | ||
Line 12: | Line 13: | ||
Returns an ''integer'' with the firing rate of the custom weapon, ''false'' otherwise. | Returns an ''integer'' with the firing rate of the custom weapon, ''false'' otherwise. | ||
== | ==Example== | ||
This example creates a minigun at the center of the map and creates a ''/firerate'' command that outputs its firerate to the player who types it. | |||
<syntaxhighlight lang="lua"> | |||
local weapon = createWeapon("minigun", 0, 0, 3) | |||
==See | function outputMinigunFireRate() | ||
{{Client weapon functions}} | outputChatBox("Fire rate: " .. getWeaponFiringRate(weapon)) | ||
end | |||
addCommandHandler("firerate", outputMinigunFireRate) | |||
</syntaxhighlight> | |||
==See also== | |||
{{Client weapon creation functions}} |
Latest revision as of 17:06, 7 November 2024
This gets the firing rate to be used when a custom weapon opens fire.
Syntax
int getWeaponFiringRate ( weapon theWeapon )
OOP Syntax Help! I don't understand this!
- Method: weapon:getFiringRate(...)
- Variable: .firingRate
- Counterpart: setWeaponFiringRate
Required Arguments
- theWeapon: The weapon to modify the firing rate of.
Returns
Returns an integer with the firing rate of the custom weapon, false otherwise.
Example
This example creates a minigun at the center of the map and creates a /firerate command that outputs its firerate to the player who types it.
local weapon = createWeapon("minigun", 0, 0, 3) function outputMinigunFireRate() outputChatBox("Fire rate: " .. getWeaponFiringRate(weapon)) end addCommandHandler("firerate", outputMinigunFireRate)
See also
- createWeapon
- fireWeapon
- getWeaponAmmo
- getWeaponClipAmmo
- getWeaponFiringRate
- getWeaponFlags
- getWeaponOwner
- getWeaponProperty
- getWeaponState
- getWeaponTarget
- resetWeaponFiringRate
- setWeaponAmmo
- setWeaponClipAmmo
- setWeaponFiringRate
- setWeaponFlags
- setWeaponProperty
- setWeaponState
- setWeaponTarget