Knight docs
EN ID
GitHub

World, Checkpoints & Pickups

Gang zones, labels, actors, pickups, checkpoints and world settings.

World settings

knight
SetWeather(10);
SetWorldTime(12);
SetGravity(0.008);
SetGameModeText("My Server");
ShowNameTags(true);
ShowPlayerMarkers(1);
DisableInteriorEnterExits();

Checkpoints

knight
player::command("/cp", float x, float y, float z) {
    SetPlayerCheckpoint(playerid, x, y, z, 3.0);
};

player::command("/nocp") {
    DisablePlayerCheckpoint(playerid);
};

player::checkpoint(int playerid) {
    SendClientMessage(playerid, "Checkpoint reached!");
    DisablePlayerCheckpoint(playerid);
};
Note
Race checkpoints use SetPlayerRaceCheckpoint and the race_checkpoint_enter / race_checkpoint_leave callbacks.

Gang zones

knight
let zone = GangZoneCreate(2000.0, 1300.0, 2100.0, 1400.0);
GangZoneShowForAll(zone, 0x00FF0080);
GangZoneFlashForAll(zone, 0xFF0000FF);
GangZoneHideForAll(zone);
GangZoneDestroy(zone);

3D labels

knight
// Create3DTextLabel(text, colour, x, y, z, drawDistance, virtualWorld, testLOS)
let label = Create3DTextLabel("Market", 0xFFFFFFFF, 1960.0, 1345.0, 16.0, 50.0, 0, 0);
Update3DTextLabelText(label, 0xFFFFFFFF, "Market open");
Delete3DTextLabel(label);

Pickups

knight
// type 2 = weapon pickup; model = weapon id
let pickup = CreatePickup(1240, 2, 1960.0, 1345.0, 15.4, 0);
DestroyPickup(pickup);

player::pickup(int playerid, int pickupid) {
    SendClientMessage(playerid, "Picked up {pickupid}");
};

Actors (NPCs)

knight
let actor = CreateActor(7, 1960.0, 1345.0, 15.4, 90.0);
SetActorHealth(actor, 100.0);
ApplyActorAnimation(actor, "PED", "IDLE_STANCE", 4.1, true, true, true, true, 0);
DestroyActor(actor);

world::actor_damage(int actorid, int playerid, float amount, int weaponid, int bodypart) {
    Log("actor {actorid} hit for {amount}");
};

Map icons

knight
// SetPlayerMapIcon(playerid, iconID, x, y, z, markertype, colour, style)
SetPlayerMapIcon(playerid, 0, 1960.0, 1345.0, 15.4, 1, 0x00FF00FF, 0);
RemovePlayerMapIcon(playerid, 0);