Code Monkey home page Code Monkey logo

Comments (8)

TGRHavoc avatar TGRHavoc commented on August 16, 2024

Ooof, looks like I haven't documented the event...

There's an event called livemap:AddBlip on the server that takes a blip object as it's parameter. This should add a blip to the interface when it's called (as well as adding it to the blips.json file). It's a "static" blip (i.e it won't move like player's blips do) but, sounds like it could be what you're looking for.

The blip object is defined as

    A blip follows the format:
    {
        sprite = Number (required)

        pos = Table (required){
            x = Float (required)
            y = Float (required)
            z = Float (required)
        }

        name = String (optional)
        description = String (optional)
    }

from live_map.

matsn0w avatar matsn0w commented on August 16, 2024

Hi, thank you for pointing out, but I already discovered that. Except, it's not working :( I tought that it wasn't possible like so.

It's kinda weird. I add a blip like this when a callout is created:

client.lua

-- create a blip object for the live map
local live_map_blip = {
    name = "Callout",
    description = name,
    sprite = 61,
    pos = {
        x = x,
        y = y,
        z = 0
    }
}

TriggerServerEvent('livemap:AddBlip', live_map_blip)

It's not showing up on the map. When I refresh the blips via the controls menu, the new blip shows up in blips.json, but doesn't appear on the map... See screenshot:

image

For testing purposes, I haven't generated any other blips.

How are you updating the blips file? When the blip is added, it shows up in my browser console, but not in the actual file on my server? It's only there after stopping the resource lol 😀 Then when starting the resource again, the blip shows up on the map! (after a refresh of course).

I'm confused XD

Also, when switching servers (between local and production), the blips from the old server remain on the map. They disappear after a manual refresh. Will write an issue for that on the interface repo.

EDIT: TGRHavoc/live_map-interface#81

Thank you for your incredible speedy support these days, it really helps :)

BTW, do you have a list of supported sprites?

from live_map.

TGRHavoc avatar TGRHavoc commented on August 16, 2024

When the blip is added, it shows up in my browser console, but not in the actual file on my server?

Yeah. If I recall correctly, the blips.json file should only be written to when the resource is stopped.
It should appear on the interface as soon as it's created though.... It might a an issue on the interface, not sure. I'll have to have a look when I get some more free time (just had a bunch of tasks for work come through).
Thanks for the interface issue, must have not implemented the whole "remove all blips when switching servers" logic that I had before the refactor :)

Thank you for your incredible speedy support these days, it really helps :)
And thank you for the detailed bug reports. Some people don't use the template and expect me to work miracles.

As for sprites for the blips:
https://github.com/TGRHavoc/live_map-interface/blob/develop/js/src/markers.js#L8

The "id" is what you're looking for. If a sprite doesn't have an "id" then, just add one (or however many down it is from the last one with an "id").

For example, "Store" has the id of "52".

from live_map.

matsn0w avatar matsn0w commented on August 16, 2024

Switched to adding it in server.lua:

-- create a blip object for the live map
local live_map_blip = {
    name = "Callout",
    description = name,
    sprite = 61,
    pos = {
        x = coords.x,
        y = coords.y,
        z = 0
    }
}

TriggerEvent('livemap:AddBlip', live_map_blip)

The blips now show after a manual 'refresh blips' in the interface, but is giving me a [WARN] LiveMap Sockets - Blip has no sprite...

from live_map.

matsn0w avatar matsn0w commented on August 16, 2024

As for sprites for the blips:
https://github.com/TGRHavoc/live_map-interface/blob/develop/js/src/markers.js#L8

The "id" is what you're looking for. If a sprite doesn't have an "id" then, just add one (or however many down it is from the last one with an "id").

For example, "Store" has the id of "52".

Does that correspond to this?

I'm using 41 in-game (flashing red/blue), but I guess something like that isn't possible ;)

from live_map.

TGRHavoc avatar TGRHavoc commented on August 16, 2024

Does that correspond to this?

No, iirc, I got the blip IDs from Scripthook (https://github.com/crosire/scripthookvdotnet/blob/main/source/scripting_v3/GTA/BlipSprite.cs / https://gtamods.com/wiki/Blip_Sprite_IDs) but, removed the ones that I couldn't find on the texture sheet.

I'm using 41 in-game (flashing red/blue), but I guess something like that isn't possible ;)

Not unless you add an icon yourself (a GIF of a blue to red circle) and add the marker yourself using the ID 41 since, it's available.
Tbf, It might be a good idea to make the blips on the interface use the same IDs and images as the ones documented on FiveM... I guess I would need to write a script to scrape the icons and the IDs because fuck writing that out by hand

from live_map.

DoJoMan18 avatar DoJoMan18 commented on August 16, 2024
local live_map_blip = {
    name = "Callout",
    description = name,
    sprite = 61,
    pos = {
        x = coords.x,
        y = coords.y,
        z = 0
    }
}

TriggerEvent('livemap:AddBlip', live_map_blip)

Very late comment, but did you get it working? Its seems that the blip gets written directly to the blips.json. Server console is just responding with "[WARN] LiveMap Sockets - Blip has no sprite...". Indeed, when you refresh the webpage it reloads the blips.json and therefore seems to display the blip.

from live_map.

DoJoMan18 avatar DoJoMan18 commented on August 16, 2024

I've just removed the validBlip from the livemap.js in the FiveM resource. Browser now gives a error: https://i.imgur.com/kgXjhaS.jpeg

The code i'm using:

`
local pos = GetEntityCoords(PlayerPedId(), not IsPlayerDead(PlayerId()))

    local live_map_blip = {
        name = "Callout",
        description = "test1",
        sprite = 50,
        pos = {
            x = pos.x,
            y = pos.y,
            z = pos.z
        }
    }

    TriggerServerEvent('livemap:AddBlip', live_map_blip)`

from live_map.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.