Leal9001

eRPK test 3

Jul 29th, 2012
145
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
mIRC 1.44 KB | None | 0 0
  1. on *:text:*:#: {
  2.   set %chan $chan
  3.   if ($1 == .rank) {
  4.     erpk
  5.     set %id $2
  6.     if ($2 == $null) msg $chan Error: Insufficient parameters
  7.   }
  8.   if ($1 == .dist) {    
  9.     if ($2 == $null) msg $chan Error: Insufficient parameters
  10.     set %ff $2
  11.     set %id $gettok($3,6,47)
  12.     set %ver dist
  13.     erpk
  14.   }
  15. }
  16. alias erpk {
  17.   if ($sock(erpk)) { sockclose erpk }
  18.   sockopen erpk erpk-api.com 80
  19. }
  20.  
  21. on *:sockopen:erpk:{
  22.   sockwrite -n $sockname GET $+(/citizen/profile/,%id,.json?key=wVYjogjGye) HTTP/1.1
  23.   sockwrite -n $sockname Host: erpk-api.com
  24.   sockwrite -n $sockname user-agent: Mozilla/??
  25.   sockwrite -n $sockname Connection: Keep-Alive
  26.   sockwrite -n $sockname $crlf
  27. }
  28. on *:sockread:erpk:{
  29.   if ($sockerr > 0) {
  30.     echo -a SOCKET ERROR: $sockerr
  31.     halt
  32.   }
  33.   sockread &t
  34.   var %sockreader $bvar(&t,$calc($bfind(&t,1,13 10 13 10) + 4) $+ -).text
  35.   if (%ver == dist) {
  36.     set %rankp $gettok(%sockreader,9,44)
  37.     set %rankp $gettok(%rankp,3,58)
  38.     msg %chan Rankpoints: %rankp
  39.     set %str $gettok(%sockreader,8,44)
  40.     set %str $gettok(%str,2,58)
  41.     msg %chan Strenght: %str
  42.     set %rankl $gettok(%sockreader,10,44)
  43.     set %rankl $gettok(%rankl,2,58)
  44.     msg %chan Rank level: %rankl
  45.     set %dmgq5 $calc(((%rankl-1)/20+0.3)*((%str/10)+40)*(1+100/100))
  46.     set %dmgq6 $calc(((%rankl-1)/20+0.3)*((%str/10)+40)*(1+120/100))
  47.     msg %chan Q5 Damage - %dmgq5 / Q6 Damage - %dmgq6
  48.   }
  49.   unset %chan
  50.   unset %id
Advertisement
Add Comment
Please, Sign In to add comment