• Print

Author Topic: MOTD ?  (Read 8903 times)

0 Members and 1 Guest are viewing this topic.

Offline ILIkeTrainZ

  • Newbie
  • *
  • Posts: 2
  • Karma: 0
MOTD ?
« on: February 26, 2014, 01:28:35 am »
hi evreyone.
i am not that great at PHP and html so i need your help.

I am making an motd and its waaay not close to being finished (my motd:  forest-craft.nl/garrysmod/motd.php
what i'm trying to show on it is The connecting players profile Name and image, steamID .
the map there is currently being plyed on and the status of downloading
now i tryd some PHP codes but they dont seem to work.
can somone please explain me how to do it?

_
trainz

EDIT:
Here is the code
public_html/garrysmod/motd.php
Code: [Select]
<html>
<body bgcolor=#dbdbdb>
<div style="text-align: center;">
<div style="width: 80%; margin: 0px auto; border: 10px solid #c9d6e4; background-color: #ededed; padding: 10px; font-size: 12px; font-family: Tahoma; margin-top: 30px; color: #818181; text-align: left;">
<div style="font-size: 30px; font-family: impact; width: 100%; margin-bottom: 5px;">Welcome to canned TTT
Here is some useful information: </div>
<br>
Our server has active staff and rulebreakers get big punishments!<br>
U.<br>
<br>
<h2>Rules:</h2>
<hr>1. Do not ask for Regular rank. A superadmin will notice if you play alot and will give you the rank when he thinks the time is right.<br><hr>
<hr>2. Don't spam.<br><hr>
<hr>3. Do not ghost. ghosting is telling people who traitors are and where somebody is.<hr>
<hr>4. Do not RDM(Random death match) You will be questioned why you killed somone when they complaint about it<hr>
<hr>5. Do not mass RDM(Killing 3 players without a reason) each rdm = 1 week ban.<hr>
<hr>6. Do not argue with staff. when you see the dot you will not continue arguing. this will result in a mute.<hr>
<hr>7. Do not use any form of Hacks.<hr>
<hr>8. Do not disrespect ANY player. No matter the gender, age, or anything else. Canned TTT welcomes All ages !<hr>
<hr>9. You can view information and an apply template for staff on our forums :<hr>
<hr>10. If you feel threatened speak to a staff member!, no matter your age or how you are,
you come here for fun<hr>
<hr>11. Want to apply? You always can and it will be discussed during a montly meeting!
There is no minimum age ! <hr>

<br>
<div style="width: 100%; text-align: center; margin: 10px; font-weight: bold;">- The Admins</div>
<param name="movie" value="http://www.youtube.com/v/mcxIr9krD-s;autoplay=1&amp;loop=1">
<param name="allowFullScreen" value="true">
<param name="allowScriptAccess" value="always">
<embed src="http://www.youtube.com/v/mcxIr9krD-s&amp;autoplay=1&amp;loop=1" type="application/x-shockwave-flash" allowfullscreen="true" allowscriptaccess="always" width="1" height="1">
  </body>
</html>


sorry for my bad english, i'm dutch lol
« Last Edit: February 26, 2014, 01:32:47 am by ILIkeTrainZ »

Offline Bytewave

  • Respected Community Member
  • Hero Member
  • *****
  • Posts: 718
  • Karma: 116
  • :)
    • My Homepage
Re: MOTD ?
« Reply #1 on: February 26, 2014, 05:32:00 am »
hi evreyone.
i am not that great at PHP and html so i need your help.

