FiveM - Vehicle Keys (Lock System)
cd resources
git clone https://github.com/Azael-Dev/azael_vehiclekeys [local]/[azael]/[system]/azael_vehiclekeys
- ดาวน์โหลด https://github.com/Azael-Dev/azael_vehiclekeys/archive/refs/heads/main.zip
- แก้ไข
azael_vehiclekeys-main
เป็นazael_vehiclekeys
- วางไว้ใน
[local]/[azael]/[system]
- สามารถตรวจสอบการกำหนดค่าเพิ่มเติมได้ที่ config
- เพิ่มสิ่งนี้ไปยัง
server.cfg
ด้านล่างox_lib
,ox_inventory
ensure azael_vehiclekeys
- ไปยัง
ox_inventory/data/items.lua
และดำเนินการเพิ่มรหัสด้านล่างนี้
["vehicle_key"] = {
label = "Vehicle Key",
description = "Vehicle Key",
weight = 500,
stack = false,
close = true,
consume = 0,
client = {
image = "keys.png",
export = 'azael_vehiclekeys.useItem',
}
},
- เพิ่ม กุญแจยานพาหนะ ไปยังกระเป๋าของผู้เล่น
exports.azael_vehiclekeys:AddKey(source, plate, description)
Name | Type | Required | Description |
---|---|---|---|
source |
number |
✔️ | NetID (Player ID) ของผู้เล่น |
plate |
string |
✔️ | ป้ายทะเบียน ยานพาหนะ |
description |
string / nil |
❌ | คำอธิบายเพิ่มเติม |
- ลบ กุญแจยานพาหนะ ออกจากกระเป๋าของผู้เล่น
exports.azael_vehiclekeys:RemoveKey(source, plate, strict)
Name | Type | Required | Description |
---|---|---|---|
source |
number |
✔️ | NetID (Player ID) ของผู้เล่น |
plate |
string |
✔️ | ป้ายทะเบียน ยานพาหนะ |
strict |
boolean / nil |
❌ | ตรวจสอบ plate ใน metadata อย่างเข้มงวด |
- อ้างอิงจาก esx_vehicleshop เวอร์ชันล่าสุด
- ไปที่
esx_vehicleshop/server/main.lua
ค้นหาTaskWarpPedIntoVehicle(GetPlayerPed(source), vehicle, -1)
(#166) และวางรหัสด้านล่างนี้ต่อ
local vehicle = getVehicleFromModel(model)
pcall(function()
exports.azael_vehiclekeys:AddKey(xPlayer.source, plate, ('Type: %s \nName: %s \nPlate: %s'):format(vehicle.categoryLabel, vehicle.name, plate))
end)
- ไปที่
esx_vehicleshop/server/main.lua
ค้นหาxPlayer.addMoney(resellPrice, "Sold Vehicle")
และวางรหัสด้านล่างนี้ต่อจากRemoveOwnedVehicle(plate)
(#309)
pcall(function()
exports.azael_vehiclekeys:RemoveKey(xPlayer.source, plate, false)
end)
ลิขสิทธิ์ (C) Azael Dev - สงวนลิขสิทธิ์
- ห้ามใช้ชิ้นส่วนใดๆ ของซอฟต์แวร์นี้ในผลิตภัณฑ์ / บริการเชิงพาณิชย์
- ห้ามนำซอฟต์แวร์นี้ไปขายต่อ
- คุณจะต้องไม่จัดหาสิ่งอำนวยความสะดวกใด ๆ ในการติดตั้งซอฟต์แวร์นี้ในผลิตภัณฑ์ / บริการเชิงพาณิชย์
- หากคุณแจกจ่ายซอฟต์แวร์นี้ใหม่ คุณต้องเชื่อมโยงไปยังที่เก็บดั้งเดิมที่ azael_vehiclekeys
- ลิขสิทธิ์นี้ควรปรากฏในทุกส่วนของรหัสโครงการ
License (ENG): https://github.com/Azael-Dev/azael_vehiclekeys/blob/main/LICENSE