SetJetpackWeaponEnabled: Difference between revisions
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)</...") |
m (Issues fixed) |
||
(13 intermediate revisions by 8 users not shown) | |||
Line 2: | Line 2: | ||
{{Server function}} | {{Server function}} | ||
This function sets a weapon usable while using the Jetpack. | This function sets a weapon usable while using the Jetpack. | ||
{{Note|colt 45, sawed-off, tec-9 and uzi are always enabled for the Jetpack and are not affected by this function}} | |||
==Syntax== | ==Syntax== | ||
<syntaxhighlight lang="lua">bool setJetpackWeaponEnabled(weapon | <syntaxhighlight lang="lua">bool setJetpackWeaponEnabled(string weapon, bool enabled)</syntaxhighlight> | ||
===Required Arguments=== | ===Required Arguments=== | ||
*'''weapon''' The weapon that's being set usable on a Jetpack. | *'''weapon''' The weapon that's being set usable on a Jetpack. Names can be: (Case is ignored) | ||
{{All Weapon Types}} | |||
*'''enabled''' A bool representing whether the weapon is enabled or disabled. | *'''enabled''' A bool representing whether the weapon is enabled or disabled. | ||
===Returns=== | ===Returns=== | ||
Returns true, else false if invalid arguments are passed. | Returns true, else false if invalid arguments are passed. | ||
==Example== | ==Example== | ||
<syntaxhighlight lang="lua"> | <syntaxhighlight lang="lua">addEventHandler("onResourceStart",resourceRoot,function() | ||
if setJetpackWeaponEnabled("31",true) then | |||
outputChatBox(getWeaponNameFromID(31).." is now enabled for jetpacks!") | |||
end | |||
end)</syntaxhighlight> | end)</syntaxhighlight> | ||
==Example== | |||
<syntaxhighlight lang="lua"> | |||
local weapons = { | |||
31, | |||
34, | |||
33, | |||
} | |||
addEventHandler("onResourceStart",resourceRoot,function() | |||
for i,v in ipairs(weapons) do | |||
if setJetpackWeaponEnabled(v,true) then | |||
outputChatBox(getWeaponNameFromID(v).." is now enabled for jetpacks!") | |||
end | |||
end | |||
end | |||
)</syntaxhighlight> | |||
==Requirements== | ==Requirements== | ||
{{Requirements|1.3.1|n/a|}} | {{Requirements|1.3.1|n/a|}} | ||
==See Also== | ==See Also== | ||
{{World_functions}} | {{World_functions}} |
Revision as of 18:30, 15 July 2024
This function sets a weapon usable while using the Jetpack.
Note: colt 45, sawed-off, tec-9 and uzi are always enabled for the Jetpack and are not affected by this function |
Syntax
bool setJetpackWeaponEnabled(string weapon, bool enabled)
Required Arguments
- weapon The weapon that's being set usable on a Jetpack. Names can be: (Case is ignored)
- brassknuckle
- golfclub
- nightstick
- knife
- bat
- shovel
- poolstick
- katana
- chainsaw
- dildo
- vibrator
- flower
- cane
- grenade
- teargas
- molotov
- colt 45
- silenced
- deagle
- shotgun
- sawed-off
- combat shotgun
- uzi
- mp5
- ak-47
- m4
- tec-9
- rifle
- sniper
- rocket launcher
- rocket launcher hs
- flamethrower
- minigun
- satchel
- bomb
- spraycan
- fire extinguisher
- camera
- nightvision
- infrared
- parachute
- enabled A bool representing whether the weapon is enabled or disabled.
Returns
Returns true, else false if invalid arguments are passed.
Example
addEventHandler("onResourceStart",resourceRoot,function() if setJetpackWeaponEnabled("31",true) then outputChatBox(getWeaponNameFromID(31).." is now enabled for jetpacks!") end end)
Example
local weapons = { 31, 34, 33, } addEventHandler("onResourceStart",resourceRoot,function() for i,v in ipairs(weapons) do if setJetpackWeaponEnabled(v,true) then outputChatBox(getWeaponNameFromID(v).." is now enabled for jetpacks!") end 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
- areTrafficLightsLocked
- getAircraftMaxHeight
- getAircraftMaxVelocity
- getCloudsEnabled
- getFarClipDistance
- getFogDistance
- getGameSpeed
- getGravity
- getHeatHaze
- getInteriorSoundsEnabled
- getJetpackMaxHeight
- getMinuteDuration
- getMoonSize
- getOcclusionsEnabled
- getRainLevel
- getSunColor
- getSunSize
- getTime
- getTrafficLightState
- getWeather
- getWindVelocity
- getSkyGradient
- getPlayerBlurLevel
- getZoneName
- isGarageOpen
- removeWorldModel
- resetFarClipDistance
- resetFogDistance
- resetHeatHaze
- resetMoonSize
- resetRainLevel
- resetSkyGradient
- resetSunColor
- resetSunSize
- resetWindVelocity
- restoreAllWorldModels
- restoreWorldModel
- setAircraftMaxHeight
- setAircraftMaxVelocity
- setCloudsEnabled
- setFarClipDistance
- setFogDistance
- setGameSpeed
- setGarageOpen
- setGravity
- setHeatHaze
- setInteriorSoundsEnabled
- setMinuteDuration
- setMoonSize
- setOcclusionsEnabled
- setRainLevel
- setSkyGradient
- setSunColor
- setSunSize
- setTime
- setTrafficLightState
- setTrafficLightsLocked
- setWeather
- setWeatherBlended
- setWindVelocity
- setJetpackMaxHeight
- setPlayerBlurLevel