// ################################################## // PlayerLights // By RabidToaster // ################################################## if ( SERVER ) then return end // This has no use on the server. CreateConVar( "playerlights_enabled", 1, FCVAR_ARCHIVE ) CreateConVar( "playerlights_brightness", 6, FCVAR_ARCHIVE ) CreateConVar( "playerlights_size", 128, FCVAR_ARCHIVE ) CreateConVar( "playerlights_ff", 0, FCVAR_ARCHIVE ) local function Think() if ( GetConVarNumber( "playerlights_enabled" ) <= 0 ) then return end local localPly = LocalPlayer() if ( !ValidEntity( localPly ) ) then return end local localTeam = localPly:Team() local brightness = GetConVarNumber( "playerlights_brightness" ) local size = GetConVarNumber( "playerlights_size" ) local ff = GetConVarNumber( "playerlights_ff" ) > 0 for _, ply in pairs( player.GetAll() ) do if ( ply:Alive() && ply != localPly && ( ff || ply:Team() != localTeam ) ) then local light = DynamicLight( ply:EntIndex() ) if ( light ) then local colour = team.GetColor( ply:Team() ) light.Pos = ply:GetPos() + Vector( 0, 0, 10 ) light.r = colour.r light.g = colour.g light.b = colour.b light.Brightness = brightness light.Decay = size * 5 light.Size = size light.DieTime = CurTime() + 1 end end end end hook.Add( "Think", "PlayerLights.Think", Think )