SetWeaponTarget: Difference between revisions

From Multi Theft Auto: Wiki
Jump to navigation Jump to search
No edit summary
No edit summary
Line 56: Line 56:


==Requirements==
==Requirements==
{{Requirements|1.3.0-4555|1.3.0-4555|}}
{{Requirements|n/a|1.3.0-9.04555|}}


==See Also==
==See Also==
{{Client weapon creation functions}}
{{Client weapon creation functions}}

Revision as of 22:47, 10 September 2012

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 n/a
Minimum client version 1.3.0-9.04555

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 client="1.3.0-9.04555" />

See Also