【发布时间】:2019-05-21 23:36:16
【问题描述】:
设置一个 Fivem 服务器并尝试在放入自定义 job_grades 后让 esx_policejobs 工作。出现错误并卡了几个小时,我不知道我是否在这里遗漏了什么?
还有一个控制台行说堆栈回溯到不同的 .lua 文件,那么这最终会是那里的问题而不是实际的配置文件吗?
看了一遍又一遍配置,真的找不到问题
recruit = {
{ weapon = 'WEAPON_APPISTOL', components = { 0, 0, 1000, 4000, nil }, price = 10000 },
{ weapon = 'WEAPON_NIGHTSTICK', price = 0 },
{ weapon = 'WEAPON_STUNGUN', price = 1500 },
{ weapon = 'WEAPON_FLASHLIGHT', price = 80 },
},
private = {
{ weapon = 'WEAPON_APPISTOL', components = { 0, 0, 1000, 4000, nil }, price = 10000 },
{ weapon = 'WEAPON_ADVANCEDRIFLE', components = { 0, 6000, 1000, 4000, 8000, nil }, price = 50000 },
{ weapon = 'WEAPON_NIGHTSTICK', price = 0 },
{ weapon = 'WEAPON_STUNGUN', price = 500 },
{ weapon = 'WEAPON_FLASHLIGHT', price = 0 },
},
private-first-class = {
{ weapon = 'WEAPON_APPISTOL', components = { 0, 0, 1000, 4000, nil }, price = 10000 },
{ weapon = 'WEAPON_ADVANCEDRIFLE', components = { 0, 6000, 1000, 4000, 8000, nil }, price = 50000 },
{ weapon = 'WEAPON_PUMPSHOTGUN', components = { 2000, 6000, nil }, price = 70000 },
{ weapon = 'WEAPON_NIGHTSTICK', price = 0 },
{ weapon = 'WEAPON_STUNGUN', price = 500 },
{ weapon = 'WEAPON_FLASHLIGHT', price = 0 }
},
sergeant = {
{ weapon = 'WEAPON_APPISTOL', components = { 0, 0, 1000, 4000, nil }, price = 10000 },
{ weapon = 'WEAPON_ADVANCEDRIFLE', components = { 0, 6000, 1000, 4000, 8000, nil }, price = 50000 },
{ weapon = 'WEAPON_PUMPSHOTGUN', components = { 2000, 6000, nil }, price = 70000 },
{ weapon = 'WEAPON_NIGHTSTICK', price = 0 },
{ weapon = 'WEAPON_STUNGUN', price = 500 },
{ weapon = 'WEAPON_FLASHLIGHT', price = 0 },
},
lieutenant = {
{ weapon = 'WEAPON_APPISTOL', components = { 0, 0, 1000, 4000, nil }, price = 10000 },
{ weapon = 'WEAPON_ADVANCEDRIFLE', components = { 0, 6000, 1000, 4000, 8000, nil }, price = 50000 },
{ weapon = 'WEAPON_PUMPSHOTGUN', components = { 2000, 6000, nil }, price = 70000 },
{ weapon = 'WEAPON_NIGHTSTICK', price = 0 },
{ weapon = 'WEAPON_STUNGUN', price = 500 },
{ weapon = 'WEAPON_FLASHLIGHT', price = 0 },
},
captain = {
{ weapon = 'WEAPON_APPISTOL', components = { 0, 0, 1000, 4000, nil }, price = 10000 },
{ weapon = 'WEAPON_ADVANCEDRIFLE', components = { 0, 6000, 1000, 4000, 8000, nil }, price = 50000 },
{ weapon = 'WEAPON_PUMPSHOTGUN', components = { 2000, 6000, nil }, price = 70000 },
{ weapon = 'WEAPON_NIGHTSTICK', price = 0 },
{ weapon = 'WEAPON_STUNGUN', price = 500 },
{ weapon = 'WEAPON_FLASHLIGHT', price = 0 },
},
inspector = {
{ weapon = 'WEAPON_APPISTOL', components = { 0, 0, 1000, 4000, nil }, price = 10000 },
{ weapon = 'WEAPON_ADVANCEDRIFLE', components = { 0, 6000, 1000, 4000, 8000, nil }, price = 50000 },
{ weapon = 'WEAPON_PUMPSHOTGUN', components = { 2000, 6000, nil }, price = 70000 },
{ weapon = 'WEAPON_NIGHTSTICK', price = 0 },
{ weapon = 'WEAPON_STUNGUN', price = 500 },
{ weapon = 'WEAPON_FLASHLIGHT', price = 0 },
},
deputy-chief = {
{ weapon = 'WEAPON_APPISTOL', components = { 0, 0, 1000, 4000, nil }, price = 10000 },
{ weapon = 'WEAPON_ADVANCEDRIFLE', components = { 0, 6000, 1000, 4000, 8000, nil }, price = 50000 },
{ weapon = 'WEAPON_PUMPSHOTGUN', components = { 2000, 6000, nil }, price = 70000 },
{ weapon = 'WEAPON_NIGHTSTICK', price = 0 },
{ weapon = 'WEAPON_STUNGUN', price = 500 },
{ weapon = 'WEAPON_FLASHLIGHT', price = 0 },
},
assistant-chief = {
{ weapon = 'WEAPON_APPISTOL', components = { 0, 0, 1000, 4000, nil }, price = 10000 },
{ weapon = 'WEAPON_ADVANCEDRIFLE', components = { 0, 6000, 1000, 4000, 8000, nil }, price = 50000 },
{ weapon = 'WEAPON_PUMPSHOTGUN', components = { 2000, 6000, nil }, price = 70000 },
{ weapon = 'WEAPON_NIGHTSTICK', price = 0 },
{ weapon = 'WEAPON_STUNGUN', price = 500 },
{ weapon = 'WEAPON_FLASHLIGHT', price = 0 },
},
chief-of-police = {
{ weapon = 'WEAPON_APPISTOL', components = { 0, 0, 1000, 4000, nil }, price = 10000 },
{ weapon = 'WEAPON_ADVANCEDRIFLE', components = { 0, 6000, 1000, 4000, 8000, nil }, price = 50000 },
{ weapon = 'WEAPON_PUMPSHOTGUN', components = { 2000, 6000, nil }, price = 70000 },
{ weapon = 'WEAPON_NIGHTSTICK', price = 0 },
{ weapon = 'WEAPON_STUNGUN', price = 500 },
{ weapon = 'WEAPON_FLASHLIGHT', price = 0 },
},
}
不应该是任何配置错误
控制台错误:
Failed to load script config.lua.
Error loading script server/main.lua in resource esx_policejob: @esx_policejob/server/main.lua:5: attempt to index a nil value (global 'Config')
stack traceback:
@esx_policejob/server/main.lua:5: in main chunk```
【问题讨论】:
标签: lua