Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <String.au3>
- Func getData()
- $manager = ObjCreate('winhttp.winhttprequest.5.1')
- $url = "http://kapitalny.com/projects/mpc/my_name_is_dzejson.php"
- $manager.open('GET', $url)
- $manager.SetRequestHeader('Content-Type', 'application/x-www-form-urlencoded')
- $manager.send("")
- $manager.WaitForResponse()
- $code = $manager.ResponseText()
- Return $code
- EndFunc
- Func main()
- Local $lenOfArray = 0
- $code = getData()
- $nicknames = _StringBetween($code, '"nick": "', '",')
- If @error Then
- MsgBox(16, "Error", "Tu nie ma zadnego nicku")
- Return
- EndIf
- $points = _StringBetween($code, '"points": ', ' ')
- If @error Then
- MsgBox(16, "Error", "Tu nie ma zadnych punktow")
- Return
- EndIf
- If UBound($nicknames) <> UBound($points) Then
- MsgBox(16, "Error", "Cos sie nie zgadza")
- Return
- Else
- $lenOfArray = UBound($nicknames)
- EndIf
- Local $properNickArray = $nicknames
- Local $properPointsArray = $points
- For $i = 0 To $lenOfArray - 1
- $properPointsArray[$i] = StringStripWS($points[$i], 3)
- $properNickArray[$i] = StringStripWS($nicknames[$i], 3)
- Next
- For $i = 0 To $lenOfArray - 1
- $properPointsArray[$i] = Number($properPointsArray[$i])
- Next
- ;bombelki, duzo bombelkow
- $counter = $lenOfArray - 1
- For $i = 0 To $counter - 1
- For $j = 0 To $counter - $i - 1
- If $properPointsArray[$j] < $properPointsArray[$j+1] Then
- $tempPoints = $properPointsArray[$j+1]
- $tempNick = $properNickArray[$j+1]
- $properPointsArray[$j+1] = $properPointsArray[$j]
- $properPointsArray[$j] = $tempPoints
- $properNickArray[$j+1] = $properNickArray[$j]
- $properNickArray[$j] = $tempNick
- EndIf
- Next
- Next
- ConsoleWrite("Position | Nick | Points" & @CRLF)
- ConsoleWrite("---------|--------|-------" & @CRLF)
- $index = 0
- $tempPoints = $properPointsArray[0]
- $indexToPrint = 0
- For $i = 0 To $lenOfArray - 1
- If $tempPoints = $properPointsArray[$i] Then
- $indexToPrint = $index
- Else
- $indexToPrint = $i
- $index = $indexToPrint
- EndIf
- $tempPoints = $properPointsArray[$i]
- ConsoleWrite($indexToPrint + 1 & " | " & $properNickArray[$i] & " | " & $properPointsArray[$i] & @CRLF)
- Next
- EndFunc
- main()
Advertisement
Add Comment
Please, Sign In to add comment