Advertisement
Guest User

Untitled

a guest
Oct 18th, 2019
193
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 14.41 KB | None | 0 0
  1. SCRIPT ERROR: @vrp/modules/item_transformer.lua:310: attempt to index a nil value (upvalue 'cfg')
  2. > finish (@vrp/lib/utils.lua:43)
  3. > task (@vrp/lib/utils.lua:47)
  4. > cb (@vrp/base.lua:248)
  5. > handler (- begin MySQL module
  6. local MySQL = {}
  7.  
  8. MySQL.debug = false
  9. local dpaths = {}
  10.  
  11. local tasks = {}
  12.  
  13. --[[
  14. local function tick()
  15. SetTimeout(1, function() -- protect errors from breaking the loop
  16. SetTimeout(1000, tick)
  17.  
  18. local rmtasks = {}
  19. for id,cb in pairs(tasks) do
  20. local r = exports.vrp_mysql:checkTask(id)
  21. if r.status == 1 then
  22. cb(r.rows,r.affected) -- rows, affected
  23. table.insert(rmtasks, id)
  24. elseif r.status == -1 then
  25. print("[vRP] task "..id.." failed.")
  26. table.insert(rmtasks, id)
  27. end
  28. end
  29.  
  30. -- remove done tasks
  31. for k,v in pairs(rmtasks) do
  32. tasks[v] = nil
  33. end
  34. end)
  35. end
  36. tick()
  37. --]]
  38.  
  39. AddEventHandler("vRP:MySQL_task", function(task_id, data)
  40. -- print("vRP:MySQL_task "..task_id)
  41. local cb = tasks[task_id]
  42. if data.status == 1 then
  43. if cb then
  44. if data.mode == 0 then
  45. cb(data.affected or 0)
  46. elseif data.mode == 1 then
  47. cb(data.scalar or 0)
  48. elseif data.mode == 2 then
  49. cb(data.rows or {}, data.affected or 0) -- rows, affected
  50. end
  51. end
  52. elseif data.status == -1 then
  53. print("[vRP] task "..task_id.." failed.")
  54. end
  55.  
  56. tasks[task_id] = nil
  57.  
  58. if MySQL.debug and dpaths[task_id] then
  59. print("[vRP] MySQL end query "..dpaths[task_id].." ("..task_id..")")
  60. dpaths[task_id] = nil
  61. end
  62. end)
  63.  
  64. local task_id = -1
  65. AddEventHandler("vRP:MySQL_taskid", function(_task_id)
  66. -- print("vRP:MySQL_taskid ".._task_id)
  67. task_id = _task_id
  68. end)
  69.  
  70. -- host can be "host" or "host:port"
  71. function MySQL.createConnection(name,host,user,password,db,debug)
  72. -- print("[vRP] try to create connection "..name)
  73. -- parse port in host as "ip:port"
  74. local host_parts = splitString(host,":")
  75. if #host_parts >= 2 then
  76. host = host_parts[1]..";port="..host_parts[2]
  77. end
  78.  
  79. local config = "server="..host..";uid="..user..";pwd="..password..";database="..db..";"
  80.  
  81. -- TriggerEvent("vRP:MySQL:createConnection", name, config)
  82. exports.vrp_mysql:createConnection(name, config)
  83. end
  84.  
  85. function MySQL.createCommand(path, query)
  86. -- print("[vRP] try to create command "..path)
  87. -- TriggerEvent("vRP:MySQL:createCommand", path, query)
  88. exports.vrp_mysql:createCommand(path, query)
  89. end
  90.  
  91. -- generic query
  92. function MySQL._query(path, args, mode, cb)
  93. -- TriggerEvent("vRP:MySQL:query", path, args)
  94. if not (type(args) == "table") then
  95. args = {}
  96. end
  97.  
  98. -- force args to be a C# dictionary
  99. args._none = " "
  100.  
  101. -- exports.vrp_mysql:query(path, args)
  102. -- print("[vRP] try to query "..path.." id "..task_id)
  103. TriggerEvent("vRP:MySQL_query", path, args, mode)
  104. if MySQL.debug then
  105. print("[vRP] MySQL begin query (m"..mode..") "..path.." ("..task_id..")")
  106. dpaths[task_id] = path
  107. end
  108.  
  109. tasks[task_id] = cb
  110. end
  111.  
  112. -- do a query (multiple rows)
  113. --- cb(rows, affected)
  114. function MySQL.query(path, args, cb)
  115. MySQL._query(path, args, 2, cb)
  116. end
  117.  
  118. -- do a scalar query (one row, one column)
  119. --- cb(scalar)
  120. function MySQL.scalar(path, args, cb)
  121. MySQL._query(path, args, 1, cb)
  122. end
  123.  
  124. -- do a execute query (no results)
  125. --- cb(affected)
  126. function MySQL.execute(path, args, cb)
  127. MySQL._query(path, args, 0, cb)
  128. end
  129.  
  130. -- return module
  131. return MySQL
  132. :45)
  133. > void vRP.MySQL.e_tick() (@vrp_mysql/mysql.net.dll:0)
  134. > fn (@vrp_mysql/init.lua:3)
  135. server thread hitch warning: timer interval of 164 milliseconds
  136. SCRIPT ERROR: @vrp/modules/item_transformer.lua:310: attempt to index a nil value (upvalue 'cfg')
  137. > finish (@vrp/lib/utils.lua:43)
  138. > task (@vrp/lib/utils.lua:47)
  139. > cb (@vrp/base.lua:248)
  140. > handler (- begin MySQL module
  141. local MySQL = {}
  142.  
  143. MySQL.debug = false
  144. local dpaths = {}
  145.  
  146. local tasks = {}
  147.  
  148. --[[
  149. local function tick()
  150. SetTimeout(1, function() -- protect errors from breaking the loop
  151. SetTimeout(1000, tick)
  152.  
  153. local rmtasks = {}
  154. for id,cb in pairs(tasks) do
  155. local r = exports.vrp_mysql:checkTask(id)
  156. if r.status == 1 then
  157. cb(r.rows,r.affected) -- rows, affected
  158. table.insert(rmtasks, id)
  159. elseif r.status == -1 then
  160. print("[vRP] task "..id.." failed.")
  161. table.insert(rmtasks, id)
  162. end
  163. end
  164.  
  165. -- remove done tasks
  166. for k,v in pairs(rmtasks) do
  167. tasks[v] = nil
  168. end
  169. end)
  170. end
  171. tick()
  172. --]]
  173.  
  174. AddEventHandler("vRP:MySQL_task", function(task_id, data)
  175. -- print("vRP:MySQL_task "..task_id)
  176. local cb = tasks[task_id]
  177. if data.status == 1 then
  178. if cb then
  179. if data.mode == 0 then
  180. cb(data.affected or 0)
  181. elseif data.mode == 1 then
  182. cb(data.scalar or 0)
  183. elseif data.mode == 2 then
  184. cb(data.rows or {}, data.affected or 0) -- rows, affected
  185. end
  186. end
  187. elseif data.status == -1 then
  188. print("[vRP] task "..task_id.." failed.")
  189. end
  190.  
  191. tasks[task_id] = nil
  192.  
  193. if MySQL.debug and dpaths[task_id] then
  194. print("[vRP] MySQL end query "..dpaths[task_id].." ("..task_id..")")
  195. dpaths[task_id] = nil
  196. end
  197. end)
  198.  
  199. local task_id = -1
  200. AddEventHandler("vRP:MySQL_taskid", function(_task_id)
  201. -- print("vRP:MySQL_taskid ".._task_id)
  202. task_id = _task_id
  203. end)
  204.  
  205. -- host can be "host" or "host:port"
  206. function MySQL.createConnection(name,host,user,password,db,debug)
  207. -- print("[vRP] try to create connection "..name)
  208. -- parse port in host as "ip:port"
  209. local host_parts = splitString(host,":")
  210. if #host_parts >= 2 then
  211. host = host_parts[1]..";port="..host_parts[2]
  212. end
  213.  
  214. local config = "server="..host..";uid="..user..";pwd="..password..";database="..db..";"
  215.  
  216. -- TriggerEvent("vRP:MySQL:createConnection", name, config)
  217. exports.vrp_mysql:createConnection(name, config)
  218. end
  219.  
  220. function MySQL.createCommand(path, query)
  221. -- print("[vRP] try to create command "..path)
  222. -- TriggerEvent("vRP:MySQL:createCommand", path, query)
  223. exports.vrp_mysql:createCommand(path, query)
  224. end
  225.  
  226. -- generic query
  227. function MySQL._query(path, args, mode, cb)
  228. -- TriggerEvent("vRP:MySQL:query", path, args)
  229. if not (type(args) == "table") then
  230. args = {}
  231. end
  232.  
  233. -- force args to be a C# dictionary
  234. args._none = " "
  235.  
  236. -- exports.vrp_mysql:query(path, args)
  237. -- print("[vRP] try to query "..path.." id "..task_id)
  238. TriggerEvent("vRP:MySQL_query", path, args, mode)
  239. if MySQL.debug then
  240. print("[vRP] MySQL begin query (m"..mode..") "..path.." ("..task_id..")")
  241. dpaths[task_id] = path
  242. end
  243.  
  244. tasks[task_id] = cb
  245. end
  246.  
  247. -- do a query (multiple rows)
  248. --- cb(rows, affected)
  249. function MySQL.query(path, args, cb)
  250. MySQL._query(path, args, 2, cb)
  251. end
  252.  
  253. -- do a scalar query (one row, one column)
  254. --- cb(scalar)
  255. function MySQL.scalar(path, args, cb)
  256. MySQL._query(path, args, 1, cb)
  257. end
  258.  
  259. -- do a execute query (no results)
  260. --- cb(affected)
  261. function MySQL.execute(path, args, cb)
  262. MySQL._query(path, args, 0, cb)
  263. end
  264.  
  265. -- return module
  266. return MySQL
  267. :45)
  268. > void vRP.MySQL.e_tick() (@vrp_mysql/mysql.net.dll:0)
  269. > fn (@vrp_mysql/init.lua:3)
  270. SCRIPT ERROR: @vrp/modules/item_transformer.lua:310: attempt to index a nil value (upvalue 'cfg')
  271. > finish (@vrp/lib/utils.lua:43)
  272. > task (@vrp/lib/utils.lua:47)
  273. > cb (@vrp/base.lua:248)
  274. > handler (- begin MySQL module
  275. local MySQL = {}
  276.  
  277. MySQL.debug = false
  278. local dpaths = {}
  279.  
  280. local tasks = {}
  281.  
  282. --[[
  283. local function tick()
  284. SetTimeout(1, function() -- protect errors from breaking the loop
  285. SetTimeout(1000, tick)
  286.  
  287. local rmtasks = {}
  288. for id,cb in pairs(tasks) do
  289. local r = exports.vrp_mysql:checkTask(id)
  290. if r.status == 1 then
  291. cb(r.rows,r.affected) -- rows, affected
  292. table.insert(rmtasks, id)
  293. elseif r.status == -1 then
  294. print("[vRP] task "..id.." failed.")
  295. table.insert(rmtasks, id)
  296. end
  297. end
  298.  
  299. -- remove done tasks
  300. for k,v in pairs(rmtasks) do
  301. tasks[v] = nil
  302. end
  303. end)
  304. end
  305. tick()
  306. --]]
  307.  
  308. AddEventHandler("vRP:MySQL_task", function(task_id, data)
  309. -- print("vRP:MySQL_task "..task_id)
  310. local cb = tasks[task_id]
  311. if data.status == 1 then
  312. if cb then
  313. if data.mode == 0 then
  314. cb(data.affected or 0)
  315. elseif data.mode == 1 then
  316. cb(data.scalar or 0)
  317. elseif data.mode == 2 then
  318. cb(data.rows or {}, data.affected or 0) -- rows, affected
  319. end
  320. end
  321. elseif data.status == -1 then
  322. print("[vRP] task "..task_id.." failed.")
  323. end
  324.  
  325. tasks[task_id] = nil
  326.  
  327. if MySQL.debug and dpaths[task_id] then
  328. print("[vRP] MySQL end query "..dpaths[task_id].." ("..task_id..")")
  329. dpaths[task_id] = nil
  330. end
  331. end)
  332.  
  333. local task_id = -1
  334. AddEventHandler("vRP:MySQL_taskid", function(_task_id)
  335. -- print("vRP:MySQL_taskid ".._task_id)
  336. task_id = _task_id
  337. end)
  338.  
  339. -- host can be "host" or "host:port"
  340. function MySQL.createConnection(name,host,user,password,db,debug)
  341. -- print("[vRP] try to create connection "..name)
  342. -- parse port in host as "ip:port"
  343. local host_parts = splitString(host,":")
  344. if #host_parts >= 2 then
  345. host = host_parts[1]..";port="..host_parts[2]
  346. end
  347.  
  348. local config = "server="..host..";uid="..user..";pwd="..password..";database="..db..";"
  349.  
  350. -- TriggerEvent("vRP:MySQL:createConnection", name, config)
  351. exports.vrp_mysql:createConnection(name, config)
  352. end
  353.  
  354. function MySQL.createCommand(path, query)
  355. -- print("[vRP] try to create command "..path)
  356. -- TriggerEvent("vRP:MySQL:createCommand", path, query)
  357. exports.vrp_mysql:createCommand(path, query)
  358. end
  359.  
  360. -- generic query
  361. function MySQL._query(path, args, mode, cb)
  362. -- TriggerEvent("vRP:MySQL:query", path, args)
  363. if not (type(args) == "table") then
  364. args = {}
  365. end
  366.  
  367. -- force args to be a C# dictionary
  368. args._none = " "
  369.  
  370. -- exports.vrp_mysql:query(path, args)
  371. -- print("[vRP] try to query "..path.." id "..task_id)
  372. TriggerEvent("vRP:MySQL_query", path, args, mode)
  373. if MySQL.debug then
  374. print("[vRP] MySQL begin query (m"..mode..") "..path.." ("..task_id..")")
  375. dpaths[task_id] = path
  376. end
  377.  
  378. tasks[task_id] = cb
  379. end
  380.  
  381. -- do a query (multiple rows)
  382. --- cb(rows, affected)
  383. function MySQL.query(path, args, cb)
  384. MySQL._query(path, args, 2, cb)
  385. end
  386.  
  387. -- do a scalar query (one row, one column)
  388. --- cb(scalar)
  389. function MySQL.scalar(path, args, cb)
  390. MySQL._query(path, args, 1, cb)
  391. end
  392.  
  393. -- do a execute query (no results)
  394. --- cb(affected)
  395. function MySQL.execute(path, args, cb)
  396. MySQL._query(path, args, 0, cb)
  397. end
  398.  
  399. -- return module
  400. return MySQL
  401. :45)
  402. > void vRP.MySQL.e_tick() (@vrp_mysql/mysql.net.dll:0)
  403. > fn (@vrp_mysql/init.lua:3)
  404. [vRP] 188.178.100.50 disconnected (user_id = 17)
  405. Sending heartbeat to live-internal.fivem.net:30110
  406. SCRIPT ERROR: @vrp/modules/item_transformer.lua:310: attempt to index a nil value (upvalue 'cfg')
  407. > finish (@vrp/lib/utils.lua:43)
  408. > task (@vrp/lib/utils.lua:47)
  409. > cb (@vrp/base.lua:248)
  410. > handler (- begin MySQL module
  411. local MySQL = {}
  412.  
  413. MySQL.debug = false
  414. local dpaths = {}
  415.  
  416. local tasks = {}
  417.  
  418. --[[
  419. local function tick()
  420. SetTimeout(1, function() -- protect errors from breaking the loop
  421. SetTimeout(1000, tick)
  422.  
  423. local rmtasks = {}
  424. for id,cb in pairs(tasks) do
  425. local r = exports.vrp_mysql:checkTask(id)
  426. if r.status == 1 then
  427. cb(r.rows,r.affected) -- rows, affected
  428. table.insert(rmtasks, id)
  429. elseif r.status == -1 then
  430. print("[vRP] task "..id.." failed.")
  431. table.insert(rmtasks, id)
  432. end
  433. end
  434.  
  435. -- remove done tasks
  436. for k,v in pairs(rmtasks) do
  437. tasks[v] = nil
  438. end
  439. end)
  440. end
  441. tick()
  442. --]]
  443.  
  444. AddEventHandler("vRP:MySQL_task", function(task_id, data)
  445. -- print("vRP:MySQL_task "..task_id)
  446. local cb = tasks[task_id]
  447. if data.status == 1 then
  448. if cb then
  449. if data.mode == 0 then
  450. cb(data.affected or 0)
  451. elseif data.mode == 1 then
  452. cb(data.scalar or 0)
  453. elseif data.mode == 2 then
  454. cb(data.rows or {}, data.affected or 0) -- rows, affected
  455. end
  456. end
  457. elseif data.status == -1 then
  458. print("[vRP] task "..task_id.." failed.")
  459. end
  460.  
  461. tasks[task_id] = nil
  462.  
  463. if MySQL.debug and dpaths[task_id] then
  464. print("[vRP] MySQL end query "..dpaths[task_id].." ("..task_id..")")
  465. dpaths[task_id] = nil
  466. end
  467. end)
  468.  
  469. local task_id = -1
  470. AddEventHandler("vRP:MySQL_taskid", function(_task_id)
  471. -- print("vRP:MySQL_taskid ".._task_id)
  472. task_id = _task_id
  473. end)
  474.  
  475. -- host can be "host" or "host:port"
  476. function MySQL.createConnection(name,host,user,password,db,debug)
  477. -- print("[vRP] try to create connection "..name)
  478. -- parse port in host as "ip:port"
  479. local host_parts = splitString(host,":")
  480. if #host_parts >= 2 then
  481. host = host_parts[1]..";port="..host_parts[2]
  482. end
  483.  
  484. local config = "server="..host..";uid="..user..";pwd="..password..";database="..db..";"
  485.  
  486. -- TriggerEvent("vRP:MySQL:createConnection", name, config)
  487. exports.vrp_mysql:createConnection(name, config)
  488. end
  489.  
  490. function MySQL.createCommand(path, query)
  491. -- print("[vRP] try to create command "..path)
  492. -- TriggerEvent("vRP:MySQL:createCommand", path, query)
  493. exports.vrp_mysql:createCommand(path, query)
  494. end
  495.  
  496. -- generic query
  497. function MySQL._query(path, args, mode, cb)
  498. -- TriggerEvent("vRP:MySQL:query", path, args)
  499. if not (type(args) == "table") then
  500. args = {}
  501. end
  502.  
  503. -- force args to be a C# dictionary
  504. args._none = " "
  505.  
  506. -- exports.vrp_mysql:query(path, args)
  507. -- print("[vRP] try to query "..path.." id "..task_id)
  508. TriggerEvent("vRP:MySQL_query", path, args, mode)
  509. if MySQL.debug then
  510. print("[vRP] MySQL begin query (m"..mode..") "..path.." ("..task_id..")")
  511. dpaths[task_id] = path
  512. end
  513.  
  514. tasks[task_id] = cb
  515. end
  516.  
  517. -- do a query (multiple rows)
  518. --- cb(rows, affected)
  519. function MySQL.query(path, args, cb)
  520. MySQL._query(path, args, 2, cb)
  521. end
  522.  
  523. -- do a scalar query (one row, one column)
  524. --- cb(scalar)
  525. function MySQL.scalar(path, args, cb)
  526. MySQL._query(path, args, 1, cb)
  527. end
  528.  
  529. -- do a execute query (no results)
  530. --- cb(affected)
  531. function MySQL.execute(path, args, cb)
  532. MySQL._query(path, args, 0, cb)
  533. end
  534.  
  535. -- return module
  536. return MySQL
  537. :45)
  538. > void vRP.MySQL.e_tick() (@vrp_mysql/mysql.net.dll:0)
  539. > fn (@vrp_mysql/init.lua:3)
  540. SCRIPT ERROR: @vrp/modules/item_transformer.lua:310: attempt to index a nil value (upvalue 'cfg')
  541. > finish (@vrp/lib/utils.lua:43).......
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement