Lua/Server/Checkpoint/Static Functions/Create
From JC2-MP Documentation
< Lua | Server | Checkpoint
Returns | Checkpoint |
---|---|
Prototype | Checkpoint.Create(Vector3 position) |
Description | No description |
Contents
Description
Spawns a checkpoint at the given position.
Example
function PlayerChat(args) if args.text == "/spawn" then -- Spawn a checkpoint at the player. Checkpoint.Create(args.player:GetPosition()) return false end return true end Events:Subscribe("PlayerChat", PlayerChat)
Returns | Checkpoint |
---|---|
Prototype | Checkpoint.Create(table args) |
Description | No description |
Description
Spawns a checkpoint using an argument table.
The following arguments are supported:
- string text
- number type (See list at SetType)
- Vector3 position
- Vector3 activation_box (Size of the trigger. Not much is known about this. The recommended value is 12, 12, 12.)
- boolean despawn_on_enter
- boolean create_trigger (Necessary if you want PlayerEnterCheckpoint to fire.)
- boolean create_checkpoint (Shows giant ring of fire, default true)
- boolean create_indicator (Shows middle icon)
- boolean enabled
- World world
Example
function PlayerChat(args) local words = args.text:split(" ") if words[1] == "/spawn" then if words[2] then local spawnArgs = {} spawnArgs.enabled = true spawnArgs.position = args.player:GetPosition() spawnArgs.type = tonumber(words[2]) spawnArgs.world = args.player:GetWorld() Checkpoint.Create(spawnArgs) else args.player:SendChatMessage("Use: /spawn type", Color(200, 100, 100)) end return false end return true end Events:Subscribe("PlayerChat", PlayerChat)