Jump to content

Orang-e

Veteran Driver VII
 TruckersMP Profile
  • Posts

    12
  • Joined

  • Last visited

Posts posted by Orang-e

  1. There are two ways to achieve your goal if you want to do it yourself. Both will require ETS2MAP API.
    http://tracker.ets2map.com/v2/fullmap

    The above link provides you with JSON response of each and every truck that is online in game.


    Both methods will require you to find out X and Y coordinates of the city as well as its radius. You will need to create a table where you will store it.
    For example:
    city_id    city_name    x    y    radius
    1             london          2    5      10            (assume)

    2             ..........            ....  ....    .....           (and so on)
    $city_data will fetch data from above table. SELECT * FROM table_name;


    1. First Way   (NOT RECOMMENDED) (Your Server IP may get banned from using ets2map API)(It will make too many requests on ets2map API and we do not want this to happen)

    https://tracker.ets2map.com/v2/server_id/x/y/radius

    It will return JSON reponse containing location and truckersmp_id and other information of each truck that is online in that circle in the game on a particular server.

    The ets2map API provides us to find the location of each and every truck in a particular circle, if you know the center of circle coordinate and its radius.
    When you will request this URL for each of the cities that your table has, it will generate tremendous amount of load on the server itself

    <?php
    foreach($servers as $server){
    	foreach($city_data as $circle){
    		$response = json_decode(file_get_contents(https://tracker.ets2map.com/v2/$server->server_id/$circle->x/$circle->y/$circle->radius));
            //CACHE HERE
    	}
    }
    ?>

     

    The variable $response will pull in data of each online truck in every iteration. So you will need to cache it. Put this script in a cronjob that will run after a specific period of time and then you can fetch the data from the locally stored cache rather than requesting for data every time a user requests it.

     

    I am also assuming that you have TruckersMP id of your Drivers in your VTC Management system.
    So once the data of each city as per server is cached, You can only find the drivers that belong to your VTC.
    I will not be discussing this part bcoz I am assuming you already know this.

     

    $server has mapping of server_id to server names.
    REMEMBER: server id on truckersmp API is different from ets2map API. Make sure you manually check it and create the required table accordingly.
    I have messaged 'Tuxy Fluffyclaws' some time ago regarding this above issue. Got no response.

     

    2. Second Way  (RECOMMENDED) (Your server will be the one who is doing work here)(Only 1 request will be sent to ETS2MAP API)

     

    I am assuming you have created the city_data table which has all the coordinates and radius of city that you want to check for as shown above.

     

    <?php
    $response = json_decode(file_get_contents(http://tracker.ets2map.com/v2/fullmap));
    //FILTER THIS RESPONSE SO that it has only your own VTC drivers.
    foreach($city_data as $circle){
    	//TRAVERSE THE RESPONSE HERE
      	foreach($response->trucks AS $truck){
        	//WE NEED TO FIND WHETHER THAT TRUCK LIES INSIDE THAT CIRCLE OR NOT
          	if(sqrt(pow(($circle->x - $truck->x),2)+pow(($circle->y - $truck->y),2)) <= $circle->radius){
              //TRUCK is in this city
              //push the data of the truck in an array.
              array_push(data fetched from $truck)
            }
        }
      	//array will have all the location of trucks in a particular city.
      	//CACHE this array and mark it as trucks in $circle->city_name.
      	//EMPTY ARRAY for next iteration of city.
    }
    ?>

    Instead of caching the above result, you can show the output to a user whenever they request the page.

     

    Once again i would suggest putting this script in a cronjob.

    When a user fetches for information.. you would only need to fetch data from cached files.

     

    In the above script, you will get data from every server.. not one particular server.. if you want to find server also it can done using $truck->server

     

    ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

     

    I never really liked this response.. they never made it public. Someone (allegedly) already had access to the documentations/or verbally told, while the rest of the community did not.

     

    It is not limited to cities.. and it does not have to be a circle.. It can be of any shape and size.

    I hope the above written stuff helps the community in creating their desired applications. There are endless things you can do with the ETS2MAP API (thank you devs for this) <3

    • Upvote 1
  2. Still waiting for some sort of acknowledgement / confirmation / explanation on this matter.

     

    Another Rant in spoiler below.. Not forcing anyone to read.

     

    Spoiler

    Rant#2:

    Was I the first one to witness this bug?

    If yes, then allegedly this shows that how much TruckersMp admins (not pointing towards anyone, talking in general) give attention to appeals.

    Explanation:

     

    1. I got banned. I made an appeal
    2. Admin didn't even notice that the name showed on the appeal page has a different name on it.. when compared to evidence.
    3. This shows how much attention an Admin allegedly gives to your appeals. If they had properly viewed it... they would be the first one to submit a bug report about this matter, not me.
    4.This bug was present for over 2 months.. when i noticed it.. So, does this mean that in those 2 months... the appeals that were made.. each and every admin allegedly didn't even bother to give attention to appeals. If they had.. this bug would have been found.

    I wonder why no one from the TruckersMp staff has even replied on this post.



     

  3. Its very easy to find out TruckersMP ID if you know the Player id & Server.
    Here is the PHP code:

     

    <?php
    $give_pid = $_POST['p_id'];// Input this from html form.
    $give_server = $_POST['server'];  // There can be multiple people with same pid on different servers. so we take server as input also
    
    $url = "http://tracker.ets2map.com/v2/fullmap";
    $response = file_get_contents($url);
    $trucks = json_decode($response);
    
    foreach($trucks->Trucks AS $truck){
    	if($truck->p_id == $give_pid && $truck->server == $give_server){
    		$find_mp_id = $truck->mp_id;
          $flag=0;
    		break;
    	}else{
          $flag=1;
    }
    if($flag != 1){
    	echo $find_mp_id;
    }else{
      echo "Not Found";
    }
    //SERVER ID can be found here https://api.truckersmp.com/v2/servers
    ?>

    WARNING: The API that is returning server info shows wrong server id.

    For all those who are saying its not possible.. please do some research. Then come to a conclusion.

    • Upvote 1
  4. If you don't want to build PC Application.... there is another alternative.
    Requires only Online Application:

    You will need to create an HTML form where your VTC members can submit the information manually. I have seen some VTC use this instead of a PC application.
    No matter what.. you will be needing an Online platform though.

  5. Making a job logger consists of two things:
    1. PC application
    2. Some sort of server side application

    Details:
    1 . PC APPLICATION:

    You need to build some sort of PC application that should collect data from game and send it as POST/GET to a webpage.

    More details in the post below


    2 . Online Application:
    This is where the magic happens. You will need to setup a database. Make sure you make logins for your VTC members. Since you will need some sort of identification to distinguish between jobs that are submitted to you via the POST/GET method.
    You will need to build your own web application to present the data in a presentable form.

    Alternatives:

    1. Virtual Trucking Manager This is a pre-built application for job logging.
    2. Jammerxd Refer to this if u want to make your own Web Application. It already has a PC application. It can also be used to track people LIVE.

     

    Resources:
    https://github.com/Funbit/ets2-telemetry-server

     

    I hope this helps!

    • Like 1
    • Upvote 1
  6. Topic Title: In-game name not showing correctly on Appeal Page

    TruckersMP ID: 1180771

    How to reproduce:

    1. Make sure to have different names on TruckersMP and Steam.
    2. Do something so that you get banned(This is for the testing purposes only, I am not encouraging anyone to break TruckersMP rules).
    3. On the appeal page, you will see the wrong name under this category "Your In-game name when banned"

    Source:

    My appeal page - https://truckersmp.com/appeals/view/74093 (I have attached a screenshot of the appeal page if you are not able to see it, I believe admins can.)

    Evidence - http://imgur.com/zWCRjpM


    As you can see that the person who got banned in-game has a different name as compared to the appeal page.

    Possible Fixes below in Spoiler below

    ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
     

    Spoiler


    Rant :
    There was an update on TruckersMP regarding use of TruckersMP Name as in-game name rather than Steam Name on April 14 2017(it may be April 13 for some timezone).
    Many people including me made forum posts/threads to revert this change.
    But TruckersMP admins/mods supported this update because its easier for them to identify people In-game, forums & on the TruckersMP website.
    Source: 

    It looks like to me that what TruckersMP is currently doing is contradictory ??
    On one side they say its easier for Admins... while on the other hand they are still using wrong names. 

    Decide what you want to use.
    I am assuming this bug is present since that day. (thats over 2 months)

    I know that this isn't a game breaking bug. But it is still a bug.


    Possible Fix for the above mentioned Bug:
    You just need to fetch the name from correct Field of the table.

    Untitled.png

  7. Suggestion Name: Use of steam name in-game.

    Suggestion Description: using steam name in-game rather than Nickname from TruckersMP website.

    Any example images: N/A

    Why should it be added?: There are many reasons. Some are listed below.

    1. VTCs ask their drivers and staff members to add name tags in their Steam Name to distinguish.(In-game tags are not enough sometimes)
    2. Instead of only Steam Names, VTC will have to index "Nickname" also. (because Nicknames can be different from Steam Name)
    3. Websites which are using TruckersMP API will now have to add another "attribute" for "nickname" to their database if they haven't already.


    I hope more people support this suggestion.
    Thanks.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.