TGRHavoc / live_map

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

Question #54

Closed WolfoTheWolf closed 3 years ago

WolfoTheWolf commented 3 years ago

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

TGRHavoc commented 3 years ago

This would be something you'd have to do on the interface side. Unfortunately there's no way at the moment to force a filter by default.

However, if you or your developers are comfortable editing the code yourself and rebuilding it, then the following should be enough:

On line https://github.com/TGRHavoc/live_map-interface/blob/master/js/src/controls.2.js#L112

window.Filter = { on: "change me" } // This should be a property of the user. E.g. "icon" if you're using that for cars.
$("#filterOn").val("change me"); // same as above. Makes the UI show the filter
$("#onlyShow").val("something"); // What do you only want to show. If above is "icon" then this should be the icon number.

Then running gulp in the main directory should be enough to update the minified scripts. You should then be good to go.

This is obviously a work-around for an actual implementation but, it should work for you.

I might add URL parameters to the interface in the next update. This would allow for you to share a URL such as http://live_map/#filterOn=change me&onlyShow=something to automatically apply the filter instead of modifying the source code.

I do need to refactor the interface's code though. Its a bit spaghetti-fied at the moment.

WolfoTheWolf commented 3 years ago

Alrighty sounds good, I spent about 4-5 hours going threw all the code trying to figure out what parameters were being used for what, what I was planning on doing after I couldn’t figure out the UI part I was just going to completely remove the player from the map if they are not in the vehicle (aka fully remove the player data via the event) then when in the vehicle it will re-add the player if the vehicle is some sort of police car. Appreciate the quick response and looking forward to see the new features/updates that get pushed out over time.

TGRHavoc commented 3 years ago

Okay, I've made an issue on the interface for the feature I've mentioned here. If everything has been answered and you're satisfied can I close this issue?

WolfoTheWolf commented 3 years ago

Yup everything is fine, thanks for the response