[RE-RELEASE] esx_eden garage2: 3 in 1 garage

Try to set in connection string user variables true
Like it’s said in console :wink:

Hi guys !

First, thank @Jager_Bom for you script ! You are really awesome !

All works, but I got just one problem, when I try to get vehicle from mecano I got this error on my server terminal :

[ERROR] [MySQL] An critical error happens on MySQL for query "select * from owned_vehicles inner join characters on owned_vehicles.owner = characters.identifier where fourrieremecano=@fourrieremecano {@fourrieremecano=true}": An item with the same key has already been added. Key: id   at System.ThrowHelper.ThrowAddingDuplicateWithKeyArgumentException (System.Object key) [0x00006] in <49fde7938a9b47b480042d844e818c7e>:0
  at System.Collections.Generic.Dictionary`2[TKey,TValue].TryInsert (TKey key, TValue value, System.Collections.Generic.InsertionBehavior behavior) [0x000ad] in <49fde7938a9b47b480042d844e818c7e>:0
  at System.Collections.Generic.Dictionary`2[TKey,TValue].Add (TKey key, TValue value) [0x00000] in <49fde7938a9b47b480042d844e818c7e>:0
  at MySQLAsync.FetchAll+<ReaderAsync>d__2.MoveNext () [0x000e9] in <d68afb0aae7f4a79b70303ba76ce60db>:0
--- End of stack trace from previous location where exception was thrown ---
  at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw () [0x0000c] in <49fde7938a9b47b480042d844e818c7e>:0
  at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess (System.Threading.Tasks.Task task) [0x0003e] in <49fde7938a9b47b480042d844e818c7e>:0
  at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification (System.Threading.Tasks.Task task) [0x00028] in <49fde7938a9b47b480042d844e818c7e>:0
  at System.Runtime.CompilerServices.TaskAwaiter.ValidateEnd (System.Threading.Tasks.Task task) [0x00008] in <49fde7938a9b47b480042d844e818c7e>:0
  at System.Runtime.CompilerServices.TaskAwaiter`1[TResult].GetResult () [0x00000] in <49fde7938a9b47b480042d844e818c7e>:0
  at MySQLAsync.Operation`1+<ExecuteAsync>d__3[TResult].MoveNext () [0x00169] in <d68afb0aae7f4a79b70303ba76ce60db>:0

Someone know where it’s come from?

Thank you so much ! :slight_smile:

Your primary key is id? Not plate?

Yes my primary key it’s ‘id’, I don’t have a colonne ‘plate’ in my owned_vehicles table !

there’s your problem.

looks okay like that :slight_smile:
lets see inside table because looks like you got duplicates

I seem to be having issues with storing vehicles keeps telling me I cannot save this vehicle. I check and it’s trying to search I’d so I added the column but it still not saving the cars. Any help would be great

1 Like

Why people in my server can spawn the same vehicle 200 times?

because they take out the car, then go directly to impound and take their car back. but i ll fix it with new features incomming with code opitmalisation

ID must be your primary key !not plate

1 Like

You gotta have ID in your database, if it’s missing that’s why its not working, as @Jager_Bom said make it primary key.

Thank you, its working now!

However, it seems that mods are not saving, and my paint job changed when taking it out. I also need to have the car modified before it will save.

It saves carmods… So if it does not you probably did something wrong

You have fixed the issue with the dup cars that people can continuously spawn them.

1 Like

Are you referring to when they open the menu and spawn the car? Just have it close the menu before the vehicle is spawned and therefor they click it it closes the menu then spawns the vehicle then when they re open the menu their car will be outside garage, if you want to prevent duping using the Retrieve section thats a whole other story.

Any idea where I can look to remedy this issue ?

[MySQL] [Slow Query Warning] [esx_eden_garage] [136ms] UPDATE owned_vehicles SET
vehicle =’{“modTrimA”:-1,“modHydrolic”:-1,“modPlateHolder”:-1,“modSmokeE
nabled”:1,“modTank”:-1,“modFrontWheels”:-1,“modSuspension”:3,“modTurbo”
:1,“dirtLevel”:10.374458312988,“pearlescentColor”:111,“modTransmission”:2,
“neonColor”:[255,0,255],“modFrame”:-1,“neonEnabled”:[false,false,false,fal
se],“wheels”:7,“modSeats”:-1,“modArmor”:0,“modDoorSpeaker”:-1,“modDashb
oard”:-1,“modSpoilers”:2,“modGrille”:-1,“tyreSmokeColor”:[255,255,255],"
modRightFender":-1,“modBrakes”:2,“modWindows”:-1,“modStruts”:-1,“modSpea
kers”:-1,“plate”:“TDUE2355”,“modFender”:-1,“modDial”:-1,“model”:-1297
672541,“modAerials”:-1,“color2”:0,“modTrunk”:-1,“wheelColor”:156,“modSi
deSkirt”:2,“modBackWheels”:-1,“modEngine”:3,“health”:982,“windowTint”:-
1,“modLivery”:-1,“modOrnaments”:-1,“modAPlate”:-1,“modRoof”:0,“modSteer
ingWheel”:-1,“modArchCover”:-1,“modXenon”:false,“modVanityPlate”:-1,“mod
EngineBlock”:-1,“modFrontBumper”:-1,“modHood”:-1,“modTrimB”:-1,“modRearB
umper”:1,“modExhaust”:0,“modAirFilter”:-1,“modHorns”:-1,“modShifterLeave
rs”:-1,“plateIndex”:4,“color1”:12}’ WHERE id=3067
[MySQL] [Slow Query Warning] [esx_eden_garage] [202ms] SELECT * FROM owned_vehic
les WHERE owner=‘steam:11000010e4dxxxx’

thanks for the warning :slight_smile: but i don’t know how this could be a slow sql, because he only takes your cars :thinking: and i assume you got like 10-15 cars .

for the first sqlhe needs to update one row so i really don’t understand …

CREATE TABLE `owned_vehicles` (
	`owner` varchar(30) NOT NULL,
	`plate` varchar(12) NOT NULL,
	`vehicle` longtext,
	PRIMARY KEY (`plate`)
);

plate is the index if you come from esx_vehicleshop. I do not know where the column id comes from nor do I see an INDEX on owner.

So it searches the entire table. Which is slow.

Now Imagine a community with 4k memebers everyone owning 3 vehicles. Sorting through 12k rows manually is slow. Needs proper indexing.

thats not true, because here he does only a select where identifier so the result is small. the processing is done by the server itself, and yes i do admit it’s not the most efficient way to do it. so the “warning” is not on its place