vendredi 1 juillet 2016

Steam API get current user status

I'm new here and created this account to learn more about coding, i've been lurking here for a while looks like a great site.

I'm trying to use the steam web API to show the current status of ONE steam user if he is (online,away,offline,looking to trade) etc and have setup a PHP switch as follows:

<?
$status = $steamprofile['personastate'];
switch($status) {
        case 0:
        echo "offline!";
        break;
        case 1:
        echo "online!";
        break;
        case 2:
        echo "Busy.";
        break;
        case 3:
        echo "Away.";
        break;
        case 4:
        echo "Snooze.";
        break;
        case 5:
        echo "Looking to trade.";
        break;
        case 6:
        echo "Looking to play.";
        break;
        default:
        echo "Unknown status";
}
echo $status;
?>

It works great but only shows the user status when logged unto the site and not simply when the user is online/away/offline etc on the steam platform I'm wondering if anyone know how to fix so it displays the current user status on steam, not just if he/she is logged in on the website thank you.




Aucun commentaire:

Enregistrer un commentaire