Stats Script

By CrazyDriver on Oct 31, 2015

Note: This script is for those who mainly use "SA-MP' (Grand Theft Auto: San Andreas Multiplayer)

I updated this from a alias to a working remote command for those who join this specific server and have their own bots so that other players could have full use of it as well instead of doing /pstats and showing it just themselves rather not the whole channel!

CrazyBob's Cops And Robbers IRC Stats Script.

This is fully functional now as no errors show and does the job!

Command: !pstats (user) (stat)

on $*:TEXT:/^\s*\Wpstats?/Si:#: {
  sockclose hits
  if (!$2) || (!$3) { echo -at 4Error [use: !pstats <user> <stat>] | halt }
  set %cnruser $2
  set %stat ! $+ $3-
  sockopen hits 80
on *:sockopen:hits: {
  if $sockerr > 0 { echo -at 4An Error Has Occured Try Again Later | sockclose $sockname | halt }
  sockwrite -n $sockname GET /mrx/webstats/UserStats.php?username= $+ %cnruser HTTP/1.1
  sockwrite -n $sockname Host:
  sockwrite -n $sockname $crlf
on *:sockread:hits: {
  if $sockerr > 0 { echo -at 7An Error Has Occured0, 7Try Again Later | sockclose $sockname | halt }
  sockread &cb.temp
  set %cb.temp $bvar(&cb.temp,1-).text
  set %cb.temp $replace(%cb.temp,</td>,!,</span>,?,(# others if tied),?!)
  set %cb.temp $remove(%cb.temp,<td>,</td>,</span>,<span>,<tr>,</tr>,<td align='center'>,</th>,<th>,th class='nosort'>,<br/>,</t,>,<,/,$crlf $+ 1000 $+ $crlf)
  if (no username specified isin %cb.temp) { msg $active 7Error0: 7No Username Exists | sockclose $sockname | unset %stat | halt }
  if ( isin %cb.temp) { msg $active 7Error0: 7No Column Found | sockclose $sockname | unset %stat | halt }
  if ($matchtok(%cb.temp,%stat,1,63) != $null) { var %parse $matchtok(%cb.temp,%stat,1,63)
    var %rank $gettok(%parse,6,33)
    if (span isin %rank) { var %rank $replace(%rank,",$chr(32)) | var %rank $remove(%rank,span style= font-weight:900;font-size:large;color:rgb,;) | var %rank $remove(%rank,$wildtok(%rank,(*),1,32)) }
    msg $active 7Player0:4 %cnruser $+ 1, 7Category0:4 $gettok(%parse,1,33) $+ 1, 7Las Venturas0:4 $gettok(%parse,2,33) $+ 1, 7San Fierro0:4 $gettok(%parse,3,33) $+ 1, 7Los Santos0:4 $gettok(%parse,4,33) $+ 1, 7Total0:4 $gettok(%parse,5,33) $+ 1, 7Rank0:4 %rank
    sockclose $sockname
    unset %stat

on $*:TEXT:/^\s*\Wpstat ?/Si:#: {
  msg $active 7Player Stats For4 $2 0>>>7 $+ 4 $+ $2


Sign in to comment.
dma   -  Nov 08, 2015

this dont work

CrazyDriver  -  Nov 12, 2015

If you use IRC on IRC.TL and play the game then you can join #ACE or #CNR as that is where the script is mostly likely to be used by others as it will only work for the players who have registered within the database and not for any random player / user on IRC itself.

Sign in to comment

Are you sure you want to unfollow this person?
Are you sure you want to delete this?
Click "Unsubscribe" to stop receiving notices pertaining to this post.
Click "Subscribe" to resume notices pertaining to this post.