morsisko

Look here:

Jan 5th, 2016
38
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.19 KB | None | 0 0
  1. #include <String.au3>
  2.  
  3. Func getData()
  4. $manager = ObjCreate('winhttp.winhttprequest.5.1')
  5. $url = "http://kapitalny.com/projects/mpc/my_name_is_dzejson.php"
  6. $manager.open('GET', $url)
  7. $manager.SetRequestHeader('Content-Type', 'application/x-www-form-urlencoded')
  8. $manager.send("")
  9. $manager.WaitForResponse()
  10. $code = $manager.ResponseText()
  11.  
  12. Return $code
  13. EndFunc
  14.  
  15.  
  16.  
  17. Func main()
  18. Local $lenOfArray = 0
  19.  
  20. $code = getData()
  21. $nicknames = _StringBetween($code, '"nick": "', '",')
  22. If @error Then
  23. MsgBox(16, "Error", "Tu nie ma zadnego nicku")
  24. Return
  25. EndIf
  26.  
  27. $points = _StringBetween($code, '"points": ', ' ')
  28. If @error Then
  29. MsgBox(16, "Error", "Tu nie ma zadnych punktow")
  30. Return
  31. EndIf
  32.  
  33. If UBound($nicknames) <> UBound($points) Then
  34. MsgBox(16, "Error", "Cos sie nie zgadza")
  35. Return
  36. Else
  37. $lenOfArray = UBound($nicknames)
  38. EndIf
  39. Local $properNickArray = $nicknames
  40. Local $properPointsArray = $points
  41.  
  42. For $i = 0 To $lenOfArray - 1
  43. $properPointsArray[$i] = StringStripWS($points[$i], 3)
  44. $properNickArray[$i] = StringStripWS($nicknames[$i], 3)
  45. Next
  46.  
  47. For $i = 0 To $lenOfArray - 1
  48. $properPointsArray[$i] = Number($properPointsArray[$i])
  49. Next
  50.  
  51. ;bombelki, duzo bombelkow
  52. $counter = $lenOfArray - 1
  53. For $i = 0 To $counter - 1
  54. For $j = 0 To $counter - $i - 1
  55. If $properPointsArray[$j] < $properPointsArray[$j+1] Then
  56. $tempPoints = $properPointsArray[$j+1]
  57. $tempNick = $properNickArray[$j+1]
  58. $properPointsArray[$j+1] = $properPointsArray[$j]
  59. $properPointsArray[$j] = $tempPoints
  60.  
  61. $properNickArray[$j+1] = $properNickArray[$j]
  62. $properNickArray[$j] = $tempNick
  63. EndIf
  64. Next
  65. Next
  66.  
  67.  
  68. ConsoleWrite("Position | Nick | Points" & @CRLF)
  69. ConsoleWrite("---------|--------|-------" & @CRLF)
  70. $index = 0
  71. $tempPoints = $properPointsArray[0]
  72. $indexToPrint = 0
  73. For $i = 0 To $lenOfArray - 1
  74. If $tempPoints = $properPointsArray[$i] Then
  75. $indexToPrint = $index
  76. Else
  77. $indexToPrint = $i
  78. $index = $indexToPrint
  79. EndIf
  80.  
  81. $tempPoints = $properPointsArray[$i]
  82.  
  83. ConsoleWrite($indexToPrint + 1 & " | " & $properNickArray[$i] & " | " & $properPointsArray[$i] & @CRLF)
  84. Next
  85.  
  86.  
  87. EndFunc
  88.  
  89. main()
Advertisement
Add Comment
Please, Sign In to add comment