• SteamID and UserRank Display
    19 replies, posted
Hello, I am wanting to create a script that allows (When connecting to my GMod server) the client to see (In a box) Their SteamID Their name Their Rank Their Playtime And I was wondering if anyone has a script OR has a few pointers :) Thanks
One pointer. Wrong forum.
There you go: [IMG]http://4.bp.blogspot.com/_LgBdHvzLUR8/S_S00UtMHLI/AAAAAAAAAGM/IDRzEa79cUE/s1600/cardboard+box.jpg[/IMG] You can achieve that using SourceMod: GetClientName() - Client's name GetClientAuthString() - Client's SteamID Steam ranks are sooo 2010, they don't exist anymore. [IMG]http://www.alaska-in-pictures.com/data/media/4/screaming-bald-eagle_5220.jpg[/IMG] As for getting their playtime, use cURL or similar to get their Steam Community page and parse the data. Here's an extension to help you get started: [url]http://forums.alliedmods.net/showthread.php?t=152216[/url] Is the thing you want useful? [B]No.[/B] Are we going to code it for you? [B]No.[/B] Are you going to give me a beer? [B]Yes.[/B]
[QUOTE=BaconScientist;34136900]There you go: [IMG]http://4.bp.blogspot.com/_LgBdHvzLUR8/S_S00UtMHLI/AAAAAAAAAGM/IDRzEa79cUE/s1600/cardboard+box.jpg[/IMG] You can achieve that using SourceMod: GetClientName() - Client's name GetClientAuthString() - Client's SteamID Steam ranks are sooo 2010, they don't exist anymore. [IMG]http://www.alaska-in-pictures.com/data/media/4/screaming-bald-eagle_5220.jpg[/IMG] As for getting their playtime, use cURL or similar to get their Steam Community page and parse the data. Here's an extension to help you get started: [url]http://forums.alliedmods.net/showthread.php?t=152216[/url] Is the thing you want useful? [B]No.[/B] Are we going to code it for you? [B]No.[/B] Are you going to give me a beer? [B]Yes.[/B][/QUOTE] Okay, post your address and Ill send it in cellophane [editline]10th January 2012[/editline] [QUOTE=jaybuz;34136698]One pointer. Wrong forum.[/QUOTE] How is developing a webpage for a loadingurl Not webdev?
I don't really know how to make a web script that runs on connection, but you can take the thing I made in 20 minutes as reference: My reference retrieves information about the last joined player. Here's how it works: [GMod] Player connects -> -> [GMod] Sends HTTP request containing SteamID in headers or GET parameters to the web server (http.Get) -> -> [Web server] Saves SteamID (adapted for community URL) in a file -> -> [Browser] Sends XMLHttpRequest to the web server (127.0.0.1 in my code) to retrieve player info -> -> [Web server] Gets SteamID from the file -> -> [Web server] Sends player information to the browser -> -> [Browser] Displays information about the player Here's the code (requires allow_url_include=On in php.ini and PHP file writing enabled) [B]GModLastPlayer.php[/B] (processes requests from browser and GMod): [code] <?php header('Content-Type: text/xml'); switch($_GET['mode']) { case 'newply': $pFile = fopen('GModLastPlayer.txt','w'); fwrite($pFile,intval(substr($_GET['id'],8,1)) + intval(substr($_GET['id'],10))*2); fclose($pFile); break; case 'player': case 'games': $pFile = fopen('GModLastPlayer.txt','r'); $steamID = fread($pFile,10); fclose($pFile); $isGames = $_GET['mode']=='games'?'games/':''; include('http://steamcommunity.com/profiles/[U:1:' . $steamID . ']/' . $isGames . '?xml=1'); break; } ?> [/code] [B]autorun\server\SendLastPlayer.lua[/B] (sends a request to the web server when a player joins): [lua] hook.Add('PlayerInitialSpawn','SendLastPlayer',function(ply) http.Get("http://127.0.0.1/GModLastPlayer.php?mode=newply&id="..ply:SteamID(),"",function() end); --Replace 127.0.0.1 with the URL of your web server end) [/lua] [B]GModLastPlayer.htm[/B] (displays information about the user): [url]http://pastebin.com/RGJmeMPc[/url] The code I wrote is [B]EXTREMELY[/B] slow, because XMLHttpRequest is synchronous (can't get async XHR to work with Abyss Web Server), and the server sends entire contents of two large XML files from Steam Community. Remember that you must open GModLastPlayer.htm on [B]web server[/B] using [B]HTTP protocol[/B]. It won't work from file protocol.
[QUOTE=DrJenkins;34130732]And I was wondering if anyone has a script OR has a few pointers :) Thanks[/QUOTE] [cpp] void* a_few[] = { 0x00000000, 0xdeadbeef, 0xcafebabe }; [/cpp] there you go
[QUOTE=swift and shift;34192480][cpp] void* a_few[] = { 0x00000000, 0xdeadbeef, 0xcafebabe }; [/cpp] there you go[/QUOTE] Access violation.
[QUOTE=SiPlus;34205920]Access violation.[/QUOTE] nope
[QUOTE=swift and shift;34205935]nope[/QUOTE] /3GB? On topic: I updated the example, now it doesn't display "loading" when it's not really loading.
[QUOTE=SiPlus;34207823]/3GB? On topic: I updated the example, now it doesn't display "loading" when it's not really loading.[/QUOTE] it's not an access violation, you're not dereferencing those pointers anywhere. pointers are just glorified unsigned integers
wow, why make this in a webpage. Server side lua could do this in like 20 lines of code.
[QUOTE=jaybuz;34259364]wow, why make this in a webpage. Server side lua could do this in like 20 lines of code.[/QUOTE] Because serverside Lua doesnt run on a webserver
[QUOTE=Goz3rr;34259727]Because serverside Lua doesnt run on a webserver[/QUOTE] This doesn't require a web sever...
Sure, how'd you display a lua script with sv_loadingurl? You seem to forget that i you want to run your Lua script on the players loading screen, they will have to download it first. And they download it during the loading screen.
[QUOTE=Goz3rr;34259727]Because serverside Lua doesnt run on a webserver[/QUOTE] what
[QUOTE=swift and shift;34273111]what[/QUOTE] He wants the server info in the loading screen of his server. You can specify a web page with sv_loadingurl
[QUOTE=Goz3rr;34273163]He wants the server info in the loading screen of his server. You can specify a web page with sv_loadingurl[/QUOTE] "because serverside lua doesn't run on a webserver" well it does or else why would it be called serverside
serverside Lua as in the Lua that runs on the gameserver hosting your Garry's Mod server.
[QUOTE=Goz3rr;34273534]serverside Lua as in the Lua that runs on the gameserver hosting your Garry's Mod server.[/QUOTE] Wtf dude. Lua is a general purpose scripting language, the fact that gmod also uses it has nothing to do with anything, you can install it by itself.
I just sai that. You can run Lua pretty much on anything, but good luck having it work like GLua
Sorry, you need to Log In to post a reply to this thread.