SA-MP Forums Archive
Vehicle ownership - (theory rather than code) - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: Vehicle ownership - (theory rather than code) (/showthread.php?tid=428013)



Vehicle ownership - (theory rather than code) - liam1412 - 04.04.2013

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


Re: Vehicle ownership - (theory rather than code) - liam1412 - 04.04.2013

Quote:
Originally Posted by ******
Посмотреть сообщение
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!


Re: Vehicle ownership - (theory rather than code) - liam1412 - 04.04.2013

Unrelated but rather than start a new thread. How do you loop through the rows in the cache on BLUEG's Mysql plugin??

Thanks