• I need help with a GMOD loading screen PHP
    4 replies, posted
Hey there, I'm not really good at this kind of thing and to my unexpereinced mind there seems to be no reason why this code isn't working! Could someone help a newbie out please? Thanks in advance. [CODE] <?php $avatar = "GLP.png"; $plname = "Player"; $steamid = "steamid"; $communityid = "1"; $authserver = bcsub($communityid, '76561197960265728') & 1; $authid = (bcsub($communityid, '76561197960265728')-$authserver)/2; $steamid = "STEAM_0:$authserver:$authid"; if (isset($_GET['steamid'])) { $data = 'http://api.steampowered.com/ISteamUser/GetPlayerSummaries/v0002/?key=**MYAPIKEY**&steamids='.$_GET['steamid']; $f = file_get_contents($data); $arr = json_decode($f, true); if (isset($arr['response']['players'][0]['personaname'])) $plname = $arr['response']['players'][0]['personaname']; if (isset($arr['response']['players'][0]['avatar'])) $avatar = $arr['response']['players'][0]['avatar']; } ?> ** SOME HTML ** <div><img class="avatar" src="<?php echo $avatar?>"></div> <hr> <div class="info"> <p> Name <br> <?php echo $plname ?> </p> <p> SteamID <br> <?php echo $steamid?></p> [/CODE] I didn't unclude most the HTML as I'm fairly sure the error doesn't lie with that. The problem is that the steam ID and the player name of the person connecting doesn't show up it just stays as 'Player'
The code seems fine. Tested it by copy&paste and I have the avatar, player name and steamid (which you might want to set $communityid to $_GET['steamid']) all shown. But it appear that after refreshing the page a couple of time, the api seems to stop returning the json informations things. I don't know what to say ... But yea the code is working just fine.
For some reason it does not seem to work on my loading screen? ** The website [url]http://runlaxgaming.com/loadscreen/loadscreen.php[/url]
Well... [t]http://i.imgur.com/fW5diez.jpg[/t] Seems okay to me.
Do you have any idea why it would not be working for me? I'm sorry I really do not know what's going on. Could it be my GMod? [editline]24th May 2015[/editline] OH MY GOD. I have just realized what I was missing. Thank you for your help Dexon, your very very helpful and you just made me realize how stupid I am XD
Sorry, you need to Log In to post a reply to this thread.