SetNPCFollowVehicle

From Onset Developer Wiki
The printable version is no longer supported and may have rendering errors. Please update your browser bookmarks and please use the default browser print function instead.
SetNPCFollowVehicle

Type: Function
Context: Server
Introduced: v1.0

Description

Make a NPC follow the vehicle.

Syntax

SetNPCFollowVehicle(npc, vehicle [, speed])

Parameters

  • npc
    The NPC identifier.
  • vehicle
    The vehicle identifier.
  • speed (optional)
    The speed in floating point.

Return Value

  • This function returns nothing.

Example

AddCommand("follow", function(player)
  local vehicle = GetPlayerVehicle(player)

  if (not vehicle) then
    return AddPlayerChat(player, "You must be in a vehicle!")
  end

  SetNPCFollowVehicle(npc, vehicle)
end)

See also