Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

OxVehicle Changes #212

Open
Alexr03 opened this issue Nov 14, 2024 · 3 comments
Open

OxVehicle Changes #212

Alexr03 opened this issue Nov 14, 2024 · 3 comments

Comments

@Alexr03
Copy link
Contributor

Alexr03 commented Nov 14, 2024

Currently, in order to get an instance of an OxVehicle, the vehicle must either be spawned in game by using Ox.CreateVehicle or Ox.SpawnVehicle.

Otherwise you cannot get the instance of OxVehicle.
I think it would be useful if we can use the getters such as Ox.GetVehicleFromVin, if not already spawned, then grab from the database, so we can access some of its functions like setOwner, setPlate, etc without having to query/update the database ourselves.

I've also noticed theres no way to get a list of vehicles that the owner or group owns, maybe if the OxVehicle class can exist without the requirement of an entity, this can also be implemented?

E.G. We have a vehicle purchase system where players can put their vehicle up on the marketplace. When another player purchases the vehicle we'd need to switch the owner over, right now we have to update the database manually.

@CeebDev
Copy link
Contributor

CeebDev commented Nov 14, 2024

I've also noticed theres no way to get a list of vehicles that the owner or group owns, maybe if the OxVehicle class can exist without the requirement of an entity, this can also be implemented?

Definitly, but these require big changes. It implied that all db vehicles are registered by core at launch.
This can be a problem on big server with +10K vehicles where only few of them are spawned.

@CeebDev
Copy link
Contributor

CeebDev commented Nov 14, 2024

Imo, it's preferable to stay like this and query db ourself.
For example, if you have key system like me, where players can open and drive vehicles with a vehicle key item. Then you have to check in db what vehicles the user have access to.
So not only where he is registered as owner

For me, it's better to handle all theses queries that can change by servers. Owner or Group field are not used by core, it's just a base for you to build on top of this

@Alexr03
Copy link
Contributor Author

Alexr03 commented Nov 14, 2024

I've also noticed theres no way to get a list of vehicles that the owner or group owns, maybe if the OxVehicle class can exist without the requirement of an entity, this can also be implemented?

Definitly, but these require big changes. It implied that all db vehicles are registered by core at launch. This can be a problem on big server with +10K vehicles where only few of them are spawned.

Not sure why you would want to load all of the vehicles upon resource start?
What im asking for is if the vehicle is not already being tracked by ox_core (being inside of this.keys.vin etc) then it would then perform a lookup on the database to get that vehicle with said VIN/ID, etc. And would build the OxVehicle object from that data, that would then make the functions accessible. I don't think it would require that big of a change.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants