Added stopped spectating reasons, spectator sometimes stops working for no reason
This commit is contained in:
parent
f86197d493
commit
236977ba5c
2 changed files with 12 additions and 5 deletions
|
@ -54,6 +54,7 @@ if player() == owner() then do
|
||||||
else
|
else
|
||||||
--printHud(Color(250,150,50), "Cannot lock controls, exiting!")
|
--printHud(Color(250,150,50), "Cannot lock controls, exiting!")
|
||||||
net.start("LSFT-Stop-Spectate")
|
net.start("LSFT-Stop-Spectate")
|
||||||
|
net.writeString("Cannot lock controls!")
|
||||||
net.send()
|
net.send()
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
|
@ -64,8 +65,13 @@ if player() == owner() then do
|
||||||
if not input.isControlLocked() or not target:isValid() or not target:isPlayer() then
|
if not input.isControlLocked() or not target:isValid() or not target:isPlayer() then
|
||||||
--printHud(Color(250,150,50), "Controls are no longer locked, exiting!")
|
--printHud(Color(250,150,50), "Controls are no longer locked, exiting!")
|
||||||
hook.remove("calcview", "freecam")
|
hook.remove("calcview", "freecam")
|
||||||
|
|
||||||
net.start("LSFT-Stop-Spectate")
|
net.start("LSFT-Stop-Spectate")
|
||||||
|
if not target:isValid() or not target:isPlayer() then
|
||||||
|
net.writeString("Invalid target!")
|
||||||
|
else
|
||||||
|
net.writeString("")
|
||||||
|
end
|
||||||
net.send()
|
net.send()
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
|
@ -110,6 +116,7 @@ if player() == owner() then do
|
||||||
timer.remove("updateholo")
|
timer.remove("updateholo")
|
||||||
|
|
||||||
net.start("LSFT-Stop-Spectate")
|
net.start("LSFT-Stop-Spectate")
|
||||||
|
net.writeString("")
|
||||||
net.send()
|
net.send()
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
|
|
|
@ -11,8 +11,8 @@ TODO: Let user open chatbox
|
||||||
|
|
||||||
do
|
do
|
||||||
local function spectate(args)
|
local function spectate(args)
|
||||||
local function stopSpectate()
|
local function stopSpectate(reason)
|
||||||
core:log(log.INFO, "Stopped spectating.")
|
core:log(log.INFO, "Stopped spectating."..(#reason > 0 and "Reason: "..reason or ""))
|
||||||
owner():setViewEntity()
|
owner():setViewEntity()
|
||||||
if loadHolo ~= nil then
|
if loadHolo ~= nil then
|
||||||
loadHolo:remove()
|
loadHolo:remove()
|
||||||
|
@ -22,13 +22,13 @@ do
|
||||||
local loadHolo = nil
|
local loadHolo = nil
|
||||||
|
|
||||||
net.receive("LSFT-Stop-Spectate", function()
|
net.receive("LSFT-Stop-Spectate", function()
|
||||||
stopSpectate()
|
stopSpectate(net.readString())
|
||||||
end)
|
end)
|
||||||
|
|
||||||
net.receive("LSFT-Teleport-Spectate", function()
|
net.receive("LSFT-Teleport-Spectate", function()
|
||||||
local coords = net.readVector()
|
local coords = net.readVector()
|
||||||
teleport:tpteleport({coords.x, coords.y, coords.z})
|
teleport:tpteleport({coords.x, coords.y, coords.z})
|
||||||
stopSpectate()
|
stopSpectate("")
|
||||||
end)
|
end)
|
||||||
|
|
||||||
net.start("LSFT-Start-Spectate")
|
net.start("LSFT-Start-Spectate")
|
||||||
|
|
Loading…
Reference in a new issue