WarpPedIntoVehicle: Difference between revisions
Jump to navigation
Jump to search
No edit summary |
Zangomangu (talk | contribs) No edit summary |
||
(10 intermediate revisions by 6 users not shown) | |||
Line 1: | Line 1: | ||
__NOTOC__ | __NOTOC__ | ||
{{ | {{Server client function}} | ||
This function is used to warp or force a ped into a vehicle. There are no animations involved when this happens. | This function is used to warp or force a ped into a vehicle. There are no animations involved when this happens. | ||
[[File:vehicle seat ids.png|200px|thumb|right|Vehicle seat ids]] | |||
'''Available client side from 1.3.1''' (It will only work with client side vehicles and peds) | '''Available client side from 1.3.1''' (It will only work with client side vehicles and peds) | ||
{{Important Note|If you used [[setElementPosition]] to spawn the [[ped]]/[[player]], this function will not work and returns '''false'''.}} | |||
==Syntax== | ==Syntax== | ||
Line 9: | Line 12: | ||
bool warpPedIntoVehicle ( ped thePed, vehicle theVehicle, [ int seat=0 ] ) | bool warpPedIntoVehicle ( ped thePed, vehicle theVehicle, [ int seat=0 ] ) | ||
</syntaxhighlight> | </syntaxhighlight> | ||
{{OOP|Set the variable to nil to execute [[removePedFromVehicle]]|[[ped]]:warpIntoVehicle|vehicle|getPedOccupiedVehicle}} | |||
===Required Arguments=== | ===Required Arguments=== | ||
Line 16: | Line 21: | ||
===Optional Arguments=== | ===Optional Arguments=== | ||
{{OptionalArg}} | {{OptionalArg}} | ||
*'''seat:''' An integer representing the seat ID. ''0'' | *'''seat:''' An integer representing the seat ID. | ||
** '''0:''' Front-left | |||
** '''1:''' Front-right | |||
** '''2:''' Rear-left | |||
** '''3:''' Rear-right | |||
===Returns=== | ===Returns=== | ||
Line 31: | Line 40: | ||
addCommandHandler ( "startrace", setupForRace ) -- add a command to start race | addCommandHandler ( "startrace", setupForRace ) -- add a command to start race | ||
</syntaxhighlight> | </syntaxhighlight> | ||
==Issues== | |||
{{Issues| | |||
{{Issue|475|Network trouble when calling warpPedIntoVehicle on resourceStart}} | |||
}} | |||
==See Also== | ==See Also== | ||
{{Ped functions}} | {{Ped functions}} | ||
[[ru:warpPedIntoVehicle]] | [[ru:warpPedIntoVehicle]] |
Latest revision as of 19:02, 30 January 2022
This function is used to warp or force a ped into a vehicle. There are no animations involved when this happens.
Available client side from 1.3.1 (It will only work with client side vehicles and peds)
Important Note: If you used setElementPosition to spawn the ped/player, this function will not work and returns false. |
Syntax
bool warpPedIntoVehicle ( ped thePed, vehicle theVehicle, [ int seat=0 ] )
OOP Syntax Help! I don't understand this!
- Note: Set the variable to nil to execute removePedFromVehicle
- Method: ped:warpIntoVehicle(...)
- Variable: .vehicle
- Counterpart: getPedOccupiedVehicle
Required Arguments
- thePed: The ped which you wish to force inside the vehicle
- theVehicle: The vehicle you wish to force the ped into
Optional Arguments
NOTE: When using optional arguments, you might need to supply all arguments before the one you wish to use. For more information on optional arguments, see optional arguments.
- seat: An integer representing the seat ID.
- 0: Front-left
- 1: Front-right
- 2: Rear-left
- 3: Rear-right
Returns
Returns true if the operation is successful, false otherwise.
Example
This example creates a vehicle and warps a ped inside immediately.
function setupForRace ( ) local RacerPed = createPed ( 252, 0, 0, 3 ) local RaceVehicle = createVehicle ( 411, 4, 0, 3 ) -- create a vehicle. warpPedIntoVehicle ( RacerPed, RaceVehicle ) -- warp the ped straight into the vehicle end addCommandHandler ( "startrace", setupForRace ) -- add a command to start race
Issues
Issue ID | Description |
---|---|
#475 | Network trouble when calling warpPedIntoVehicle on resourceStart |
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