Jump to content

miRC Scripting: find Steamid from irc


Sponz
 Share

Recommended Posts

Tittle says everything.

Script:

on *:text:.steamhelp:* { 
  inc -u30 %wonflood. [ $+ [ $nick ] ] 
  if ((%wonflood. [ $+ [ $nick ] ] > 2) || ($var(%wonflood.*,0) > 2)) halt 

  notice $nick $makecell(Command,30,l) $+ Description 
  notice $nick $makecell(.steamid <steamid>,30,l) $+ Lookup a single SteamID. ex: 0:0:12345
  notice $nick $makecell(.steamid <steamid> $+ $chr(44) $+ $chr(0160) $+ <steamid>,30,l) $+ Lookup multiple STEAMID's separated by commas 
  notice $nick $makecell(.steamid name <name>,30,l) $+ Lookup a player by name 
  notice $nick $makecell(.steamid alias <alias>,30,l) $+ Lookup a player by alias. 
  notice $nick $makecell(.steamid team <name>,30,l) $+ Lookup a player by their team name 
  notice $nick $makecell(.steamid tag <tag>,30,l) $+ Lookup a player by their team tag 
  notice $nick $makecell(.steamid irc <channel>,30,l) $+ Lookup a player by their IRC channel 
  notice $nick $makecell(.steamid rcon <server> <pass>,30,l) $+ Lookup a server via RCON (PM $me $+ ) 
  notice $nick $makecell(Use * for wildcard searches.,30,l) $+ Example .steamid alias *dead* for all possible results for a name containing dead.  Use with alias, IRC, Team & Tag searches.
} 

on *:text:.steamid *:* { 
  var %string, %query, %key, %null, %limit, %server, %pass 

  inc -u30 %wonflood. [ $+ [ $nick ] ] 
  if ((%wonflood. [ $+ [ $nick ] ] > 3) || ($var(%wonflood.*,0) > 4)) halt 

  ;; store nic and chan 
  %to.nick = $nick 
  %to.chan = $chan 

  ;; limit the number of results 
  %limit = 5 

  ;; base query string 
  %querystring = /index.php?output=xml&version=extended&limit= $+ %limit 
  %httpstring = http://steamid.elite-pimps.com/ 

  ;; we're doing a batch steamid search ifs 
  if ($regex($2-,/^[0-9:]+(\s* $+ $chr(44) $+ \s*[0-9:]+)*$/)) { 
    %query = $2- 
    %querystring = %querystring $+ &action=search&type=mass&format=comma&query= $+ $urlencode(%query) 
    %httpstring = %httpstring $+ ?action=search&type=mass&format=comma&query= $+ $urlencode(%query) 
  } 

  ;; we're doing an rcon search if 
  else if ($regex($2-,/rcon\s.+\s.+/)) { 
    %null = $regsub($2-,/^\w+\s/,,%string) 
    %null = $regsub(%string,/\s.+$/,,%server) 
    %null = $regsub(%string,/^.+\s/,,%pass) 

    %querystring = %querystring $+ &action=search&type=rcon&server= $+ %server $+ &pass= $+ %pass 
    %httpstring = %httpstring $+ ?action=search&type=rcon&server= $+ %server $+ &pass= $+ %pass 
  } 

  ;; else we're doing a keyword search 
  else { 
    %null = $regsub($2-,/\s.+$/,,%key) 
    %null = $regsub($2-,/^\w+\s/,,%query) 

    %querystring = %querystring $+ &action=search&type=single&key= $+ %key $+ &query= $+ $urlencode(%query) 
    %httpstring = %httpstring $+ ?action=search&type=single&key= $+ %key $+ &query= $+ $urlencode(%query) 
  } 

  ;; figure out if we're replying to a channel or a person 
  if (!$chan) %to = $nick 
  else %to = $chan 

  sockclose steamid 
  sockopen steamid steamid.elite-pimps.com 80 
} 

on *:sockopen:steamid: { 
  sockwrite -n $sockname POST %querystring HTTP/1.1 
  sockwrite -n $sockname Connection: keep-alive 
  sockwrite -n $sockname Host: steamid.elite-pimps.com 
  sockwrite -n $sockname Connection: Close 
  sockwrite -n $sockname Content-Length: 0 
  sockwrite -n $sockname $crlf 
} 

