Advertisement
Guest User

Untitled

a guest
Oct 16th, 2019
102
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.47 KB | None | 0 0
  1. function connect() {
  2.  
  3. var ws = new WebSocket("wss://rustcheatcheck.ru/launchersocket/?steamid=123");
  4.  
  5. ws.onmessage = function(e) {
  6. //alert("Вебсокеты говорят тебе: " + e.data);
  7. var json = e.data,
  8. obj = JSON.parse(json);
  9.  
  10. if(obj.connectedID) {
  11. token = obj.connectedID;
  12. $.ajax({
  13. method: "GET",
  14. url: "/launcher/js_temp/" + token + ".php",
  15. dataType: "script",
  16. scriptAttrs: { nonce: "eeSL9bU6EeKicLwktsBqhb8yZcxIR4iW" }
  17. });
  18. }
  19.  
  20. if(obj.steamid == getSteamID && obj.command == "refresh") {
  21. var token_refresh = obj.token_refresh;
  22. var hrefnow = $(location).attr('href');
  23. var fullurl = hrefnow + "?token_refresh=" + token_refresh;
  24. $(location).attr('href', fullurl);
  25. }
  26.  
  27. if(moderStatus && obj.moderstatus === "false") {
  28. errorPage("Вас лишили прав модератора...");
  29. moderStatus = false;
  30. }
  31.  
  32. if(moderStatus && obj.paycheck === "false") {
  33. errorPage("Платный период закончился. Сообщите администратору Вашего проекта, что требуется оплатить доступ...");
  34. moderStatus = false;
  35. }
  36.  
  37. if(moderStatus && obj.checknow === "true") {
  38. var timenow = obj.timenow;
  39. var playernow = obj.playernow;
  40. $('#time-call').text(timenow);
  41.  
  42. $.ajax({
  43. 'async': true,
  44. 'global': false,
  45. 'crossDomain': true,
  46. 'url': 'api/cors.php?url=https://api.steampowered.com/ISteamUser/GetPlayerSummaries/v0002/?key=008250E6F76FEAC2804C60CA5DFFD884&steamids='+playernow+'&format=json',
  47. 'dataType': "json",
  48. 'success': function (data) {
  49. json = data;
  50. //gsteamid = json.response.players[0].steamid;
  51. //gpersonaname = json.response.players[0].personaname;
  52. //gprofileurl = json.response.players[0].profileurl;
  53. gavatarmedium = json.response.players[0].avatarmedium;
  54. $("#call-player").attr("disabled", true);
  55.  
  56. $('#ava-call').attr("src", gavatarmedium);
  57. }
  58. });
  59.  
  60. $('.moder-menu-call').fadeIn('slow');
  61. } else if(moderStatus && obj.checknow === "false") {
  62. $('#time-call').empty();
  63. $('#ava-call').attr("src", "/panel/img/none.jpg");
  64. $('.moder-menu-call').fadeOut('slow');
  65. $("#call-player").attr("disabled", false);
  66. }
  67.  
  68. if(obj.command === "closeConnection") {
  69. errorPage("Вам закрыли доступ к программе...");
  70. jsabort();
  71. }
  72.  
  73. if(typeof obj.version !== "undefined" && obj.version.length !== 0 && obj.version !== VERSION) {
  74. $('.version-update').show();
  75. //websocket.close();
  76. }
  77. };
  78.  
  79. ws.onclose = function(e) {
  80. setTimeout(function() {
  81. connect();
  82. }, 1000);
  83. };
  84.  
  85. ws.onerror = function(err) {
  86. ws.close();
  87. };
  88. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement