SetNPCFollowVehicle: Difference between revisions
From Onset Developer Wiki
No edit summary |
FlyingFork (talk | contribs) No edit summary |
||
Line 10: | Line 10: | ||
{{FuncParamOptional|speed|The speed in floating point.}} | {{FuncParamOptional|speed|The speed in floating point.}} | ||
{{FuncReturnValue| | {{FuncReturnValue|This function returns nothing.}} | ||
== Example == | == Example == | ||
<syntaxhighlight lang="Lua> | <syntaxhighlight lang="Lua"> | ||
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) | |||
</syntaxhighlight> | </syntaxhighlight> | ||
{{RelatedFunctions}} | {{RelatedFunctions}} | ||
{{Template:NPCFunctions}} | {{Template:NPCFunctions}} |
Latest revision as of 14:27, 26 June 2021
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
- GetStreamedNPC
- GetNPCLocation
- SetNPCOutline
- SetNPCPropertyValue
- GetNPCPropertyValue
- CreateNPC
- DestroyNPC
- IsValidNPC
- GetAllNPC
- GetNPCCount
- IsNPCStreamedIn
- SetNPCLocation
- GetNPCLocation
- SetNPCHealth
- GetNPCHealth
- SetNPCAnimation
- SetNPCHeading
- GetNPCHeading
- SetNPCTargetLocation
- SetNPCFollowPlayer
- SetNPCFollowVehicle
- SetNPCRagdoll
- SetNPCRespawnTime