Code Monkey home page Code Monkey logo

live_map's People

Contributors

allcontributors[bot] avatar avery1227 avatar dependabot[bot] avatar matsn0w avatar skoodat avatar tgrhavoc avatar tomgrobbe avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

live_map's Issues

WebSocket Task Exception

Unhandled task exception:
vtortola.WebSockets.WebSocketException: There is an ongoing message that is being written from somewhere else. Only a single write is allowed at the time.
at vtortola.WebSockets.Rfc6455.WebSocketConnectionRfc6455.BeginWriting () [0x0001a] in <069e04caabe8400085a58196bb4add44>:0
at vtortola.WebSockets.Rfc6455.WebSocketRfc6455.CreateMessageWriter (vtortola.WebSockets.WebSocketMessageType messageType) [0x0001e] in <069e04caabe8400085a58196bb4add44>:0
at vtortola.WebSockets.WebSocketStringExtensions+d__2.MoveNext () [0x0003c] in <069e04caabe8400085a58196bb4add44>:0

Issue? Im not sure..

Hey there im new to fivem (making servers) and I dont think I did this right..
Screenshot (5)
Screenshot (6)

Player Location disappears when not moving

Not only does the blip disappear, but due to lack of movement, the map says that user isn't online until they move again.

I was afking while checking code, then noticed, so not sure on how long it takes, but it doesn't seem long.

Question (not urgent, also sorry for all the questions recently)

Hey there! For anyone who knows how I could fix this its not a major issue as of now but if someone has a solution it would be appreciated.

HOW I HAVE IT SET UP ====

So once a player leaves there car it removes them from the script, once they get back in a police car that is under the EMERGENCY category it re-adds them to the map

