SetJetpackWeaponEnabled: Difference between revisions

From Multi Theft Auto: Wiki
Jump to navigation Jump to search
(Created page with "__NOTOC__ {{Server function}} This function sets a weapon usable while using the Jetpack. ==Syntax== <syntaxhighlight lang="lua">bool setJetpackWeaponEnabled(weapon-Type, player thePlayer)</...")
 
Line 4: Line 4:


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


===Required Arguments===  
===Required Arguments===  
Line 11: Line 11:


===Returns===
===Returns===
Returns true, else false if invalid arguments are passed.  
Returns true, else false if invalid arguments are passed.


==Example==  
==Example==  

Revision as of 19:39, 10 July 2012

This function sets a weapon usable while using the Jetpack.

Syntax

bool setJetpackWeaponEnabled(string weapon, player thePlayer)

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 type(wep) == "number" then
		wep = getWeaponNameFromID(wep)
	end
	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

Minimum server version 1.3.1
Minimum client version n/a

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 server="1.3.1" />

See Also