GetWeaponTarget: Difference between revisions
		
		
		
		
		
		Jump to navigation
		Jump to search
		
				
		
		
	
| KruTolic rus (talk | contribs) | |||
| Line 18: | Line 18: | ||
| function CreateWeapon () | function CreateWeapon () | ||
|    local weapon = createWeapon ("m4", 0, 0, 0)  --create gun "m4" in 0,0,0 position. |    local weapon = createWeapon ("m4", 0, 0, 0)  --create gun "m4" in 0,0,0 position. | ||
|    local weapontarget =  |    local weapontarget = getWeaponTarget ( weapon ) | ||
|      if weapontarget then |      if weapontarget then | ||
|      setTimer (function() |      setTimer (function() | ||
Revision as of 09:30, 15 November 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
- getWeaponFiringRate
- getWeaponClipAmmo
- getWeaponAmmo
- getWeaponFlags
- getWeaponState
- getWeaponTarget
- resetWeaponFiringRate
- setWeaponClipAmmo
- setWeaponFiringRate
- setWeaponFlags
- setWeaponState
- setWeaponTarget