forked from cuberite/Core
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathspawn.lua
More file actions
27 lines (24 loc) · 996 Bytes
/
spawn.lua
File metadata and controls
27 lines (24 loc) · 996 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
27
function HandleSpawnCommand(Split, Player)
SpawnX = WorldIni:GetValue("SpawnPosition", "X")
SpawnY = WorldIni:GetValue("SpawnPosition", "Y")
SpawnZ = WorldIni:GetValue("SpawnPosition", "Z")
World = Player:GetWorld()
SetBackCoordinates(Player)
Player:TeleportToCoords(SpawnX, SpawnY, SpawnZ)
SendMessageSuccess( Player, "Returned to world spawn" )
return true
end
function HandleSetSpawnCommand(Split, Player)
PlayerX = Player:GetPosX()
PlayerY = Player:GetPosY()
PlayerZ = Player:GetPosZ()
WorldIni:DeleteValue("SpawnPosition", "X")
WorldIni:DeleteValue("SpawnPosition", "Y")
WorldIni:DeleteValue("SpawnPosition", "Z")
WorldIni:SetValue("SpawnPosition", "X", PlayerX)
WorldIni:SetValue("SpawnPosition", "Y", PlayerY)
WorldIni:SetValue("SpawnPosition", "Z", PlayerZ)
WorldIni:WriteFile()
SendMessageSuccess( Player, "Changed spawn position to "..Player:GetPosX()..", "..Player:GetPosY()..", "..Player:GetPosZ() )
return true
end