GD Docs

การใช้งานเชื่อมกับสคริปต์อื่นๆ

อัปเดตล่าสุด

Exports สำหรับใช้งาน Custom shop เชื่อมกับร้านขายยานพาหนะหน่วยงานหรืออื่นๆ#

lua
-- Client Exports
exports['gd_vehicleshop']:OpenCustomShop("ชื่อ custom shop")

-- ตัวอย่างการใช้งาน
-- ตัวอย่างจากการใช้งานสคริปต์ esx_policejob
-- ชื่อ custom shop ให้นำมาจาก gd_vehicleshop/config/config.custom_shop.lua
ESX.UI.Menu.Open('default', GetCurrentResourceName(), 'vehicle', {
		title    = _U('garage_title'),
		align    = 'top-left',
		elements = elements
	}, function(data, menu)
		if data.current.action == 'buy_vehicle' then
			local shopElements, shopCoords = {}
			menu.close()
			if type == 'car' then
				if exports['gd_vehicleshop'] then
				        -- เรียกใช้งาน exports เพื่อเปิดร้านขายยานพาหนะที่ custom
					exports['gd_vehicleshop']:OpenCustomShop('police_car_shop')
				end
			elseif type == 'helicopter' then
				if exports['gd_vehicleshop'] then
					-- เรียกใช้งาน exports เพื่อเปิดร้านขายยานพาหนะที่ custom
					exports['gd_vehicleshop']:OpenCustomShop('police_helicopter_shop')
				end
			end
		else
                ...โค้ดเดิมที่มีอยู่แล้ว
	end, function(data, menu)
		menu.close()
	end)
end