local CATEGORY_NAME = "Entity Suite"
function ulx.view( ply, target, should_exit, should_silent )
if not should_silent then
if not should_exit then
if ply == ply then
ULib.tsayError( ply, "You can't spectate yourself!" )
ply:Spectate( OBS_MODE_IN_EYE )
local undoscreen = ply:GetMoveType()
ply:SetMoveType( MOVETYPE_OBSERVER )
ply:SpectateEntity( target )
ulx.fancyLogAdmin( ply, "#A see #T's screen.", target )
else
ply:Spectate( OBS_MODE_NONE )
ply:SetMoveType( undoscreen )
ulx.fancyLogAdmin( ply, "#A stopped seeing #T's screen.", target )
end
end
elseif should_silent then
if not should_exit then
if ply == ply then
ULib.tsayError( ply, "You can't spectate yourself!" )
ply:Spectate( OBS_MODE_IN_EYE )
local undoscreen = ply:GetMoveType()
ply:SetMoveType( MOVETYPE_OBSERVER )
ply:SpectateEntity( target )
ulx.fancyLogAdmin( ply, true, "#A see #T's screen.", target )
else
ply:Spectate( OBS_MODE_NONE )
ply:SetMoveType( undoscreen )
ulx.fancyLogAdmin( ply, "#A stopped seeing #T's screen.", target )
end
end
end
end
local view = ulx.command( CATEGORY_NAME, "ulx view", ulx.view, "!view" )
view:defaultAccess( ULib.ACCESS_SUPERADMIN )
view:addParam{ type = ULib.PlayerArg, hint = "spectatee" }
view:help( "Spectate a target." )
view:setOpposite( "ulx stopview", { _, _, true }, "!stopview" )
view:setOpposite( "ulx sview", { _, _, _, true }, "!sview" )