function GetMaterial($name, $type = 'img', $path = '') { // This is shit path munging, fix it $pathparts = array_filter(array_merge(explode("/", preg_replace('/\\.(vmt|vtf|png)$/', '', "{$path}/{$name}")))); if ($pathparts[0] != 'materials') { array_unshift($pathparts, 'materials'); } $filepath = implode("/", $pathparts); // If we have a PNG, just send it if (file_exists(GetDataFile("{$filepath}.png"))) { return GetDataURL("{$filepath}.png"); } // Try to use VMT to get image if (file_exists(GetDataFile("{$filepath}.vmt"))) { $vmt = file_get_contents(GetDataFile("{$filepath}.vmt")); preg_match_all('/basetexture[" ]+([^"\\s]*)/', $vmt, $matches); return GetMaterial($matches[1][0], $type); /* if (file_exists(GetDataFile("{$matches[1][0]}.png"))) { return GetDataURL("{$$matches[1][0]}.png"); } */ } // No hope return ''; }
margin-left: -32px; margin-top: -32px; vertical-align:middle; text-align:center; word-wrap: break-word; color: #fff; font-weight:bold; font-size:1.5em; line-height: 64px; z-index: 100; } <?php $colors = array('noteam' => '255,255,255', 'neutral' => '132,150,28', 'friend' => '83,157,178', 'enemy' => '172,64,41', 'maparea' => '109,96,80'); foreach ($colors as $color => $rgb) { $code = explode(',', $rgb); echo "\n\t.{$color} {\n\t\tbackground-color: rgb({$rgb});\n\t}\n\t.obj_{$color}_bg {\n\t\tbackground-color: rgba({$rgb},0.5);\n\t\t-webkit-mask-image: url('" . GetDataURL("materials/vgui/hud/obj_cache_{$color}.png") . "');\n\t}\n\t.obj_{$color}_fg {\n\t\tbackground-image: url('images/maps/c_obj_{$color}.png');\n\t}\n\t.obj_cache_{$color}_bg {\n\t\tbackground-color: rgba({$rgb},0.5);\n\t\t-webkit-mask-image: url('" . GetDataURL("materials/vgui/hud/obj_cache_{$color}.png") . "');\n\t}\n\t.obj_cache_{$color}_fg {\n\t\tbackground-image: url('images/maps/c_obj_cache_{$color}.png');\n\t}\n"; } ?> .canvas { top: 0; left: 0; z-index: -10; position: absolute; width: 100%; height: 1024px; } .area{ vertical-align: middle; -moz-box-sizing: border-box; -webkit-box-sizing: border-box;