TGRHavoc / live_map

A FiveM addon for live maps
https://docs.tgrhavoc.co.uk/livemap-resource/
62 stars 38 forks source link

Player not getting tracked after removing and triggering "livemap:AddPlayerData" #50

Closed RobijnGit closed 3 years ago

RobijnGit commented 3 years ago

In the document it says

Note, when using livemap:AddPlayerData or livemap:UpdatePlayerData if the player has been removed using livemap:RemovePlayer they will be tracked again.

But, when I use livemap:RemovePlayer to remove the player, it wont show the player when I use livemap:AddPlayerData or livemap:UpdatePlayerData..

RegisterCommand("hide", function()
    print("hide")
    TriggerServerEvent("livemap:RemovePlayer")
end)

RegisterCommand("show", function()
    print("show")
    TriggerServerEvent("livemap:AddPlayerData", "", "")
end)

Is this something I did wrong or an issue? Any help would be appreciated.

TGRHavoc commented 3 years ago

TriggerServerEvent("livemap:RemovePlayer")

This removes all the data knows about the player, including his position, icon etc. So, you will need to add them back to the server.

Something like this in your custom client should work:

TriggerServerEvent("livemap:AddPlayerData", "pos", GetEntityCoords(PlayerPedId()))
TriggerServerEvent("livemap:AddPlayerData", "icon", 6)

I think this might be the least amount of data needed to show the blips. Note: You will need to update the pos data to see the blip move on the interface.

TGRHavoc commented 3 years ago

@RobijnGit did the last comment help? Am I able to close this issue? :)

RobijnGit commented 3 years ago

@RobijnGit did the last comment help? Am I able to close this issue? :)

Yes it did, thank you.