GetWeaponFiringRate: Difference between revisions

From Multi Theft Auto: Wiki
Jump to navigation Jump to search
(Added OOP syntax and improved the example)
(Remove obsolete Requirements section)
 
Line 23: Line 23:
addCommandHandler("firerate", outputMinigunFireRate)
addCommandHandler("firerate", outputMinigunFireRate)
</syntaxhighlight>
</syntaxhighlight>
==Requirements==
{{Requirements|n/a|1.3.0-9.04555|}}


==See also==
==See also==
{{Client weapon creation functions}}
{{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