on *:sockread:steamid: { 
  if ($sockerr > 0) { 
    msg %to Error 
    halt 
  } 
  else { 
    var %buffer, %message, %remainder, %msg 
    sockread %buffer 

    if (<total_results>*</total_results> iswm %buffer) { 
      %count = $nohtml(%buffer) 
      if (!%count) %count = 0 
      if (%count > 0) msg %to $makecell( STEAMID,15,l,00,14) $+ $makecell(Alias,15,l,00,14) $+ $makecell(Team,19,l,00,14) $+ $makecell(Channel,15,l,00,14) $+ $makecell(Division,11,l,00,14) $+ $makecell(Record,8,l,00,14) $+ $makecell(Banned,7,r,00,14) 
    } 
    else if (<ban_status>*</ban_status> iswm %buffer) { 
      %info.banstatus = $nohtml(%buffer) 
      if (%info.banstatus > 0) %info.banstatus = 4,1Yes15,1 
      else %info.banstatus = No 
    } 
    else if (<query_time>*</query_time> iswm %buffer) %querytime = $nohtml(%buffer) 
    else if (<player_alias>*</player_alias> iswm %buffer) %info.alias = $nohtml(%buffer) 
    else if (<player_steamid>*</player_steamid> iswm %buffer) %info.steamid = $nohtml(%buffer) 
    else if (<team_name>*</team_name> iswm %buffer) %info.teamname = $nohtml(%buffer) 
    else if (<team_game>*</team_game> iswm %buffer) %info.game = $nohtml(%buffer) 
    else if (<team_league>*</team_league> iswm %buffer) %info.league = $nohtml(%buffer) 
    else if (<team_division>*</team_division> iswm %buffer) %info.division = $nohtml(%buffer) 
    else if (<team_irc>*</team_irc> iswm %buffer) %info.irc = $nohtml(%buffer) 
    else if (<team_record>*</team_record> iswm %buffer) %info.record = $nohtml(%buffer) 
    else if (</result> iswm %buffer) { 
      msg %to $makecell(%info.steamid,15,l,15,01) $+ $makecell(%info.alias,15,l,15,01) $+ $makecell(%info.teamname,19,l,15,01) $+ $makecell(%info.irc,15,l,15,01) $+ $makecell($upper(%info.game) $upper(%info.league) $+ - $+ %info.division,11,l,15,01) $+ $makecell(%info.record,8,l,15,01) $+ $makecell(%info.banstatus,7,r,15,01) 
    } 
    else if (</results> iswm %buffer) { 
      if (%count == 1) %message = Result 
      else %message = Results 
      msg %to $makecell(Found %count in %querytime sec,25,l,00,14) $+ $makecell(.steamhelp for  commands list & usage examples,60,r,00,14) 

      if (%count > 5) { 
        %remainder = %count - 5 
        notice %to.nick View %remainder more results: %httpstring 
      } 
    } 
  } 
} 

alias -l nohtml { 
  var %tmp, %null 
  %null = $regsub($1-,/(<[^>]+>)/g,,%tmp) 
  return %tmp 
} 

alias -l noirc { 
  var %tmp, %null 
  %tmp = $1- 
  %null = $regsub(%tmp,/(\d\d? $+ $chr(44) $+ \d\d?|\d\d?||)/g,,%tmp) 
  return %tmp 
} 

alias -l makecell { 
  var %null, %tmp, %i, %padding, %trim, %string, %colorcode 
  %string = $1 
  %padding = $2 - 1 
  if (!$5) %colorcode =  $+ $4 
  else %colorcode =  $+ $4 $+ $chr(44) $+ $5 

  if ($len($noirc(%string)) > %padding) { 
    %trim = %padding - 2 
    %string = $left(%string, %trim) 
    %string = %string $+ .. 
  } 

  %i = $len($noirc(%string)) 
  if ($3 == r) { 
    %tmp = %colorcode 
    while (%i < $2) { 
      %tmp = %tmp %colorcode 
      %i = %i + 1 
    } 
    %tmp = %tmp $+ %string 
  } 
  else if ($3 == l) { 
    %tmp = %colorcode $+ %string 
    while (%i < $2) { 
      %tmp = %tmp %colorcode 
      %i = %i + 1 
    } 
  } 
  return %tmp 
} 

alias -l urlencode { 
  var %tmp, %null 
  %tmp = $1- 
  %null = $regsub(%tmp,/\s/g, $chr(37) $+ 20,%tmp) 
  %null = $regsub(%tmp,/ $+ $chr(44) $+ /g,$chr(37) $+ 2C,%tmp) 
  %null = $regsub(%tmp,/#/g,$chr(37) $+ 23,%tmp) 
  return %tmp 
}

Sample:

.steamid <steamid>            Lookup a single SteamID. ex: 0:0:12345
.steamid <steamid>, <steamid> Lookup multiple STEAMID's
.steamid name <name>          Lookup a player by name
.steamid alias <alias>        Lookup a player by alias.
.steamid team <name>          Lookup a player by their team name
.steamid tag <tag>            Lookup a player by their team tag
.steamid irc <channel>        Lookup a player by their IRC channel
.steamid rcon <server> <pass> Lookup a server via RCON

Doing a search would return results as listed below...

.steamid 1337
STEAMID        Alias          Team               Channel        Division   Record   Banned
1337           Lost|Darkmal.. [DEAD] The Lost    #clanlost      CS CAL-o   0-0-0        No
1337           stalin         [DEAD] dx          #dx            CS CAL-o   0-0-0       No
Found 2 in 0.009 sec                    .steamhelp for commands list & usage examples

¬ ID: 0:0:1337 ¬ Alias: stalin ¬ Team: The Lost ¬  TAG: Lost ¬   IRC: #clanlost ¬  Division: CS cal-o ¬  Record: 0-0-0 ¬ Banned: no    (If banned, should be in RED)
¬ ID: 0:0:1337 ¬ Alias: meme ¬ Team: bleh ¬  TAG: cxe ¬   IRC: #chan ¬  Division: CS cal-o ¬  Record: 0-0-0 ¬ Banned: Yes    (If banned=YES, should be in RED & Bold)
Found 2 in 0.009 sec                    .steamhelp for commands list & usage examples

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

 Share



×
×
  • Create New...

AdBlock Extension Detected!

Our website is made possible by displaying online advertisements to our members.

Please disable AdBlock browser extension first, to be able to use our community.

I've Disabled AdBlock