1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.
  2. GTA Network forum is now in archive mode.

GTA V Online map

Discussion in 'Tools' started by Vektor42O, Feb 20, 2017.

  1. Vektor42O

    Vektor42O Active Member

    Messages:
    77
    Likes Received:
    54
    Joined:
    Jan 24, 2017
    Hi!
    This is an online map that you can download and use for your own server.
    The engine is Leaflet which is better than google maps (in my opinion).

    The source is from grandtheftauto.net and it uses their map tiles. Don't remove the copyrights!
    http://grandtheftauto.net/gta5/map

    Possible usage: you can show businesses, shops, houses or the players on the server!

    Code:
        var pIcon = L.icon({
            iconUrl: 'http://icons.iconarchive.com/icons/paomedia/small-n-flat/1024/map-marker-icon.png',
            iconSize:     [24, 24], // size of the icon
            iconAnchor:   [12, 24], // point of the icon which will correspond to marker's location
            popupAnchor:  [0, -24] // point from which the popup should open relative to the iconAnchor
        });
    
        L.marker([-1370.6250, 56.1227], {icon: pIcon}).addTo(map).bindPopup("Show something on map. Its the golf place.");
    L.marker([0.0, 0.0], {icon: pIcon}).addTo(map).bindPopup("Center of the world.");
    Photo:
    [​IMG]


    Download:
    http://gtan.codeshock.hu/index.php?page=gtavmap
     
    Last edited: Feb 28, 2017
    TiaqoY0, Shepard, Appi and 4 others like this.
  2. Mogli1337

    Mogli1337 Member

    Messages:
    9
    Likes Received:
    1
    Joined:
    Jan 28, 2017
    Perfect, thank you :=)
     
    Vektor42O likes this.
  3. Vektor42O

    Vektor42O Active Member

    Messages:
    77
    Likes Received:
    54
    Joined:
    Jan 24, 2017

    Soon i will upload this script too.
     
  4. Vagabonden

    Vagabonden Member

    Messages:
    28
    Likes Received:
    2
    Joined:
    Mar 24, 2017
    Going to upload this version or ? :=)
     
  5. TiaqoY0

    TiaqoY0 Member Developer

    Messages:
    11
    Likes Received:
    1
    Joined:
    Mar 5, 2017
    When are you going to upload this script? I need it so badly :=D
     
  6. Vektor42O

    Vektor42O Active Member

    Messages:
    77
    Likes Received:
    54
    Joined:
    Jan 24, 2017
    so i show you guys now how its done.
    First of all, you need this resource:
    https://forum.gtanet.work/index.php?threads/script-injector.1447/
    In that resource, in Server/Main.cs you should modify the GetPlayers function like this:
    Code:
            private void GetPlayers(HttpListenerRequest request, HttpListenerResponse response)
            {
                response.ContentType = "application/json";
                response.AddHeader("Access-Control-Allow-Origin","*");
                string resp = "{\"players\":[";
                foreach(var player in API.getAllPlayers())
                {
                    Vector3 playerPos = API.getEntityPosition(player);
                    resp+="{\"name\":\""+ API.getPlayerName(player) + "\",\"xpos\":"+playerPos.X.ToString().Replace(',','.')+",\"ypos\":"+playerPos.Y.ToString().Replace(',','.')+"},";
                }
                resp = resp.Remove(resp.Length-1,1);
                resp += "]}";
                response.WriteOutputString(resp);
            }
    After in this map you should add this in your map.js after this line "map.addControl(new ExitControl({ text: 'Copyright 2015 GrandTheftAuto.net and Rockstar Games' }));"
    Code:
        var pIcon = L.icon({
            iconUrl: 'http://icons.iconarchive.com/icons/paomedia/small-n-flat/1024/map-marker-icon.png',
            iconSize:     [24, 24], // size of the icon
            iconAnchor:   [12, 24], // point of the icon which will correspond to marker's location
            popupAnchor:  [0, -24] // point from which the popup should open relative to the iconAnchor
        });
    
        //L.marker([-1370.6250, 56.1227], {icon: pIcon}).addTo(window.map).bindPopup("Show something on map. Its the golf place.");
        var markers = [];
    
        function displayPlayers()
        {
            for(var i = 0; i < markers.length; i++)
            {
                map.removeLayer(markers[i]);
            }
            $.ajax({
                type: 'GET',
                dataType: 'json',
                url: 'http://127.0.0.1:8080/get/players',
                success:function(data)
                {
                    var obj = data;
                    var totalLocations = obj.length;
                    var array = [];
                    array = obj.players;
    
                    for (var i = 0; i < array.length; i++)
                    {
                        markers[i] = L.marker([parseFloat(array[i].xpos),parseFloat(array[i].ypos)], {icon: pIcon}).addTo(map).bindPopup("Name: "+array[i].name);
                    }
                }
            });
        }
        displayPlayers();
    
        setInterval(displayPlayers,1000);
     
    punisherxa and TiaqoY0 like this.
  7. punisherxa

    punisherxa New Member

    Messages:
    1
    Likes Received:
    0
    Joined:
    Apr 3, 2017
    Where did you fill var markers? if you dont know how many players are connected
    Edit: Can't compile anything, so many errors :/
     
    Last edited: Apr 10, 2017
  8. Vektor42O

    Vektor42O Active Member

    Messages:
    77
    Likes Received:
    54
    Joined:
    Jan 24, 2017
    If the markers variable is empty, then the loop wont start.
    And i didn't compiled anything.
     
  9. Vito

    Vito New Member

    Messages:
    4
    Likes Received:
    0
    Joined:
    Apr 12, 2017
    Good They will serve some of the people they want
     
  10. Vektor42O

    Vektor42O Active Member

    Messages:
    77
    Likes Received:
    54
    Joined:
    Jan 24, 2017
    [​IMG]

    [​IMG]

    Adding gang zones or simple zones:
    Code:
        L.rectangle([[-1370.6250, 56.1227], [-1070.6250, -456.1227]], {color: "#ff7800", weight: 1, fillOpacity: 0.5}).addTo(map).bindPopup("Zone ID: 0<br>Owner: Los Santos Mafia");
        L.rectangle([[-670.6250, 178.1227], [200.6250, -156.1227]], {color: "#00FF00", weight: 1, fillOpacity: 0.5}).addTo(map).bindPopup("Zone ID: 1<br>Owner: Grove Street Families");
    
     
    TiaqoY0 and « Joseph » like this.
  11. « Joseph »

    « Joseph » Member

    Messages:
    18
    Likes Received:
    1
    Joined:
    Feb 10, 2017
  12. Vagabonden

    Vagabonden Member

    Messages:
    28
    Likes Received:
    2
    Joined:
    Mar 24, 2017
    Had to do some extra changes for public but works perfect! :=)

    Thanks!
     
  13. Vektor42O

    Vektor42O Active Member

    Messages:
    77
    Likes Received:
    54
    Joined:
    Jan 24, 2017
    What do you mean? :=)
     
  14. KenTavR

    KenTavR New Member

    Messages:
    2
    Likes Received:
    0
    Joined:
    Apr 2, 2017
    Tell me please which command or button the map is opening. I do not know much about js api =(
     
  15. Phillor

    Phillor Member

    Messages:
    9
    Likes Received:
    4
    Joined:
    Jan 29, 2017
    Nice one.
    I noticed that the leaflet version you're using is outdated. I'm for example not able to bind Tooltips which are present in the leaflet docs though. Do you have a workaround to place Texts on top of rectangle areas or do you plan to update the used leaflet version?

    Thanks in advance.
     
    Vektor42O likes this.
  16. Vektor42O

    Vektor42O Active Member

    Messages:
    77
    Likes Received:
    54
    Joined:
    Jan 24, 2017
    I am using the uploaded version of leaflet and tooltips working for me.
     
  17. Phillor

    Phillor Member

    Messages:
    9
    Likes Received:
    4
    Joined:
    Jan 29, 2017
    Code:
    L.rectangle([[-580.6250, -2000.1227], [-2000.6250, -3625.1227]], {color: "#6b6b6b", weight: 1, fillOpacity: 0.5}).addTo(map).bindTooltip("Example");
    Actually not working for me. It's giving me the Error: "TypeError: bindTooltip is not a function". Any idea? I mean I don't know if it's different in this uploaded version (it was actually released in 2014) but in the present documentation it shoudl work like this.
     
  18. Skizot

    Skizot Member

    Messages:
    5
    Likes Received:
    1
    Joined:
    Apr 17, 2017
    Any possibility of having polygons? (basically, not just rectangle but actual shapes.) I wanna setup zones in game that can be controlled by factions, and i want it to load those factions onto the map.


    edit: nvm looking at leaflet i can do it. and some other fun stuff too.
     
    Last edited: Apr 25, 2017
  19. Inzenx

    Inzenx New Member

    Messages:
    1
    Likes Received:
    0
    Joined:
    Sep 20, 2016
    I'm sorry but it seems as if your download link is down, would it be possible to reupload?
     

Share This Page