GivePedJetPack

From Multi Theft Auto: Wiki
Revision as of 21:02, 31 July 2018 by Myonlake (talk | contribs)
Jump to navigation Jump to search

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 )

Issues

Issue ID Description
#9522 Setting a ped's or player's position, animation, or freezing them whilst occupying a jetpack will remove their jetpack, but not the jetpack sound

See Also