Cem Ramiev Posted October 9, 2017 Share Posted October 9, 2017 How do I add my own website truckersmp ban status Link to comment Share on other sites More sharing options...
DesertEagle26 Posted October 9, 2017 Share Posted October 9, 2017 (edited) Hello @Cem 18, The required codes are available here: https://stats.truckersmp.com/api You can also browse here: https://forum.truckersmp.com/index.php?/forum/198-developer-portal/ Have fun Edited October 9, 2017 by DesertEagle26 TIRCI Link to comment Share on other sites More sharing options...
RapidFellow Posted October 9, 2017 Share Posted October 9, 2017 This link returns many information regarding your ban history. https://api.truckersmp.com/v2/bans/840796 It returns a String. You can check with JS whether this String contains "active":true If it does, your currently banned. Link to comment Share on other sites More sharing options...
Cem Ramiev Posted October 9, 2017 Author Share Posted October 9, 2017 hello its not working? ;/ php or html I could not understand which of the stats i have not tried as html and php Link to comment Share on other sites More sharing options...
heyhococo Posted October 10, 2017 Share Posted October 10, 2017 (edited) @DrEGZo No, if the strings contains “active”:true then it just means they didn’t appeal and they left their ban to expire- it doesn’t necessarily mean they’re currently banned If what you said was the case, then we’d have a lot of banned people Edited October 10, 2017 by heyhococo Link to comment Share on other sites More sharing options...
Cem Ramiev Posted October 10, 2017 Author Share Posted October 10, 2017 How can I add my own web site server status like this site http://www.nizamlojistik.com/EtsStatus/Index Link to comment Share on other sites More sharing options...
Guest Posted October 10, 2017 Share Posted October 10, 2017 view-source:http://www.nizamlojistik.com/EtsStatus/Index maybe you can take advantage of these codes Link to comment Share on other sites More sharing options...
Prototype Posted October 14, 2017 Share Posted October 14, 2017 Moved to Developer Portal •Intel® Core™ i7-6850K •Asus ROG Strix X99 Gaming •Asus ROG Strix GeForce GTX 1080 Ti OC 11GB •Corsair Dominator® Platinum Series 32GB DDR4 3000MHz C15 •Samsung 970 PRO NVMe M.2 512GB •Samsung 860 EVO 1TB •Corsair HX1000i High-Performance ATX Power Supply •NZXT Kraken X72 •Coolermaster MasterCase H500M Link to comment Share on other sites More sharing options...
HumaneWolf Posted October 14, 2017 Share Posted October 14, 2017 You will need to look at connecting to REST api's in PHP (or another language), and you will need to look into processing json in that language. HumaneWolf - Website - Twitter - GitHub Ex-Developer Link to comment Share on other sites More sharing options...
Web Developer _J-M Posted October 15, 2017 Web Developer Share Posted October 15, 2017 Take a look at this as an example:https://github.com/jean8mathieu/UrlShortner/blob/master/index.php#L88 Link to comment Share on other sites More sharing options...
Cem Ramiev Posted October 21, 2017 Author Share Posted October 21, 2017 On 15.10.2017 at 9:52 PM, _J-M said: Take a look at this as an example:https://github.com/jean8mathieu/UrlShortner/blob/master/index.php#L88 its not working :/ On 15.10.2017 at 9:52 PM, _J-M said: Take a look at this as an example:https://github.com/jean8mathieu/UrlShortner/blob/master/index.php#L88 can you help me ? Link to comment Share on other sites More sharing options...
SDCore Posted October 23, 2017 Share Posted October 23, 2017 (edited) You need to use PHP to connect to the TruckersMP API (seen here: https://stats.truckersmp.com/api) and use it to get the URL of api.truckersmp.com/v2/bans/{id} where {id} is your TruckersMP account ID (found by going to your account page on the website). For example, my URL would be the following: https://api.truckersmp.com/v2/bans/1044649 This returns a bunch of JSON strings you can then parse using json_decode in PHP and detect whether or not "active" is set to true or false. I wrote a little example here: <?php $baseURL = "https://api.truckersmp.com/v2/bans"; // Base URL, does not include player ID $playerID = "1044649"; // ID by itself makes it easier to change on the fly $fullURL = $baseURL."/".$playerID; // Putting the full URL together // Making call with cURL, assuming you have cURL installed (you should) $json = file_get_contents($fullURL); // Convert JSON to PHP Object $phpObj = json_decode($json); $banStatus = $phpObj->response[0]->active; // Checking the most recent ban to see if it's active or not ?> Once you've done this, all you have to do is check whether or not the expiration date has passed the current date. If it has, they aren't banned. If it hasn't, they're still banned. Just make sure to account for timezone differences. I've provided all you should need to at least get started. Good luck! Edited October 25, 2017 by SDCore Edited the "response" object Link to comment Share on other sites More sharing options...
HumaneWolf Posted October 24, 2017 Share Posted October 24, 2017 19 hours ago, SDCore said: I'm not 100% sure, as I've not worked extensively with the TruckersMP API, but I'm assuming if "active" on the most recent ban is false, it means you're still banned. If it's true, you aren't banned. Wrong. Active means the player was NOT unbanned before the ban expired. If it says it is not active, then teh player was unbanned early. The ban can be active even if it has expired. 1 HumaneWolf - Website - Twitter - GitHub Ex-Developer Link to comment Share on other sites More sharing options...
mati216PL Posted October 24, 2017 Share Posted October 24, 2017 It is very complicated I admire people who can programming Could someone share script? edgelogistic.pl Link to comment Share on other sites More sharing options...
SDCore Posted October 24, 2017 Share Posted October 24, 2017 5 hours ago, HumaneWolf said: Wrong. Active means the player was NOT unbanned before the ban expired. If it says it is not active, then teh player was unbanned early. The ban can be active even if it has expired. Ah, alright, my bad. I've updated my original post. Link to comment Share on other sites More sharing options...
Recommended Posts