ISSUE == Issue is that once they exit the police car then get back in it says there are 2 of the same people in the group (will go away after a map refresh via the browser

1
2
3

Map interface loading issue

Just re-downloaded the live map and live map interface, and am now seeing this issue when moving around on the interface. I can confirm this on 2 computers.

image

Google API

I get an error on the live map saying "This page can not load Google Map correctly."
Here are some screenshots of the issue.
image
image

Access denied for command blips.

Hello dear,

We want to generate the blips file. We have give us in the server.cfg the group admin. Do you have a fix for it. We have no errors from the console or f8.

Kind regards,

William

Question

I know there is a setting for showing only cars but how could I force this to be default?

High resource usage

Describe the bug
I've updated to the latest version today (3.2.0) and the resource usage has gone up significantly to the point where it's hanging and blocking the threads of other resources it seems. In fairness I haven't updated in a while, previously on 3.1.0, so I'm not sure if it's an issue with this version - I'm going to roll back one at a time and see where the issue started.

I've seen you now provide a reverse proxy through a CFX URL, as a test I disabled this in the server.cfg to rule that out. Also another point, not sure if it's related, but the server console has a lot of errors saying "identifier cannot be null".

To Reproduce
Running live_map version 3.2.0 on FX server version 4394 (recommended build) on Windows. No specific behaviour, just runs at a high ms in the background.

Expected behavior
Running with minimal ms impact.

Screenshots
Resmon: https://downham.dev/i/zotff.png
Server console: https://downham.dev/i/j54pl.png

Better documentation

At the moment the documentation is one page.
The readme.. That's it. Instead the documentation should be split up into digestible files.

For example:

  • config.md - Contains information about configuring the resource.
  • faq.md - Frequently asked questions about the resource. This should also contain information about running npm/yarn manually if it fails to start on it's own?
  • developers.md - Developer information. Cloning the repo, installing the dependencies in package.json with NPM/YARN
    • NPM: See https://www.npmjs.com/get-npm. After it's installed npm install
    • Yarn requires NPM anyways so, might be good to just go over npm.
    • What lives where and the various things you can do (events, etc).

That's just an idea of the files we could see. More could be added if needed.

[question]: how to convert lng & lat to x, y ,z

Hey!

This is somewhat related to #51. I've tried to convert the lat & lng from the moveend event in leaflet using map.project({ lat, lng }) but with no success. I think there is a simple solution but I can't come up with it, any suggestions how I could convert it?

Example:

marker.on("moveend", (e) => {
 const latLng = e.target._latlng;
 
 // This would return the converted values from the leaflet map back to the GTA map
 const xYZ = ConvertLatLngToXYZ(latLng);
})

Thanks!

Better socket management

Allow developers to easily add socket listeners to the application.
This could mean creating an abstract class that they can override that is automatically loaded into the socket server.

Better blip managment

Possibly add command to update the blips that show on the map. E.g.

/livemap update will update the blip table.

When the resource is stopped, the blip table should be saved to a json file. This file should then be used on next start up (if available)

Blips Disappear after server restart

I was able to install the map with no issues, however as soon as I restart the server, the blips are no longer available on the live map. Everything else seems to work, just the blips don't save.

Crashing

For some reason the resource (specifically the DLL component) crashes and stops sending data to connected interfaces (users).

I don't know why exactly this happens but, it does and it's fairly predicable (e.g. after a day of running on my server, which is pretty in-active, it will crash). It also spews out a "too many files open" message which, leads me to think that the sockets aren't being closed properly. I can't seem to reliably reproduce this behaviour either (I've tried DoS-ing the socket server but, it looks good).

So, I can either cap the number of people who can connect to the interface (configurable, obviously) or I can try and pin-point how/when/why they aren't being closed.

Fails to work with Linux

Hello, im trying to upgrade this on my Linux Server but now its stating that it can not find or install the "webpack" resource? do you have any guides or tutorials on how to install WebPack on linux builds? as what ive read it states Webpack is unsupported?

[question]: convert lat & lng back to GTA map coords

Hi!

I'm trying to add blips to the in-game map but need to convert the lat and lng back to the GTAV map. Is there a way how todo that?

(When someone moves a blip on the live map, it will move it in-game)

Thanks!

Add null checks to data being set

For some reason some data being sent to the UpdatePlayerData function is null and causing an error. Don't know why ๐Ÿ˜•

To combat this, add null checks to all the things exposed to the API

Live map not found as a resource.

I installed the resource as the install instruction state but the resource is failing to be found on the server. Is there a way to fix this issue so I can be found?

Thank you

Couldnt Start Resource LIvemap

I downloaded the resource, I didn't make any changes to it, I added it into the Resource Folder and Started it.
For some reason in the console, it says it couldn't start the resource.
If anyone knows why, please let me know!

Location on livemap is somewhat off

Describe the bug
The location of the players on the server seems somewhat off on the livemap. Further down I have added screenshots with my accurate locations in-game, with the location the livemap shows me at.

Screenshots
In the following screenshots you can see what I mean. Left side is livemap, right side is game map.
Locations for reference:
Oil fields:
image
Vespucci Canals:
image
Corner of the airport:
image
On the G of Mount Gordo indicator:
image

Possible Solution
I assume this has something to do with the scaling/size/position of the livemap.
If I am at the bottom left of the map, it shows me more top right on the livemap.
If I am at the top right of the map, it shows me more bottom left on the livemap.

Additional context/Screenshots
We run Livemap Version 4.1.8.

Contact Information

Havoc,

I'm looking to get in contract to hire you for a small project, I've been unable to find a proper contact source for you on your website.

Please reach out to me anytime,
Email: [email protected]
Discord: Brian S#7602

Update dependencies

Original issue posted: https://forum.cfx.re/t/release-livemap/49901/986?u=havoc

Info:
GameServer: Zap-hosting (Windows)

What I've tried:
Added start yarn and start webpack to my server.cfg.
Tried both commenting out and leaving the yarn and webpack dependencies in the __resource.lua.

Here is the printout of the logs surrounding webpack and yarn:

> Found new resource webpack in C:/cygwin\home\zap529355\g247734\gta5-fivem\server-data/resources//[system]/[builders]/webpack
Found new resource yarn in C:/cygwin\home\zap529355\g247734\gta5-fivem\server-data/resources//[system]/[builders]/yarn
...
Creating script environments for yarn
Started resource yarn
Creating script environments for webpack
Started resource webpack
...
Running build tasks on resource live_map - it'll restart once completed.
**Couldn't start resource live_map.**
...
yarn install v1.21.0
info No lockfile found.
[1/4] Resolving packages...
warning webpack > watchpack > watchpack-chokidar2 > [email protected]: Chokidar 2 will break on node v14+. Upgrade to chokidar 3 with 15x less dependencies.
warning webpack > watchpack > watchpack-chokidar2 > chokidar > [email protected]: fsevents 1 will break on node v14+ and could be using insecure binaries. Upgrade to fsevents 2.
warning webpack > micromatch > snapdragon > source-map-resolve > [email protected]: https://github.com/lydell/resolve-url#deprecated
warning webpack > micromatch > snapdragon > source-map-resolve > [email protected]: Please see https://github.com/lydell/urix#deprecated
...
[3/4] Linking dependencies...
error Could not write file "C:\\cygwin\\home\\zap529355\\g247734\\gta5-fivem\\server-data\\resources\\live_map\\yarn-error.log": "EPERM: operation not permitted, open 'C:\\cygwin\\home\\zap529355\\g247734\\gta5-fivem\\server-data\\resources\\live_map\\yarn-error.log'"
error An unexpected error occurred: "EPERM: operation not permitted, mkdir 'C:\\cygwin\\home\\zap529355\\g247734\\gta5-fivem\\server-data\\resources\\live_map\\node_modules'".
info Visit https://yarnpkg.com/en/docs/cli/install for documentation about this command.

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

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.

Socket times out, this exception occurs

 Error invoking callback for event livemap:internal_UpdatePlayerData: System.Reflection.TargetInvocationException:                         Exception has been thrown by the target of an invocation. ---> System.ArgumentNullException: Value cannot be null.
Parameter name: propertyName
at Newtonsoft.Json.Linq.JObject.get_Item (System.String propertyName) [0x0001d] in <90125bc3858247a4a5e3af0c303                        5e4aa>:0
at Havoc.Live_Map.SocketHandler.MakeSurePlayerExists (System.String identifier) [0x00014] in <9ca75ce7b3b24934a                        8aa8ba78af89566>:0
at Havoc.Live_Map.SocketHandler.UpdatePlayerData (System.String identifier, System.String key, System.Object ne                        wData) [0x0001b] in <9ca75ce7b3b24934a8aa8ba78af89566>:0
at (wrapper dynamic-method) System.Object:CallSite.Target (System.Runtime.CompilerServices.Closure,System.Runti                        me.CompilerServices.CallSite,Havoc.Live_Map.SocketHandler,string,string,object)
at System.Dynamic.UpdateDelegates.UpdateAndExecuteVoid4[T0,T1,T2,T3] (System.Runtime.CompilerServices.CallSite                         site, T0 arg0, T1 arg1, T2 arg2, T3 arg3) [0x0011e] in <fb8f7831037a4d3481e7bbe63117e3d0>:0
at (wrapper delegate-invoke) System.Action`5[System.Runtime.CompilerServices.CallSite,Havoc.Live_Map.SocketHand                        ler,System.String,System.String,System.Object]:invoke_void_T1_T2_T3_T4_T5 (System.Runtime.CompilerServices.CallSite,Havoc.Live_Map.SocketHandler,st                        ring,string,object)
at (wrapper dynamic-method) System.Object:CallSite.Target (System.Runtime.CompilerServices.Closure,System.Runti                        me.CompilerServices.CallSite,Havoc.Live_Map.SocketHandler,string,string,object)
at Havoc.Live_Map.LiveMap.InternalUpdatePlayerData (System.String identifier, System.String key, System.Object                         data) [0x0005c] in <9ca75ce7b3b24934a8aa8ba78af89566>:0
at (wrapper managed-to-native) System.Reflection.MonoMethod:InternalInvoke (System.Reflection.MonoMethod,object                        ,object[],System.Exception&)
at System.Reflection.MonoMethod.Invoke (System.Object obj, System.Reflection.BindingFlags invokeAttr, System.Re                        flection.Binder binder, System.Object[] parameters, System.Globalization.CultureInfo culture) [0x00032] in <d7e663f2f7cd4ab6929018ec5233f09d>:0
  --- End of inner exception stack trace ---
at System.Reflection.MonoMethod.Invoke (System.Object obj, System.Reflection.BindingFlags invokeAttr, System.Re                        flection.Binder binder, System.Object[] parameters, System.Globalization.CultureInfo culture) [0x00048] in <d7e663f2f7cd4ab6929018ec5233f09d>:0
at System.Reflection.MethodBase.Invoke (System.Object obj, System.Object[] parameters) [0x00000] in <d7e663f2f7                        cd4ab6929018ec5233f09d>:0
at System.Delegate.DynamicInvokeImpl (System.Object[] args) [0x000e7] in <d7e663f2f7cd4ab6929018ec5233f09d>:0
 at System.MulticastDelegate.DynamicInvokeImpl (System.Object[] args) [0x00008] in <d7e663f2f7cd4ab6929018ec5233                        f09d>:0
at System.Delegate.DynamicInvoke (System.Object[] args) [0x00000] in <d7e663f2f7cd4ab6929018ec5233f09d>:0
 at CitizenFX.Core.EventHandlerEntry+<Invoke>d__5.MoveNext () [0x00122] in /src/code/client/clrcore/EventHandler                        Dictionary.cs:144

This was the exception that caused the livemap to essentially crash, it happened when we loaded the recource.

Update for FXServer

Code needs updating to be compatible with fxserver. This means removing the clr references for loading the socket server and possibly updating it to use convars.

Expose blip json file

Expose the json file that contains the blip data using the http handler in fxserver.

This should free up socket bandwidth and may make the whole thing a bit faster.

This way, there's no need to send the static blips over socket connection, the live map can just use ajax to get the data instead.

Add dynamic blips

Is your feature request related to a problem? Please describe.
We're building an online system for police roleplay that allows dispatchers to create a callout on a certain position on the map. When a callout is created, the players see this callout as a blip on their (in-game) map. A GPS route is created for them on the fly. We'd like to add these blip to the live map too.

Describe the solution you'd like
It would be nice if it was possible to add and remove blips on the fly.

Describe alternatives you've considered
I can add a blip with /blip, but this is only working after a restart of the resource.

Having a error with loading the map ((((Error getting blips! Maybe the server is down or, the config is setup incorrectly.))))

So I have just re-installed the live map and cleared my server cache now im having a issue actually connecting to it (btw for this demo im using xxamp) Set it up how I did last time nothing different now it does not want to show blips (when I added it I was getting a node error so I did npm i in the cmd of the live_map folder to install node winch made the error disappear) Just cant figure out why its saying there is a error.
Capture
Captu2re

Help needed

Where do I put the examples please? I'm lost on how to actually install this? I got my own cad but not sure where to install live_map please can u add me on discord, leepafc2#3411 thanks

Map freezes randomly stops showing live locations?

Not sure if it's due to another user logging on and watching, or what it is, but the other night while playing, we wanted to keep all players closely together, so we used the map to watch locations, and it seemed as if only 1 person could watch the map live at a time. No errors were thrown, but I did have to do a "/restart live_map" command in game to get it to work again before a few seconds later it would freeze up again.

Move from websockets to see

Websockets are probably not the best technology to use for LiveMap. We don't send any data back from the client so, SSE is looking more promising.

Plus, if we start to use SSE's we can take advantage of FiveM's reverse proxy and move their installations to Ssl-enabled websites.

Obviously this would need a re-write of the interface.
It wouldn't be breaking on the resource side (no changes to the API) . Maybe would on the interface)(as we're scrapping websockets all together which, might be relied on by custom scripts).

Documentation

Update the documentation like we did for the interface..

Also, make sure to document all events

"livemap:internal_" Server Events appear to be non-existent - Nothing happens when they're called and they appear to be non-existent in code.

Title states it all: The following events do not appear to exist at all in code and do not do anything at all when called server side:

  • livemap:internal_AddPlayerData
  • livemap:internal_UpdatePlayerData
  • livemap:internal_RemovePlayerData

Taking a look at this (server side events documented in the readme) and this (server side events documented on your docs site), with minor network/event optimization in mind, I thought why not just rewrite my script which used to trigger 6 (update) events every few seconds all at the same time to instead just trigger 1 single event with all of the data combined and then split up and distribute the data as needed server side between your live maps resource and my other scripts; the part with my scripts worked but not the part with live maps. Sample code below (cut down):


client.lua:

TriggerServerEvent('eventA', dataA, dataB, dataC)
TriggerServerEvent('eventB', dataA, dataB, dataC)

server.lua

RegisterNetEvent('eventA') AddEventHandler('eventA', function(dataA, dataB, dataC)
    local pId = GetPlayerIdentifier(source, 0)
    TriggerEvent("livemap:internal_AddPlayerData", pId, "dataA", tostring(dataA))
    TriggerEvent("livemap:internal_AddPlayerData", pId, "dataB", tostring(dataB))
    TriggerEvent("livemap:internal_AddPlayerData", pId, "dataC", tostring(dataC))
end
RegisterNetEvent('eventB') AddEventHandler('eventB', function(dataA, dataB, dataC)
    local pId = GetPlayerIdentifier(source, 0)
    TriggerEvent("livemap:internal_UpdatePlayerData", pId, "dataA", tostring(dataA))
    TriggerEvent("livemap:internal_UpdatePlayerData", pId, "dataB", tostring(dataB))
    TriggerEvent("livemap:internal_UpdatePlayerData", pId, "dataC", tostring(dataC))
end

Expected results from the code above: Client sends a set or pack of data to the server all at one time, server then distributes the received data to the respective events (live maps, and live maps displays the data)

What happens with the code above: Client sends a set or pack of data to the server all at one time, server then distributes the received data to the respective events (live maps), nothing happens (live maps does not print any error or react and displays nothing).

Move to UDP

The resource currently uses websockets which, are built on TCP. This causes issues when sending the data from the FiveM server to the clients (ie. Having to wait for previous packets to have been sent before sending more).

So, moving to WebRTC (which is built on top of UDP) might increase the performance by a lot.

I might be able to move the connection onto the server and implement a PHP client that accepts UDP data from the resource running on FiveM.

LiveMap couldn't save the blips to file.. Maybe the directory isn't writable?

Upon running the /blips generate command as an admin, the following error is provided via console, "LiveMap couldn't save the blips to file.. Maybe the directory isn't writable?"
I have ensured that all directories, sub directories and files are owned by the user running the server and are readable, writable, and executable by that user.

License Plate doesn't get removed from data

Describe the bug
When entering a vehicle, the license plate gets added to the player data. (here). This works fine, except that it won't get removed after leaving the vehicle.

To Reproduce
Steps to reproduce the behavior:

  1. Enter a vehicle
  2. Watch player data in the interface
  3. Leave vehicle
  4. Watch player data again, license plate should still be visible

Expected behavior
License plate should be removed from player info.

Screenshots
image

Desktop (please complete the following information):

  • OS: Windows 10 Pro 64-bit
  • Browser: Microsoft Edge
  • Version: 92.0.902.78

Possible Solution
Not sure what's going on, I tried adding some different kind of info (emergency status, see example below) and this works as expected.

Additional context/Screenshots
In doVehicleUpdate():

-- check if the siren is turned on
local siren_on = IsVehicleSirenOn(vehicle)

-- add the emergency status to the data table
data["Emergency"] = siren_on and "Yes" or "No"

-- update the player data
TriggerServerEvent("livemap:UpdatePlayerData", "Emergency", data["Emergency"])

and

Citizen.CreateThread(function()
    while true do
        Wait(10)

        if NetworkIsPlayerActive(PlayerId()) then

            -- Update Vehicle (and icon)
            if IsPedInAnyVehicle(PlayerPedId()) then
                doVehicleUpdate()

            elseif data["Licence Plate"] ~= nil or data["Vehicle"] ~= nil then
                -- No longer in a vehicle, remove "Licence Plate" if present
                data["Licence Plate"] = nil
                data["Vehicle"] = nil
                data["Emergency"] = nil
                temp["vehicle"] = nil

                -- Remove it from socket communication
                TriggerServerEvent("livemap:RemovePlayerData", "Licence Plate")
                TriggerServerEvent("livemap:RemovePlayerData", "Emergency")
                TriggerServerEvent("livemap:RemovePlayerData", "Vehicle")
            end
        end
    end
end)

Move to a NodeJS based resource

Feel more comfortable writing NodeJS and feel the socket server can be written much better with it.

It would need to keep the current events as to keep comparability with current solutions out there.
Maybe it could even provide some extra functionality?

Add more blip icons

Need to add more blip icons, this includes adding deceleration of them on the UI-side.

Error to getting the blips

Hello,
If we do the command blips generate, it will not load the blips on the server and on the website, how can we fix this?

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.