-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathinit.lua
More file actions
26 lines (20 loc) · 736 Bytes
/
Copy pathinit.lua
File metadata and controls
26 lines (20 loc) · 736 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
local spawn = core.settings:get_pos("simple_spawn_pos") or -- default
core.settings:get_pos("static_spawnpoint") -- fallback
core.register_on_joinplayer(function(player, lastlogin)
if lastlogin then return end
if not spawn then
core.log("error", "Simple Spawn: No spawn positions set.")
end
player:set_pos(spawn)
return true, spawn
end)
core.register_chatcommand("spawn", {
description = "Go to spawn.",
func = function(name)
local player = core.get_player_by_name(name)
if not player then return false end
if not spawn then return false, "No spawn positions set." end
player:set_pos(spawn)
return true, "Teleported to spawn."
end
})