SetPedEnterVehicle: Difference between revisions
Jump to navigation
Jump to search
Zangomangu (talk | contribs) (Created page with "__NOTOC__ {{Client function}} {{New feature/item|3.0160|1.5.8|20740|This function makes a ped enter a vehicle, similar to the enter_exit control state.}} {{Note|For t...") |
Zangomangu (talk | contribs) No edit summary |
||
Line 3: | Line 3: | ||
{{New feature/item|3.0160|1.5.8|20740|This function makes a [[ped]] enter a [[vehicle]], similar to the enter_exit control state.}} | {{New feature/item|3.0160|1.5.8|20740|This function makes a [[ped]] enter a [[vehicle]], similar to the enter_exit control state.}} | ||
{{Note|For this function to work, the server and all clients are required to be on version '''1.5.8 r20740''' or newer.}} | {{Note|For this function to work on peds, the server and all clients are required to be on version '''1.5.8 r20740''' or newer.}} | ||
{{Note|This function only works on synced peds and vehicles (ie. created serverside).}} | {{Note|This function only works on synced peds and vehicles (ie. created serverside).}} | ||
Line 22: | Line 22: | ||
When this function returns ''true'', the client will ask server for permission to enter a vehicle. Actually entering can still fail in the following cases | When this function returns ''true'', the client will ask server for permission to enter a vehicle. Actually entering can still fail in the following cases | ||
* | *The function is used on a ped, but another client is not on version '''1.5.8 r20740''' or newer. | ||
*Another player or ped is already entering, exiting or jacking the same vehicle and seat. | *Another player or ped is already entering, exiting or jacking the same vehicle and seat. | ||
*Movement input or damage can interrupt the task. Use [[getPedTask]] to monitor what the ped is doing. | *Movement input or damage can interrupt the task. Use [[getPedTask]] to monitor what the ped is doing. | ||
Line 28: | Line 28: | ||
This function returns ''false'' in the following cases | This function returns ''false'' in the following cases | ||
*Invalid arguments were parsed. | *Invalid arguments were parsed. | ||
*The server is not on version '''1.5.8 r20740''' or newer. | *The function is used on a ped, but the server is not on version '''1.5.8 r20740''' or newer. | ||
*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 has an active TASK_PRIMARY [[task]]. Use [[getPedTask]] to monitor what the ped is doing. | *The ped has an active TASK_PRIMARY [[task]]. Use [[getPedTask]] to monitor what the ped is doing. |
Revision as of 12:30, 29 November 2020
This function makes a ped enter a vehicle, similar to the enter_exit control state.
Syntax
bool setPedEnterVehicle ( ped thePed [, vehicle = nil, passenger = false ] )
Required Arguments
- thePed: The player or ped to enter the vehicle.
- Note: The player must be the local player.
- Note: The ped must be synced by the client. Use isElementSyncer clientside to check if the client is syncing. Use setElementSyncer serverside to change the syncer manually.
- vehicle: The vehicle to enter. If no vehicle is set, the ped will enter the nearest vehicle within 20 m.
- passenger: If set to true, the ped will enter as passenger in the nearest available seat.
Returns
Returns true if the function was successful, false otherwise.
When this function returns true, the client will ask server for permission to enter a vehicle. Actually entering can still fail in the following cases
- The function is used on a ped, but another client is not on version 1.5.8 r20740 or newer.
- Another player or ped is already entering, exiting or jacking the same vehicle and seat.
- Movement input or damage can interrupt the task. Use getPedTask to monitor what the ped is doing.
This function returns false in the following cases
- Invalid arguments were parsed.
- The function is used on a ped, but the server is not on version 1.5.8 r20740 or newer.
- Time passed since last enter/exit for this ped is less than 1500 ms.
- The ped has an active TASK_PRIMARY task. Use getPedTask to monitor what the ped is doing.
Example
Script Example Missing Function SetPedEnterVehicle needs a script example, help out by writing one. | |
Before submitting check out Editing Guidelines Script Examples. |
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