SetPedExitVehicle: Difference between revisions
Jump to navigation
Jump to search
No edit summary |
Fernando187 (talk | contribs) (Remove obsolete Requirements section) |
||
(4 intermediate revisions by 2 users not shown) | |||
Line 1: | Line 1: | ||
__NOTOC__ | __NOTOC__ | ||
{{Client function}} | {{Client function}} | ||
{{Added feature/item | {{Added feature/item|1.5.9|1.5.8|20740|This function makes a [[ped]] exit a [[vehicle]], similar to the enter_exit control state.}} | ||
{{Note|This function only works on synced peds and vehicles (i.e. created server-side).}} | {{Note|This function only works on synced peds and vehicles (i.e. created server-side).}} | ||
Line 16: | Line 15: | ||
Returns ''true'' if the function was successful, ''false'' otherwise. | Returns ''true'' if the function was successful, ''false'' otherwise. | ||
When this function returns ''true'', the client will ask server for permission to exit a vehicle | When this function returns ''true'', the client will ask server for permission to exit a vehicle. | ||
This function returns ''false'' in the following cases | This function returns ''false'' in the following cases | ||
*Invalid arguments were parsed. | *Invalid arguments were parsed. | ||
*Time passed since last enter/exit for this ped is less than 1500 ms. | *Time passed since last enter/exit for this ped is less than 1500 ms. | ||
*The ped is | *The ped is already being jacked. | ||
==Example== | ==Example== | ||
This example adds a command to make all synced peds exit their vehicles. | |||
<syntaxhighlight lang="lua"> | |||
function exitPedVehicles() | |||
-- For all streamed-in peds | |||
for k,ped in ipairs(getElementsByType("ped", root, true)) do | |||
-- Are we syncing it and is it in a vehicle | |||
if isElementSyncer(ped) and isPedInVehicle(ped) then | |||
setPedExitVehicle(ped) | |||
end | |||
end | |||
end | |||
addCommandHandler("getout", exitPedVehicles) | |||
</syntaxhighlight> | |||
==See Also== | ==See Also== | ||
{{Client ped functions}} | {{Client ped functions}} |
Latest revision as of 17:23, 7 November 2024
This function makes a ped exit a vehicle, similar to the enter_exit control state.
Syntax
bool setPedExitVehicle ( ped thePed )
Required Arguments
Returns
Returns true if the function was successful, false otherwise.
When this function returns true, the client will ask server for permission to exit a vehicle.
This function returns false in the following cases
- Invalid arguments were parsed.
- Time passed since last enter/exit for this ped is less than 1500 ms.
- The ped is already being jacked.
Example
This example adds a command to make all synced peds exit their vehicles.
function exitPedVehicles() -- For all streamed-in peds for k,ped in ipairs(getElementsByType("ped", root, true)) do -- Are we syncing it and is it in a vehicle if isElementSyncer(ped) and isPedInVehicle(ped) then setPedExitVehicle(ped) end end end addCommandHandler("getout", exitPedVehicles)
See Also
- canPedBeKnockedOffBike
- getPedAnalogControlState
- getPedAnimation
- getPedBonePosition
- getPedCameraRotation
- getPedControlState
- getPedMoveState
- getPedOxygenLevel
- getPedSimplestTask
- getPedTargetCollision
- getPedTargetEnd
- getPedTargetStart
- getPedTask
- getPedVoice
- getPedWeaponMuzzlePosition
- givePedWeapon
- isPedBleeding
- isPedDoingTask
- isPedReloadingWeapon
- isPedTargetingMarkerEnabled
- setAnalogControlState
- setPedAimTarget
- setPedAnalogControlState
- setPedBleeding
- setPedCameraRotation
- setPedCanBeKnockedOffBike
- setPedControlState
- setPedEnterVehicle
- setPedExitVehicle
- IsPedFootBloodEnabled
- setPedFootBloodEnabled
- setPedLookAt
- setPedOxygenLevel
- setPedTargetingMarkerEnabled
- setPedVoice
- 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