on *:TEXT:*:#:{
if ($strip($1) === !bf4stats) {
var %user = $iif($2, $strip($2), $nick)
var %urlSafeUser = $regsubex(%user, /[^a-z\d_-]/gi, % $+ $base($asc(\t), 10, 16, 2))
var %url = http://api.bf4stats.com/api/playerInfo?plat=pc&name= $+ %urlSafeuser
JSONOpen -ud bf4stat %a
var %name = $JSON(bf4stat, player, name)
var %rank = $JSON(bf4stat, player, rank, nr)
var %score = $JSON(bf4stat, player, score)
var %kills = $JSON(bf4stat, stats, kills)
var %deaths = $JSON(bf4stat, stats, deaths)
var %kdRatio = $round($calc(%kills / %deaths), 2)
var %wins = $JSON(bf4stat, stats, numWins)
var %losses = $JSON(bf4stat, stats, numLosses)
var %wlRatio = $round($calc(%wins / %losses), 2)
var %played = $duration($JSON(bf4stat, stats, timePlayed))
var %hits = $JSON(bf4stat, stats, shotsHit)
var %misses = $JSON(bf4stat, stats, shotsFired)
var %accuracy = $round($calc(%hits / %misses * 100),2) $+ %
msg # %name $+ 's Battlefield 4(PC) Stats $(|,0) Rank: %rank $(|,0) Kills: %kills $(|,0) K/D: %kdRatio $(|,0) W/L: %wlRatio $(|,0) Score: %score $(|,0) Time Played: %played $(|,0) Accuracy: %accuracy
}
}