我试图在我的脚本中实现一些东西,但我不知道为什么当我尝试进入 lscustoms 时会出现这个错误(这个脚本是为 5m 制作的,它可以让你调整你的车)然后我得到了黑屏 -
脚本错误:
@lscustoms/lscustoms.lua:355:'pairs' 的参数 #1 错误(预期表,为零)
DriveInGarage (@lscustoms/lscustoms.lua:355
fn (@lscustoms/lscustoms.lua:719)
-- 代码:
从第 339 行到第 360 行
local m = LSCMenu.categories:addSubMenu("LIGHTS", "Lights", "Improved night time visibility.",true)
AddMod(22,LSCMenu.categories.Lights,"HEADLIGHTS", "Headlights", nil, false)
if not IsThisModelABike(GetEntityModel(veh)) then
m = m:addSubMenu("NEON KITS", "Neon kits", nil, true)
m:addSubMenu("NEON LAYOUT", "Neon layout", nil, true)
local btn = m["Neon layout"]:addPurchase("None")
for n, mod in pairs(LSC_Config.prices.neonlayout) do
local btn = m["Neon layout"]:addPurchase(mod.name,mod.price)
end
m = m:addSubMenu("NEON COLOR", "Neon color", nil, true)
for n, mod in pairs(LSC_Config.prices.neoncolor) do
local btn = m:addPurchase(mod.name,mod.price)btn.neon = mod.neon
end
m = m:addSubMenu("XENON COLOR", "Xenon color", nil, true)
for n, mod in pairs(LSC_Config.prices.xenoncolor) do
local btn = m:addPurchase(mod.name,mod.price)btn.xenon = mod.xenon
local btn = m:addPurchase("Stock")
myveh.xenonColor = -1
end
end
从 682 到 757
--Magical loop that allows you to drive in garage if you successfully go through checks
Citizen.CreateThread(function()
while true do
Citizen.Wait(0)
--If you are not already in garage
if inside == false then
local ped = LocalPed()
--Well... yes... we actually need a car to do something
if IsPedSittingInAnyVehicle(ped) then
local veh = GetVehiclePedIsUsing(ped)
--If the vehicle exist, player is in driver seat and if this vehicle is a car or bike then we are good to go
if DoesEntityExist(veh) and GetPedInVehicleSeat(veh, -1) == ped and (IsThisModelACar(GetEntityModel(veh)) or IsThisModelABike(GetEntityModel(veh))) then
--So lets go through every garage
for i,pos in ipairs(garages) do
--Lets take the outside coords of garage
outside = pos.drivein
--Old enter:If vehicle is close enough, then text will be displayed - Press ENTER to enter garage
if LSC_Config.oldenter then
--So, if vehicle is close enough then we can continue
if GetDistanceBetweenCoords(outside.x,outside.y,outside.z,GetEntityCoords(ped)) <= f(5) then
--Lets check if our vehicle is not in the model black list, and if it is not then we can go further
if not tableContains(LSC_Config.ModelBlacklist,GetDisplayNameFromVehicleModel(GetEntityModel(veh)):lower()) then
--If the garage is locked
if pos.locked then
--If the config lock system is not enabled then we can go traight in garage, but if it is enabled then not
if not LSC_Config.lock then
inside = true
currentpos = pos
currentgarage = i
DriveInGarage()
else
drawTxt("~r~Asteapta, este deja cineva",4,1,0.5,0.8,1.0,255,255,255,255)
end
else
inside = true
currentpos = pos
currentgarage = i
DriveInGarage()
end
else
drawTxt("~r~Masina nu a fost modificata",4,1,0.5,0.8,1.0,255,255,255,255)
end
end
else
--So, if vehicle is close enough and it's facing the garage then we can continue
if math.abs(GetEntityHeading(veh)-outside.heading) <= 90 and IsVehicleStopped(veh) and GetDistanceBetweenCoords(outside.x,outside.y,outside.z,GetEntityCoords(ped)) <= f(5) then
--Lets check if our vehicle is not in the model black list, and if it is not then we can go further
if not tableContains(LSC_Config.ModelBlacklist,GetDisplayNameFromVehicleModel(GetEntityModel(veh)):lower()) then
--If the garage is locked
if pos.locked then
--If the config lock system is not enabled then we can go traight in garage, but if it is enabled then not
if not LSC_Config.lock then
inside = true
currentpos = pos
currentgarage = i
DriveInGarage()
else
drawTxt("~r~Asteapta, este deja cineva",4,1,0.5,0.8,1.0,255,255,255,255)
end
else
inside = true
currentpos = pos
currentgarage = i
DriveInGarage()
end
else
drawTxt("~r~Masina nu a fost modificata",4,1,0.5,0.8,1.0,255,255,255,255)
end
end
end
end
end
end
end
end
end)
如果有人知道我做错了什么,请告诉我:}