Spectator now uses new helper functions
This commit is contained in:
parent
8b6ecac597
commit
4ca3dac3df
1 changed files with 8 additions and 18 deletions
|
@ -5,6 +5,7 @@
|
|||
--[[
|
||||
TODO: Custom HUD (health, armor, etc)
|
||||
TODO: Grab binds from game instead of settings
|
||||
TODO: Send viewmodel to client and create hologram of viewmodel
|
||||
TODO: Let user open chatbox
|
||||
--]]
|
||||
|
||||
|
@ -37,7 +38,7 @@ do
|
|||
core:log(log.ERROR, "Cannot spawn hologram for freecam!")
|
||||
end
|
||||
loadHolo = holograms.create(chip():getPos(), Angle(0,0,0), "models/hunter/blocks/cube025x025x025.mdl")
|
||||
loadHolo:setColor(Color(255,255,255,0))
|
||||
loadHolo:setColor(Color(0,0,0,0))
|
||||
owner():setViewEntity(loadHolo)
|
||||
|
||||
net.receive("LSFT-LoadHolo-Update", function()
|
||||
|
@ -50,27 +51,16 @@ do
|
|||
return
|
||||
end
|
||||
|
||||
local targets = find.playersByName(args[1])
|
||||
|
||||
if #targets == 0 or targets == nil then
|
||||
core:log(log.ERROR, "No targets found!")
|
||||
return
|
||||
elseif #targets > 1 then
|
||||
local list = ""
|
||||
for i, v in pairs(target) do
|
||||
list = list..v..", "
|
||||
end
|
||||
|
||||
list:sub(1, -2)
|
||||
core:log(log.ERROR, "Muliple targets found! ("..list..")")
|
||||
local target = core:get_entity(args[1])
|
||||
if target == nil then
|
||||
return
|
||||
end
|
||||
|
||||
if targets[1]:isPlayer() then
|
||||
core:log(log.INFO, "Started spectating \""..targets[1]:getName().."\".")
|
||||
net.writeEntity(targets[1])
|
||||
if target:isPlayer() then
|
||||
core:log(log.INFO, "Started spectating \""..target:getName().."\".")
|
||||
net.writeEntity(target)
|
||||
net.send()
|
||||
owner():setViewEntity(targets[1])
|
||||
owner():setViewEntity(target)
|
||||
end
|
||||
end
|
||||
|
||||
|
|
Loading…
Reference in a new issue