OnWeaponFire: Difference between revisions

From Multi Theft Auto: Wiki
Jump to navigation Jump to search
(Created page with "__NOTOC__ {{Server event}} This event is triggered when a weapon gets fired. This can be either by a player or vehicle. ==Source== The source of t...")
 
No edit summary
Line 5: Line 5:


==Source==
==Source==
The [[event system#Event source|source]] of this event is the element that fired the event. If the server is the creator it returns 'NULL'.
The [[event system#Event source|source]] of this event is the element that fired the weapon. If the server is the creator it returns 'NULL'.


==Cancel effect==
==Cancel effect==

Revision as of 19:25, 30 January 2013

This event is triggered when a weapon gets fired. This can be either by a player or vehicle.

Source

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

Cancel effect

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

Requirements

Minimum server version 1.4
Minimum client version n/a

Note: Using this feature requires the resource to have the above minimum version declared in the meta.xml <min_mta_version> section. e.g. <min_mta_version server="1.4" />

Example

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

See Also

Player events


Event functions

Shared