SetPedWearingJetpack: Difference between revisions
Jump to navigation
Jump to search
^iiEcoo'x ) (talk | contribs) |
m (→See Also) |
||
(2 intermediate revisions by 2 users not shown) | |||
Line 8: | Line 8: | ||
==Syntax== | ==Syntax== | ||
<syntaxhighlight lang="lua">bool setPedWearingJetpack ( ped thePed, bool state )</syntaxhighlight> | <syntaxhighlight lang="lua">bool setPedWearingJetpack ( ped thePed, bool state )</syntaxhighlight> | ||
[[File:Mta-screen 2020-04-27 15-12-56.png|thumb| | [[File:Mta-screen 2020-04-27 15-12-56.png|thumb|Player wearing a jetpack]] | ||
{{OOP||[[ped]]:setWearingJetpack|jetpack}} | {{OOP||[[ped]]:setWearingJetpack|jetpack}} | ||
Line 17: | Line 17: | ||
===Returns=== | ===Returns=== | ||
Returns ''true'' if a jetpack was successfully set for the ped, ''false'' if setting it failed. | Returns ''true'' if a jetpack was successfully set for the ped, ''false'' if setting it failed. | ||
==Example== | ==Example== | ||
Line 38: | Line 29: | ||
==See Also== | ==See Also== | ||
{{Ped functions}} | {{Ped functions|server}} |
Latest revision as of 22:36, 6 September 2024
This function is used to give or take a jetpack from a ped, it won't work if the ped is in a vehicle.
As such, you should either expect it to fail sometimes, or repeatedly try to give a jetpack every second or so until isPedWearingJetpack returns true. Alternatively, you can force the ped into a 'safe' position (e.g. standing on the ground) before giving the jetpack, or use a pickup to handle it.
Syntax
bool setPedWearingJetpack ( ped thePed, bool state )
OOP Syntax Help! I don't understand this!
- Method: ped:setWearingJetpack(...)
- Variable: .jetpack
Required Arguments
- thePed: The ped you want to give a jetpack to.
- state: A boolean representing whether to give or take the jetpack.
Returns
Returns true if a jetpack was successfully set for the ped, false if setting it failed.
Example
This examples adds a "jetpack" console command, which toggles a jetpack for the player.
addCommandHandler ( "jetpack", function ( player ) setPedWearingJetpack ( player, not isPedWearingJetpack ( player ) ) end )
See Also
- getPedGravity
- reloadPedWeapon
- setPedChoking
- setPedGravity
- setPedWearingJetpack
- Shared
- addPedClothes
- getPedClothes
- removePedClothes
- createPed
- getPedAmmoInClip
- getPedArmor
- getPedFightingStyle
- getPedOccupiedVehicle
- getPedOccupiedVehicleSeat
- getPedStat
- getPedTarget
- getPedTotalAmmo
- getPedWalkingStyle
- getPedWeapon
- getPedWeaponSlot
- getPedContactElement
- getValidPedModels
- isPedChoking
- isPedDead
- isPedDoingGangDriveby
- isPedDucked
- isPedHeadless
- isPedInVehicle
- isPedOnFire
- isPedOnGround
- isPedWearingJetpack
- killPed
- removePedFromVehicle
- setPedAnimation
- setPedAnimationProgress
- setPedAnimationSpeed
- setPedArmor
- setPedDoingGangDriveby
- setPedFightingStyle
- setPedHeadless
- setPedOnFire
- setPedStat
- setPedWalkingStyle
- setPedWeaponSlot
- warpPedIntoVehicle