-
Notifications
You must be signed in to change notification settings - Fork 42
/
cmd_spawn.lua
35 lines (30 loc) · 1.02 KB
/
cmd_spawn.lua
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
28
29
30
31
32
33
34
35
function HandleSpawnCommand(Split, Player)
local Response
local MoveToSpawn = function(OtherPlayer)
local World = OtherPlayer:GetWorld()
local SpawnX = World:GetSpawnX()
local SpawnY = World:GetSpawnY()
local SpawnZ = World:GetSpawnZ()
OtherPlayer:TeleportToCoords(SpawnX, SpawnY, SpawnZ)
if Split[2] then
Response = SendMessageSuccess(Player, "Successfully returned player \"" .. OtherPlayer:GetName() .. "\" to world spawn")
else
Response = SendMessageSuccess(Player, "Successfully moved to world spawn")
end
end
if not Split[2] then
if not Player then
Response = SendMessage(nil, "Usage: " .. Split[1] .. " <player>")
else
MoveToSpawn(Player)
end
elseif not Player or Player:HasPermission("core.spawn.others") then
if Split[2] == "" or not cRoot:Get():FindAndDoWithPlayer(Split[2], MoveToSpawn) then
Response = SendMessageFailure(Player, "Player \"" .. Split[2] .. "\" not found")
end
end
return true, Response
end
function HandleConsoleSpawn(Split)
return HandleSpawnCommand(Split)
end