/addons/anyname/lua/autorun/sh_player_nocollision.lua
if SERVER then
local function disableCollide(pl)
timer.Simple(.5, function()
if IsValid(pl) then
pl:SetCollisionGroup(COLLISION_GROUP_DEBRIS_TRIGGER)
pl:SetAvoidPlayers(false)
end
end)
end
hook.Add("PlayerSpawn", "no_collide", disableCollide)
hook.Add("OnPlayerChangedTeam", "no_collide", disableCollide)
else
local affectedPlayers = {}
hook.Add("PostPlayerDraw", "see_through", function(pl)
if pl == LocalPlayer() then return end
if RealTime() - (pl.lastvischeck or 0) <= .1 then return end
pl.lastvischeck = RealTime()
local dist = EyePos():DistToSqr(pl:EyePos())
if dist < 2000 then
affectedPlayers[pl] = true
pl:SetMaterial("phoenix_storms/glass")
elseif (affectedPlayers[pl]) then
affectedPlayers[pl] = nil
pl:SetMaterial("")
end
end)
end
Дополнительно добавляет красивый визуальный эффект при приближении к игроку (делает его полупрозрачным)