ServersYour serverFor creatorsForumFAQDocumentationSecurity
Download the launcher
  1. Documentation
  2. Server functions
  3. fireWeapon

Function

fireWeapon

ServerWeaponsIdentical to MTA:SA

Fires one shot from a scripted weapon at its current target. Uses one round from the clip.

Syntax

bool fireWeapon(weapon weapon)

Arguments

weaponweapon
The scripted weapon.

Returns

false if the weapon is not ready (getWeaponState) or the clip is empty.

Example

setWeaponTarget(turret, 2500.0, -1660.0, 13.5)
setTimer(function()
    if not fireWeapon(turret) then
        setWeaponClipAmmo(turret, 30)
    end
end, 200, 0)