fireWeapon
Client-side
Server-side
Shared
Manual Review Required
Please finish this page using the corresponding Old Wiki article. Go to Contribution guidelines for more information.
Fires one shot from a custom weapon.
OOP Syntax Help! I don't understand this!
- Method: weapon:fire(...)
Syntax
bool fireWeapon ( weapon theWeapon )Required Arguments
- theWeapon: The weapon to be fired.
Returns
- bool: value
Returns true if the shot weapon is valid and therefore the shot was fired, false otherwise.
Code Examples
shared
This function creates and fires a weapon.
function createAndFire() local weaponElement = createWeapon("mp5", 0, 0, 3) -- Create a MP5 at the coordinates 0, 0, 3
fireWeapon(weaponElement) -- Fire the weapon we spawnedendaddEventHandler("onClientResourceStart", resourceRoot, createAndFire)