WarpPedIntoVehicle: Difference between revisions

From Multi Theft Auto: Wiki
Jump to navigation Jump to search
mNo edit summary
(Added oop syntax)
Line 12: Line 12:
bool warpPedIntoVehicle ( ped thePed, vehicle theVehicle, [ int seat=0 ] )           
bool warpPedIntoVehicle ( ped thePed, vehicle theVehicle, [ int seat=0 ] )           
</syntaxhighlight>  
</syntaxhighlight>  
{{OOP||[[ped]]:warpIntoVehicle|warpIntoVehicle}}


===Required Arguments===  
===Required Arguments===  

Revision as of 17:36, 6 August 2016

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)

Attention: 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!

Method: ped:warpIntoVehicle(...)
Variable: .warpIntoVehicle


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 represents the driver, any higher represent passenger seats.

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
#7855 Network trouble when calling warpPedIntoVehicle on resourceStart

See Also