WarpPedIntoVehicle

From Multi Theft Auto: Wiki
Revision as of 09:48, 3 June 2008 by Mekorea (talk | contribs) (New page: __NOTOC__ {{Server function}} This function is used to warp or force a ped into a vehicle. There are no animations involved when this happens. ==Syntax== <syntaxhighlight lang="lua"> bool warpPedIntoV...)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

This function is used to warp or force a ped into a vehicle. There are no animations involved when this happens.

Syntax

bool warpPedIntoVehicle ( ped thePed, vehicle theVehicle, [ int seat=0 ] )          

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 createstartvehicles ( playerSource, commandName, car, x, y, z ) -- the function allows specification of your car, and the position
    local racevehicle = createVehicle ( car, x, y, z )                   -- create a vehicle at the position specified by the startrace command
    warpPedIntoVehicle ( playerSource, racevehicle )                  -- warp them straight into the vehicle
end
addCommandHandler ( "startrace", createstartvehicles )                   -- add a command to start race

See Also