function giveJetpack(thePlayer, commandName) -- Our function and arguments.
if(givePedJetPack(thePlayer)) then -- Checks if the player got his jetpack, we don't need an output here since the player will clearly see the jetpack.
return true --
end --ending the "if".
elseif
doesPedHaveJetPack(thePlayer) then -- Check if the player already has a jetpack.
removePedJetPack(thePlayer) -- Remove the jetpack if he has one.
return -- And stop the function here.
end
if(getPedOccupiedVehicle(thePlayer)) then -- Checks if the player is in a vehicle, so if he's he won't get his jetpack.
outputChatBox("You can't use this command while in vehicle!", thePlayer, 255, 255, 0) -- If he's, it will output a message.
return false -- returns false so he doesn't get the jetpack.
end -- ending the "if".
end -- ending the function.
addCommandHandler("jet", giveJetpack)