onWeaponFire | Multi Theft Auto: Wiki Skip to content

onWeaponFire

Client-side
Server-side
Shared

This event is triggered when a custom weapon gets fired.

Parameters

This event does not pass any parameters to the handler function.

Source

element: The source of this event is the element that fired the weapon. If the server is the creator it returns nil.

Canceling

If this event is canceled, the bullet(s) won't be synced with other players.

Code Examples

server
addEventHandler( "onWeaponFire", root,
function ()
if ( isElement( source ) ) and ( getElementType( source ) == "player" ) then
outputChatBox( "You fired a weapon!", source, 0, 225, 0 )
end
end
)