GetJetpackWeaponsEnabled: Difference between revisions

From Multi Theft Auto: Wiki
Jump to navigation Jump to search
(Created page with "This function returns all the weapons that are usable on a jetpack similar to getJetpackWeaponEnabled. ==Syntax== <syntaxhighlight lang="lua"> table getJetpackWeaponsEnabled() </syntaxhighlight> ===Ret...")
 
mNo edit summary
Line 17: Line 17:
end
end
return enabled
return enabled
end</syntaxhighlight>
end</syntaxhighlight></section>
 
===Example===
===Example===
<syntaxhighlight lang="lua">addCommandHandler("weps",function()
<syntaxhighlight lang="lua">addCommandHandler("weps",function()

Revision as of 18:14, 25 September 2012

This function returns all the weapons that are usable on a jetpack similar to getJetpackWeaponEnabled.

Syntax

 table getJetpackWeaponsEnabled() 

Returns

Returns a table filled with weapon names, else an empty table.

Code

Click to collapse [-]
Server
function getJetpackWeaponsEnabled()
	local enabled = {}
	for i=0, 46 do
		local wepName = getWeaponNameFromID(i)
		if getJetpackWeaponEnabled(wepName) then
			table.insert(enabled,wepName)
		end
	end
	return enabled
end

Example

addCommandHandler("weps",function()
	for _,v in ipairs(getJetpackWeaponsEnabled())do
		outputChatBox(v)
		outputConsole(v)
		outputDebugString(v)
	end
end)