Scripting/Server/Classes/Vehicle/AttachTo_2
(v0.3.1-r2+) Glues the object to a vehicle, player or another object at the offset with an optional rotation offset in degrees; returns true when it worked. An attached object has no collision. Detach() puts it back at its own stored Pos (or at the given pos); it is also detached when the parent goes away.
Syntax
object.AttachTo(vehicle | player | object, x, y, z [, rx, ry, rz])object.Detach([pos])Arguments
- any vehicle | player | object
- float x
- float y
- float z
- float rx (optional)
- float ry (optional)
- float rz (optional)
- Vector pos (optional)
Example
function onPlayerCommand( player, cmd, params )
{
if ( cmd == "attachto" )
{
local pos = player.Pos;
local obj = CreateObject( 1362, player.Pos );
obj.AttachTo( 0, pos.x, pos.y, pos.z );
}
}This sample was generated from the signature – adapt the values to your gamemode.
Related pages
- vehicle.Remove
- vehicle.Respawn
- vehicle.Fix
- vehicle.Explode
- vehicle.SetBurstableTyres
- player.AttachTo
- object.AttachToBone
- vehicle.SetComponentStatus
- vehicle.SetComponentStatus
- vehicle.SetComponentAngle
- vehicle.SetComponentColour
- vehicle.TurretRotation
Section: Vehicle
Categories: Server methods | Vehicle