View Full Version : Vehicle ownership - (theory rather than code)

04/04/2013, 09:38 AM
Ok so I am creating my vehicle system and I am stuck on the logic.

At the mo I have an enum with all the vInfo. When a player spawns I want to spawn all their vehicles, when they leave de spawn all of them.

So in OnPlayerSpawn I run the command to collect all players vehicles. BUT!!!! here is the problem. I want to now set these into the enum in this format

playerVehicles[vehicleid][vBitOfInfoHere] But I don't have the vehicleid yet as I haven't spawned it but I can't spawn it till I have set all the relevent info. I'm at a bit of a loss to be honest.

Obviously vehicleid is the only identifier that is kept while the players vehicles are loaded so I'm struggling with how to do it. I need the enum because I want to update the data about the vehicle periodically while the player is on without having to call to the database each time.

Hope it makes sense

04/04/2013, 09:54 AM
So use a temporary variable. Store all the info there, spawn the vehicle, then copy it to the main array.

Oh my god I feel dumb now. Sometimes its the simple things you miss!!

Thanks ******, and for your plugins also!

04/04/2013, 10:15 AM
Unrelated but rather than start a new thread. How do you loop through the rows in the cache on BLUEG's Mysql plugin??