Advertisement
Guest User

Untitled

a guest
Sep 9th, 2013
55
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.83 KB | None | 0 0
  1. //REPLACE THIS
  2. //Run query
  3. $res = mysql_query($sql);
  4. if (!$res)
  5. return error(mysql_error());
  6.  
  7. $items = explode("\n", file_get_contents("items.txt"));
  8. $itemhash = array();
  9. foreach($items as $i) {
  10. $item = explode(",", $i, 2);
  11. if (count($item) < 2) continue;
  12. if(isset($item[0]) && isset($item[1])) $itemhash[$item[0]] = $item[1];
  13. }
  14. $results = array();
  15.  
  16.  
  17. // Replace this!!
  18. function getBlockName($string) {
  19. global $itemhash;
  20.  
  21. $parts = explode(":", $string);
  22.  
  23. if ($string == "00")
  24. return "AIR";
  25. if ($string == "0")
  26. return "AIR";
  27.  
  28. $i = $itemhash[$string];
  29. if ($i != null)
  30. return $i;
  31.  
  32. if (!isset($itemhash[$parts[0]])) return $string;
  33.  
  34. $i = $itemhash[$parts[0]];
  35.  
  36. if (count($parts) == 2)
  37. return $i . ":" . $parts[1];
  38. else
  39. return $i;
  40. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement