GetWeaponTarget: Difference between revisions
Jump to navigation
Jump to search
No edit summary |
KruTolic rus (talk | contribs) |
||
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 () | ||
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 19:58, 28 July 2013
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
Create Weapon and get weapon target.When it founded - fire weapon to the target all time,if it in the weapon sight.
function CreateWeapon () 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)
Requirements
This template will be deleted.
See Also
- createWeapon
- fireWeapon
- getWeaponAmmo
- getWeaponClipAmmo
- getWeaponFiringRate
- getWeaponFlags
- getWeaponOwner
- getWeaponProperty
- getWeaponState
- getWeaponTarget
- resetWeaponFiringRate
- setWeaponAmmo
- setWeaponClipAmmo
- setWeaponFiringRate
- setWeaponFlags
- setWeaponProperty
- setWeaponState
- setWeaponTarget