[RE-RELEASE] garages async/couchdb

You can install these just by dragging and dropping all these scripts into your resources folder and add each of them indevidually into the yml file for autostart. you do have to have a mysql database and mysql-async as well as a couchdb server. then import all the sql files into your database except for sqlof13.06.17.sql located in ply_garages.

Works with Essentialmode 3.2.3?

My goal is not to convert everything to just couchdb it is to add support inside of scripts that use mysql-async for scripts that use couchdb. For instance if a script that relies on 2 scripts say vdk_inventory and an old version of a weapon shop, i would convert the weapon shop but leave the mysql-async in for vdk_inventory because its not broke. I only convert things that will break otherwise.

I have everything except mysql Async. How do I set that up?

yes this works with essentialsmode 3.x.x

mysql async is litterally just drag and drop then you add you db info to it here is the thread:

What exactly is the point in MySQL Async?

it is just a way to have mysql api without essentialsmode 2.0 plus it breaks way less and you dont have to put you db info in every scripts

So wait the ply_garages is not couchdb?

no, it used to be only mysql-async untill i made it work for es_garages and it only works for es_garages currently thats why i included it in the pack, this is meant to be a standalone car system complete with buying storing and saving vehicles

oh and btw guys if you whant the police script to work with the license plates replace
AddEventHandler(‘police:checkingPlate’, function(plate)

blah
blah
blah

end)

with

AddEventHandler('police:checkingPlate', function(plate)

	if(db.driver == "mysql") then
		local executed_query = MySQL:executeQuery("SELECT Nom FROM user_vehicle JOIN users ON user_vehicle.identifier = users.identifier WHERE vehicle_plate = '@plate'", { ['@plate'] = plate })
		local result = MySQL:getResults(executed_query, { 'Nom' }, "identifier")
		if (result[1]) then
			for _, v in ipairs(result) do
				TriggerClientEvent("police:notify", source, "CHAR_ANDREAS", 1, txt[config.lang]["title_notification"], false, txt[config.lang]["vehicle_checking_plate_part_1"]..plate..txt[config.lang]["vehicle_checking_plate_part_2"] .. v.Nom..txt[config.lang]["vehicle_checking_plate_part_3"])
			end
		else
			TriggerClientEvent("police:notify", source, "CHAR_ANDREAS", 1, txt[config.lang]["title_notification"], false, txt[config.lang]["vehicle_checking_plate_part_1"]..plate..txt[config.lang]["vehicle_checking_plate_not_registered"])
		end
	elseif(db.driver == "mysql-async") then
		MySQL.Async.fetchAll("SELECT * FROM user_vehicle WHERE vehicle_plate = @plate", { ['@plate'] = plate }, function (result)
				local isworking = false
				local name = " "
				--TriggerClientEvent("chatMessage", source, "test ", {255, 0, 0}, " " .. tostring(result) .. " " .. tostring(plate))
				for _, v in ipairs(result) do
								--TriggerClientEvent("chatMessage", source, "test ", {255, 0, 0}, " " .. tostring(v.id))
								for i = 0, 31 do
								
								--if NetworkIsPlayerActive( i ) then
								--TriggerClientEvent("chatMessage", source, "test ", {255, 0, 0}, " " .. tostring(v.id))
								--local ids = GetPlayerFromServerId(1)
								--TriggerClientEvent("chatMessage", source, "test ", {255, 0, 0}, " " .. tostring(v.id))
									TriggerEvent('es:getPlayerFromId', i, function(user)
										
											--TriggerClientEvent("chatMessage", source, "test ", {255, 0, 0}, " " .. tostring(v.id))
											if user.identifier == v.identifier then
												name = GetPlayerName(tonumber(i))
												if name ~= " " then
													TriggerClientEvent("police:notify", source, "CHAR_ANDREAS", 1, txt[config.lang]["title_notification"], false, txt[config.lang]["vehicle_checking_plate_part_1"]..plate..txt[config.lang]["vehicle_checking_plate_part_2"] .. name..txt[config.lang]["vehicle_checking_plate_part_3"])
												else
												TriggerClientEvent("police:notify", source, "CHAR_ANDREAS", 1, txt[config.lang]["title_notification"], false, txt[config.lang]["vehicle_checking_plate_part_1"]..plate..txt[config.lang]["vehicle_checking_plate_not_registered"])
												end
											end
										
									end)
									--end
								end
										
								
							
						--end
					
					
				
			
				
			
		end
		end)
	end
	
end)

then replace the function CheckPlate() in menupolice.lua with:


function CheckPlate()
	local pos = GetEntityCoords(GetPlayerPed(-1))
	local entityWorld = GetOffsetFromEntityInWorldCoords(GetPlayerPed(-1), 0.0, 20.0, 0.0)

	local rayHandle = CastRayPointToPoint(pos.x, pos.y, pos.z, entityWorld.x, entityWorld.y, entityWorld.z, 10, GetPlayerPed(-1), 0)
	local _, _, _, _, vehicleHandle = GetRaycastResult(rayHandle)
	if(DoesEntityExist(vehicleHandle)) then
		local plate = GetVehicleNumberPlateText(vehicleHandle)
		TriggerServerEvent("police:checkingPlate", plate)
	else
		drawNotification(txt[config.lang]["no_veh_near_ped"])
	end
end




You did not answer my question do garages work with couchdb?

es_garages does but ply_garage does not yet. but it doesnt need to, the way it works is that prefecture reads the list of vehicles via es_garages couchdb database, and then registers it in your mysql database with all the vehicle info, then the ply_garages will store it and bring it out with modifications such as color and wheel types already loaded.

I updated the repository so everyone get it while its hot. once you get it delete your server cash, and good to go!

I will always strive to give the very best that i can with scripts, and I hope others will aswell. Keep an eye out for updates with this pack and future things i do!

Thank you for everyone who supported this thread and who understands why i did it. Now that it is back up I can continue to push out updates!

I would appreciate any further comments related to the idea that i uploaded this without Plysken_Rayder’s permission please pm them to me and I will message you directly, this is not a place for off-topic posts.

Dude you are such a badass, been trying so hard to get checkplate working! Keep it up man.

np man enjoy it while its still up, because its possible they may take it back down lol… idk for sure though.

Thanks man, nice work

No problem thank you for the reply!