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
|
||||
--printHud(Color(250,150,50), "Cannot lock controls, exiting!")
|
||||
net.start("LSFT-Stop-Spectate")
|
||||
net.writeString("Cannot lock controls!")
|
||||
net.send()
|
||||
return
|
||||
end
|
||||
|
@ -66,6 +67,11 @@ if player() == owner() then do
|
|||
hook.remove("calcview", "freecam")
|
||||
|
||||
net.start("LSFT-Stop-Spectate")
|
||||
if not target:isValid() or not target:isPlayer() then
|
||||
net.writeString("Invalid target!")
|
||||
else
|
||||
net.writeString("")
|
||||
end
|
||||
net.send()
|
||||
return
|
||||
end
|
||||
|
@ -110,6 +116,7 @@ if player() == owner() then do
|
|||
timer.remove("updateholo")
|
||||
|
||||
net.start("LSFT-Stop-Spectate")
|
||||
net.writeString("")
|
||||
net.send()
|
||||
return
|
||||
end
|
||||
|
|
|
@ -11,8 +11,8 @@ TODO: Let user open chatbox
|
|||
|
||||
do
|
||||
local function spectate(args)
|
||||
local function stopSpectate()
|
||||
core:log(log.INFO, "Stopped spectating.")
|
||||
local function stopSpectate(reason)
|
||||
core:log(log.INFO, "Stopped spectating."..(#reason > 0 and "Reason: "..reason or ""))
|
||||
owner():setViewEntity()
|
||||
if loadHolo ~= nil then
|
||||
loadHolo:remove()
|
||||
|
@ -22,13 +22,13 @@ do
|
|||
local loadHolo = nil
|
||||
|
||||
net.receive("LSFT-Stop-Spectate", function()
|
||||
stopSpectate()
|
||||
stopSpectate(net.readString())
|
||||
end)
|
||||
|
||||
net.receive("LSFT-Teleport-Spectate", function()
|
||||
local coords = net.readVector()
|
||||
teleport:tpteleport({coords.x, coords.y, coords.z})
|
||||
stopSpectate()
|
||||
stopSpectate("")
|
||||
end)
|
||||
|
||||
net.start("LSFT-Start-Spectate")
|
||||
|
|
Loading…
Reference in a new issue