Knight docs
EN ID
GitHub

Objects & Mapping

Static and player objects, materials and moving objects.

Create objects

knight
system::start() {
    // CreateObject(model, x, y, z, rotX, rotY, rotZ, drawDistance)
    let crate = CreateObject(1225, 1960.0, 1345.0, 15.4, 0.0, 0.0, 0.0, 200.0);
    let gate  = CreateObject(2930, 1970.0, 1345.0, 15.4, 0.0, 0.0, 0.0, 300.0);
    Log("objects: {crate}, {gate}");
};

Move and rotate

knight
// MoveObject(id, toX, toY, toZ, speed, toRotX, toRotY, toRotZ)
MoveObject(gate, 1970.0, 1355.0, 15.4, 2.0, 0.0, 0.0, 90.0);
StopObject(gate);
SetObjectPos(gate, 1970.0, 1345.0, 15.4);
SetObjectRotation(gate, 0.0, 0.0, 0.0);

Materials

knight
// SetObjectMaterial(objectid, materialIndex, model, txdName, textureName, colour)
SetObjectMaterial(crate, 0, 1234, "custom", "crate", 0xFFFFFFFF);

// SetObjectMaterialText(objectid, text, index, size, font, fontSize, bold, colour, backColour, alignment)
SetObjectMaterialText(crate, "KNIGHT", 1, 10, "Arial", 48, true, 0xFFFFFFFF, 0, 0);

Attachments

knight
AttachObjectToVehicle(objectid, vehicleid, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0);
AttachObjectToPlayer(objectid, playerid, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0);
AttachObjectToObject(objectid, targetid, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0);

Player objects

Player objects belong to one player and are not streamed to others.

knight
let po = CreatePlayerObject(playerid, 1225, 1960.0, 1345.0, 15.4, 0.0, 0.0, 0.0, 200.0);
DestroyPlayerObject(playerid, po);
Tip
For 0.3.DL custom object models use AddSimpleModel and pass the negative id; see Custom Models.