Unsupported PHP app for analysing and displaying stats for Team Fortress 2
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

ext.php 1.5KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556
  1. <?PHP
  2. // Displays extra information about a map in the left-hand column
  3. // of the map page. You may want to include information on class
  4. // limits, the times the map is played, or links to downloads or
  5. // reviews.
  6. function show_extra_map_info($name) {
  7. $cfgdir = '/opt/sourceds/orangebox/tf/cfg/beetlesmod';
  8. if (file_exists($cfgdir.'/'.$name.'.cfg')) {
  9. $cfg = array();
  10. foreach (file($cfgdir . '/' . $name . '.cfg') as $line) {
  11. if (!empty($line) && strstr($line,'//') != $line) {
  12. $bits = explode(' ', $line, 2);
  13. $cfg[strtolower($bits[0])][] = $bits[1];
  14. }
  15. }
  16. if (isset($cfg['setclasslimit'])) {
  17. echo '<h3>Class Limits</h3>';
  18. echo '<ul class="classlimits">';
  19. $all = count($cfg['setclasslimit']) == 10;
  20. foreach ($cfg['setclasslimit'] as $limit) {
  21. preg_match('/\"(.*)\" \"(.*)\" \"(.*)\"/', $limit, $details);
  22. if (strtolower($details[1]) != "random") {
  23. if ($all && $details[2] == "0") { continue; }
  24. if ($details[2] == "-1") {
  25. $details[2] = 'No Restriction';
  26. } else if ($details[2] == "0") {
  27. $details[2] = 'Not Permitted';
  28. } else {
  29. $details[2] = 'Maximum of '.$details[2].' per team';
  30. }
  31. echo '<li><img src="' . sprintf(URL_CLASS, 'blue', $details[1]) . '"> ' . $details[2];
  32. if ($details[3] != "0.0") {
  33. $num = ($maxplayers/2) * ((float)$details[3]);
  34. echo ' ('.$num.')';
  35. }
  36. }
  37. }
  38. if ($all) { echo '<li> No other class permitted'; }
  39. echo '</ul>';
  40. }
  41. }
  42. }
  43. ?>