OnClientWeaponFire: Difference between revisions

From Multi Theft Auto: Wiki
Jump to navigation Jump to search
(New)
Line 9: Line 9:
Can be cancelled with cancelEvent to prevent the shot.
Can be cancelled with cancelEvent to prevent the shot.


==Syntax==  
==Parameters==  
<syntaxhighlight lang="lua">
<syntaxhighlight lang="lua">
onClientWeaponFire ( entity hitEntity, posX, posY, posZ, normalX, normalY, normalZ, int materialType, int lighting, int pieceHit )
element hitElement, float posX, float posY, float posZ, float normalX, float normalY, float normalZ, int materialType, int lighting, int pieceHit
- hitEntity the entity it will hit
</syntaxhighlight>
- posX the position it will hit
*'''hitElement:''' the element that was hit
- posY the position it will hit
*'''posX:''' the position it will hit
- posZ the position it will hit
*'''posY:''' the position it will hit
- normalX the normal it hit ( see processLineOfSight )
*'''posZ:''' the position it will hit
- normalY the normal it hit ( see processLineOfSight )
*'''normalX:''' the normal it hit ( see processLineOfSight )
- normalZ the normal it hit ( see processLineOfSight )
*'''normalY:''' the normal it hit ( see processLineOfSight )
- materialType the material type it hit ( see processLineOfSight )
*'''normalZ:''' the normal it hit ( see processLineOfSight )
- lighting the lighting of the entity it hit ( see processLineOfSight )
*'''materialType:''' the material type it hit ( see processLineOfSight )
- pieceHit the piece of the entity it hit ( see processLineOfSight )
*'''lighting:''' the lighting of the entity it hit ( see processLineOfSight )
</syntaxhighlight>
*'''pieceHit:''' the piece of the entity it hit ( see processLineOfSight )


==Example==  
==Example==  

Revision as of 15:05, 25 April 2013


Weapon creation event.

Called post firing so properties can be changed per shot

Source is the weapon that fired

Can be cancelled with cancelEvent to prevent the shot.

Parameters

element hitElement, float posX,  float posY, float posZ, float normalX, float normalY, float normalZ, int materialType, int lighting, int pieceHit
  • hitElement: the element that was hit
  • posX: the position it will hit
  • posY: the position it will hit
  • posZ: the position it will hit
  • normalX: the normal it hit ( see processLineOfSight )
  • normalY: the normal it hit ( see processLineOfSight )
  • normalZ: the normal it hit ( see processLineOfSight )
  • materialType: the material type it hit ( see processLineOfSight )
  • lighting: the lighting of the entity it hit ( see processLineOfSight )
  • pieceHit: the piece of the entity it hit ( see processLineOfSight )

Example

This example calls server events, when an object was hit, or the player shot at something with a special gun.


See Also