SetWeaponTarget

From Multi Theft Auto: Wiki
Revision as of 10:47, 26 August 2012 by Cazomino05 (talk | contribs)
Jump to navigation Jump to search

Weapon target information:

  • There are three types of targets:
    • Position - Fires at a position in the world
    • Entity - Fires at an entity ( either the COM or the component position provided )
    • Rotational - Fires where the weapon points

Syntax

bool setWeaponTarget ( weapon theWeapon, element theTarget, int iComponentID )

Required Arguments

  • theWeapon: The weapon to set the target of.
  • theTarget: The target entity of the shot to shoot at.
  • iComponentID: The component position to fire at.
    • Vehicles:
      • 0 - front left tire
      • 1 - front right tire
      • 2 - rear left tire
      • 3 - rear right tire
      • 255 - none
    • Peds:
      • See ped bones
      • 255 - none

Returns

Returns true on success, false otherwise.

Fires a weapon at the specified entity ( this never misses... ever )

Syntax 2

Fires a weapon at the specified position ( this never misses... ever )

bool setWeaponTarget ( weapon theWeapon, float targetX, float targetY, float targetZ )

Required Arguments

  • theWeapon: The weapon to set the target of.
  • targetX: The target X.
  • targetY: The target Y.
  • targetZ: The target Z.

Returns

Returns true on success, false otherwise.

Syntax 3

Sets the weapon back to rotation based targeting.

bool bool setWeaponTarget ( weapon theWeapon, nil )

Required Arguments

  • theWeapon: The weapon to clear the target of.

Returns

Returns true on success, false otherwise.


Requirements

Minimum server version 1.3.0-4555
Minimum client version 1.3.0-4555

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.3.0-4555" client="1.3.0-4555" />

See Also