GetWeaponTarget: Difference between revisions

From Multi Theft Auto: Wiki
Jump to navigation Jump to search
(Example made no sense.)
Line 14: Line 14:


==Example==
==Example==
Create Weapon and get weapon target.When it founded - fire weapon to the target all time,if it in the weapon sight.
<syntaxhighlight lang="lua">
<syntaxhighlight lang="lua">
function CreateWeapon ()
-- TODO
  local weapon = createWeapon ("m4", 0, 0, 0)  --create gun "m4" in 0,0,0 position.
  local weapontarget = getWeaponTarget ( weapon )
    if weapontarget then
    setTimer (function()
    fireWeapon ( weapon )
    end,100,0)
    end
end
addEventHandler ("onClientResourceStart",getRootElement(),CreateWeapon)
</syntaxhighlight>
</syntaxhighlight>



Revision as of 12:51, 2 January 2014

Accessories-text-editor.png Script Example Missing Function GetWeaponTarget needs a script example, help out by writing one.

Before submitting check out Editing Guidelines Script Examples.

Get the target of the custom weapon.

Syntax

element getWeaponTarget ( weapon theWeapon )

Required Arguments

  • theWeapon: The weapon to get the target of.

Returns

Returns the target element of the custom weapon, false otherwise.

Example

-- TODO

Requirements

This template will be deleted.

See Also