SetJetpackWeaponEnabled: Difference between revisions

From Multi Theft Auto: Wiki
Jump to navigation Jump to search
mNo edit summary
Line 4: Line 4:


==Syntax==  
==Syntax==  
<syntaxhighlight lang="lua">bool setJetpackWeaponEnabled(string weapon, player thePlayer)</syntaxhighlight>  
<syntaxhighlight lang="lua">bool setJetpackWeaponEnabled(string weapon, bool enabled)</syntaxhighlight>  


===Required Arguments===  
===Required Arguments===  
Line 15: Line 15:
==Example==  
==Example==  
<syntaxhighlight lang="lua">addCommandHandler("setJPEnabled",function(ped,_,wep,enabled)
<syntaxhighlight lang="lua">addCommandHandler("setJPEnabled",function(ped,_,wep,enabled)
if type(wep) == "number" then
wep = getWeaponNameFromID(wep)
end
if enabled == "true" then
if enabled == "true" then
setJetpackWeaponEnabled(wep,true)
setJetpackWeaponEnabled(wep,true)

Revision as of 19:44, 10 July 2012

This function sets a weapon usable while using the Jetpack.

Syntax

bool setJetpackWeaponEnabled(string weapon, bool enabled)

Required Arguments

  • weapon The weapon that's being set usable on a Jetpack.
  • enabled A bool representing whether the weapon is enabled or disabled.

Returns

Returns true, else false if invalid arguments are passed.

Example

addCommandHandler("setJPEnabled",function(ped,_,wep,enabled)
	if enabled == "true" then
		setJetpackWeaponEnabled(wep,true)
		outputChatBox("You just enabled the Jetpack Weapons.",ped)
	elseif enabled == "false" then
		setJetpackWeaponEnabled(wep,false)
		outputChatBox("You just disabled the Jetpack Weapons.",ped)
	else
		outputChatBox("SYNTAX: '/setJPEnabled theWeapon enabled"
	end
end)

Requirements

This template will be deleted.

See Also