GivePedJetPack: Difference between revisions
Jump to navigation
Jump to search
mNo edit summary |
Zangomangu (talk | contribs) (Removed issue from deprecated function) |
||
(One intermediate revision by one other user not shown) | |||
Line 1: | Line 1: | ||
__NOTOC__ | __NOTOC__ | ||
{{Server function}} | {{Server function}} | ||
{{Deprecated | {{Deprecated|setPedWearingJetpack}} | ||
As such, you should either expect it to fail sometimes, or repeatedly try to give a jetpack every second or so until [[doesPedHaveJetPack]] 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. | This function is used to give a ped a jetpack, 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 [[doesPedHaveJetPack]] 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== | ==Syntax== | ||
Line 38: | Line 39: | ||
addCommandHandler ( "jetpack", consoleJetPack ) | addCommandHandler ( "jetpack", consoleJetPack ) | ||
</syntaxhighlight> | </syntaxhighlight> | ||
==See Also== | ==See Also== | ||
{{Ped functions}} | {{Ped functions}} | ||
[[ru:givePedJetPack]] | [[ru:givePedJetPack]] |
Latest revision as of 10:20, 30 January 2022
This function is deprecated. This means that its use is discouraged and that it might not exist in future versions. | |
Please use setPedWearingJetpack instead. |
This function is used to give a ped a jetpack, 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 doesPedHaveJetPack 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 givePedJetPack ( ped thePed )
OOP Syntax Help! I don't understand this!
- Method: ped:giveJetPack(...)
Required Arguments
- thePed: The ped you want to give a jetpack to.
Returns
Returns true if a jetpack was successfully given to the ped, false if it could not be given.
Example
This examples adds a "jetpack" console command, which gives or removes a jetpack from the player.
-- Checks whether or not the player has a jetpack, and gives or removes it from the player function consoleJetPack ( thePlayer, commandName ) if not doesPedHaveJetPack ( thePlayer ) then -- if the player doesn't have a jetpack local status = givePedJetPack ( thePlayer ) -- give him one if not status then outputConsole ( "Failed to give jetpack.", thePlayer ) -- tell him if it failed end else local status = removePedJetPack ( thePlayer ) -- remove his jetpack if ( not status ) then outputConsole ( "Failed to remove jetpack.", thePlayer ) -- tell him if it failed end end end -- add the function above to handle the "jetpack" command addCommandHandler ( "jetpack", consoleJetPack )
See Also
- 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