I am making an motd and its waaay not close to being finished (my motd:  forest-craft.nl/garrysmod/motd.php
what i'm trying to show on it is The connecting players profile Name and image, steamID .
the map there is currently being plyed on and the status of downloading
now i tryd some PHP codes but they dont seem to work.
can somone please explain me how to do it?

_
trainz

EDIT:
Here is the code
public_html/garrysmod/motd.php
Code: [Select]
<html>
<body bgcolor=#dbdbdb>
<div style="text-align: center;">
<div style="width: 80%; margin: 0px auto; border: 10px solid #c9d6e4; background-color: #ededed; padding: 10px; font-size: 12px; font-family: Tahoma; margin-top: 30px; color: #818181; text-align: left;">
<div style="font-size: 30px; font-family: impact; width: 100%; margin-bottom: 5px;">Welcome to canned TTT
Here is some useful information: </div>
<br>
Our server has active staff and rulebreakers get big punishments!<br>
U.<br>
<br>
<h2>Rules:</h2>
<hr>1. Do not ask for Regular rank. A superadmin will notice if you play alot and will give you the rank when he thinks the time is right.<br><hr>
<hr>2. Don't spam.<br><hr>
<hr>3. Do not ghost. ghosting is telling people who traitors are and where somebody is.<hr>
<hr>4. Do not RDM(Random death match) You will be questioned why you killed somone when they complaint about it<hr>
<hr>5. Do not mass RDM(Killing 3 players without a reason) each rdm = 1 week ban.<hr>
<hr>6. Do not argue with staff. when you see the dot you will not continue arguing. this will result in a mute.<hr>
<hr>7. Do not use any form of Hacks.<hr>
<hr>8. Do not disrespect ANY player. No matter the gender, age, or anything else. Canned TTT welcomes All ages !<hr>
<hr>9. You can view information and an apply template for staff on our forums :<hr>
<hr>10. If you feel threatened speak to a staff member!, no matter your age or how you are,
you come here for fun<hr>
<hr>11. Want to apply? You always can and it will be discussed during a montly meeting!
There is no minimum age ! <hr>

<br>
<div style="width: 100%; text-align: center; margin: 10px; font-weight: bold;">- The Admins</div>
<param name="movie" value="http://www.youtube.com/v/mcxIr9krD-s;autoplay=1&amp;loop=1">
<param name="allowFullScreen" value="true">
<param name="allowScriptAccess" value="always">
<embed src="http://www.youtube.com/v/mcxIr9krD-s&amp;autoplay=1&amp;loop=1" type="application/x-shockwave-flash" allowfullscreen="true" allowscriptaccess="always" width="1" height="1">
  </body>
</html>


sorry for my bad english, i'm dutch lol
Show me the PHP you're using, please- I can debug them for you.
The Steam Web API is finnicky, and is weird at how it returns data (JSON).

If you happen to know any PHP yourself, check this for the Steam Web API.
bw81@ulysses-forums ~ % whoami
Homepage

Offline Megiddo

  • Ulysses Team Member
  • Hero Member
  • *****
  • Posts: 6214
  • Karma: 394
  • Project Lead
Re: MOTD ?
« Reply #2 on: March 01, 2014, 02:41:21 pm »
In v3.61 of ULX:
* [ADD] %curmap% and %steamid% variables in "ulx showMotd" URL for custom-served MOTDs (Thanks Mors-Quaedam).

That will help a bit. :)
Experiencing God's grace one day at a time.

Offline Bytewave

  • Respected Community Member
  • Hero Member
  • *****
  • Posts: 718
  • Karma: 116
  • :)
    • My Homepage
Re: MOTD ?
« Reply #3 on: March 01, 2014, 04:04:56 pm »
In v3.61 of ULX:
* [ADD] %curmap% and %steamid% variables in "ulx showMotd" URL for custom-served MOTDs (Thanks Mors-Quaedam).

That will help a bit. :)
Oh god, forgot about the changelog- only visit the forums.

Does %steamid% return a SteamID or SteamID64?
bw81@ulysses-forums ~ % whoami
Homepage

Offline JamminR

  • Ulysses Team Member
  • Hero Member
  • *****
  • Posts: 8096
  • Karma: 390
  • Sertafide Ulysses Jenius
    • Team Ulysses [ULib/ULX, other fine releases]
Re: MOTD ?
« Reply #4 on: March 01, 2014, 04:37:05 pm »
SteamID()
"Though a program be but three lines long, someday it will have to be maintained." -- The Tao of Programming

Offline Bytewave

  • Respected Community Member
  • Hero Member
  • *****
  • Posts: 718
  • Karma: 116
  • :)
    • My Homepage
Re: MOTD ?
« Reply #5 on: March 01, 2014, 08:14:01 pm »
SteamID()
Alright, great- PHP math time!
OP, I'll code you something real quick. If you know how to use the variables this script will provide you, good. If not, tell me.
I'll edit my post when I make the code.

EDIT: Done.
Code: PHP
  1. <?php
  2. /*
  3.  
  4. ULX MOTD SteamID decoder and getter and things
  5. To use this, set your ULX MOTD to:
  6. [url]http://yourdomain.com/path/to/this/file.php?steamid=%steamid%&curmap=%curmap%[/url]
  7.  
  8. */
  9.  
  10.  
  11.  
  12.  
  13. //Steam API Key for API query goes here
  14. $SteamAPIKey = "ENTER YOUR STEAM API KEY HERE!!!";
  15. //Get the player's SteamID
  16. $steamid = $_GET["steamid"];
  17. //Separate it into individual parts
  18. //Note: x exists for the sole purpose of nothing.
  19. $x = substr($steamid, 6, 1);
  20. //Authserver
  21. $y = substr($steamid, 8, 1);
  22. //ID
  23. $z = substr($steamid, 10, 8);
  24.  
  25. $steamid64 = ($z*2)+76561197960265728+$y;
  26.  
  27. //Use the new SteamID64 to get a JSON response from the Steam Web API
  28. $url = "http://api.steampowered.com/ISteamUser/GetPlayerSummaries/v0002/?key=" . $SteamAPIKey . "&steamids=" . $steamid64;
  29. //Get the actual JSON contents
  30. $json = file_get_contents($url);
  31. //Decode the JSON
  32. $tableToSeparate = json_decode($json, true);
  33. //Get the data we need
  34. $table = $tableToSeparate["response"]["players"][0];
  35.  
  36. //Here are the variables you will need.
  37. $avatarlink = $table["avatarfull"];
  38. $name = $table["personaname"];
  39. $curmap = $_GET['curmap'];
  40. ?>
  41.  
  42. <!--Add your HTML below this line! :D-->
« Last Edit: March 01, 2014, 08:44:54 pm by Princess Twilight Sparkle »
bw81@ulysses-forums ~ % whoami
Homepage

  • Print