RemovePedFromVehicle: Difference between revisions
Jump to navigation
Jump to search
(New page: {{Server function}} __NOTOC__ This function removes a ped from a vehicle immediately. This works for drivers and passengers. Note that this removes the ped from the vehicle and puts him in...) |
m (→Example) |
||
(6 intermediate revisions by 5 users not shown) | |||
Line 1: | Line 1: | ||
{{Server function}} | {{Server client function}} | ||
__NOTOC__ | __NOTOC__ | ||
This function removes a ped from a vehicle immediately. This works for drivers and passengers. Note that this removes the ped from the vehicle and puts him in the exact position where the command was initiated. | This function removes a ped from a vehicle immediately. This works for drivers and passengers. Note that this removes the ped from the vehicle and puts him in the exact position where the command was initiated. | ||
'''Available client side from 1.3.1''' (It will only work with client side vehicles and peds) | |||
==Syntax== | ==Syntax== | ||
<syntaxhighlight lang="lua"> | <syntaxhighlight lang="lua"> | ||
bool removePedFromVehicle ( ped thePed ) | bool removePedFromVehicle ( ped thePed ) | ||
</syntaxhighlight> | </syntaxhighlight> | ||
{{OOP|Set the variable to nil to execute this function|[[ped]]:removeFromVehicle|vehicle}} | |||
===Required Arguments=== | ===Required Arguments=== | ||
Line 12: | Line 15: | ||
===Returns=== | ===Returns=== | ||
Returns ''true'' if the operation was successful, ''false'' | Returns ''true'' if the operation was successful, ''false'' if the specified ped is not valid or if it isn't in a vehicle. | ||
==Example== | ==Example== | ||
Small example to show how to remove a ped from any vehicle it's in. | |||
<syntaxhighlight lang="lua"> | <syntaxhighlight lang="lua"> | ||
-- | function setupForRace( ) | ||
RacerPed = createPed( 252, 0, 0, 3 ) -- create a ped into the variable "RacerPed" | |||
local RaceVehicle = createVehicle( 411, 4, 0, 3 ) -- create a vehicle. | |||
warpPedIntoVehicle( RacerPed, RaceVehicle ) -- warp the ped straight into the vehicle | |||
setTimer( removeThePed, 5000, 1 ) -- Setup a timer which will remove the ped from the vehicle after 5 seconds. | |||
end | |||
addCommandHandler( "startrace", setupForRace ) -- add a command to start race | |||
function removeThePed( ) | |||
removePedFromVehicle( RacerPed ) -- Removes the ped from any vehicle. | |||
end | |||
</syntaxhighlight> | </syntaxhighlight> | ||
==See Also== | ==See Also== | ||
{{Ped functions}} | {{Ped functions}} |
Latest revision as of 15:42, 3 April 2018
This function removes a ped from a vehicle immediately. This works for drivers and passengers. Note that this removes the ped from the vehicle and puts him in the exact position where the command was initiated.
Available client side from 1.3.1 (It will only work with client side vehicles and peds)
Syntax
bool removePedFromVehicle ( ped thePed )
OOP Syntax Help! I don't understand this!
- Note: Set the variable to nil to execute this function
- Method: ped:removeFromVehicle(...)
- Variable: .vehicle
Required Arguments
- thePed: The ped you wish to remove from a vehicle
Returns
Returns true if the operation was successful, false if the specified ped is not valid or if it isn't in a vehicle.
Example
Small example to show how to remove a ped from any vehicle it's in.
function setupForRace( ) RacerPed = createPed( 252, 0, 0, 3 ) -- create a ped into the variable "RacerPed" local RaceVehicle = createVehicle( 411, 4, 0, 3 ) -- create a vehicle. warpPedIntoVehicle( RacerPed, RaceVehicle ) -- warp the ped straight into the vehicle setTimer( removeThePed, 5000, 1 ) -- Setup a timer which will remove the ped from the vehicle after 5 seconds. end addCommandHandler( "startrace", setupForRace ) -- add a command to start race function removeThePed( ) removePedFromVehicle( RacerPed ) -- Removes the ped from any vehicle. end
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