Advertisement
Guest User

Untitled

a guest
Jan 27th, 2020
143
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.94 KB | None | 0 0
  1. function chat_cprecs($aseco, $command) {
  2. global $tab_sec_recs;
  3. $player = $command['author'];
  4. $login = $command['author']->login;
  5.  
  6. if ($aseco->server->getGame() == 'TMF') {
  7. $aseco->client->query('GetCurrentChallengeInfo');
  8. $CurrentChallengeInfo = $aseco->client->getResponse();
  9. $challenge = $CurrentChallengeInfo['UId'];
  10. $challenge_name = $CurrentChallengeInfo['Name'];
  11. $query_check = "SELECT Sector FROM `cprecs` WHERE ChallengeID='".$challenge."' ORDER BY Sector DESC LIMIT 1;";
  12. $result_check = mysql_query($query_check);
  13. while($row_check = mysql_fetch_object($result_check)) {
  14. $test_check = $row_check->Sector;
  15. }
  16.  
  17. if ($test_check) {
  18. $header = $aseco->formatColors("Best CP Records on: ".$challenge_name."");
  19. $msg = array();
  20. $lines = 0;
  21. $player->msgs = array();
  22. $player->msgs[0] = array(1, $header, array(1.2, 0.15, 0.2, 0.4, 0.15));
  23. $msg[] = array('CP', 'Time', 'Player');
  24. foreach($tab_sec_recs as $value) {
  25. $sec = $value->cp;
  26. $nickt = mysql_fetch_object(mysql_query("SELECT `NickName` FROM `players` WHERE `Login` = '".$value->login."';"));
  27. if(strlen($sec) == 1){$sec = $sec;}
  28. if ($sec === $test_check) {
  29. $check_name = '{#record}Finish{#highlite}';
  30. } else {
  31. $check_name = '{#highlite}'.$sec.'';
  32. }
  33.  
  34. //Adding line to the ManiaLink window
  35. $msg[] = array(str_pad($check_name, 2, '0', STR_PAD_LEFT), SecToTime($value->time,false), $nickt->NickName);
  36. $lines++;
  37.  
  38. if ($lines > 17) {
  39. $player->msgs[] = $msg;
  40. $lines = 0;
  41. $msg = array();
  42. }
  43. }
  44. // add if last batch exists
  45. if (!empty($msg))
  46. $player->msgs[] = $msg;
  47. // display ManiaLink message
  48. display_manialink_multi($player);
  49. } else {
  50. $message = '$z$s$f00Note: $z$s$fffCurrently no Checkpoint Records on: '.$challenge_name.'$z$s$fff!';
  51. $aseco->client->query('ChatSendServerMessageToLogin', $aseco->formatColors($message), $login);
  52. }
  53.  
  54. }
  55. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement