Error running call reference function for resource XNLRankBar: citizen:/scripting/lua/scheduler.lua:403: @XNLRankBar/server.lua:67: attempt to index a nil value (local 'result')
stack traceback:
@XNLRankBar/server.lua:67: in upvalue 'ref'
citizen:/scripting/lua/scheduler.lua:389: in function <citizen:/scripting/lua/scheduler.lua:388>
[C]: in function 'xpcall'
citizen:/scripting/lua/scheduler.lua:388: in function <citizen:/scripting/lua/scheduler.lua:387>
stack traceback:
[C]: in function 'error'
citizen:/scripting/lua/scheduler.lua:403: in function <citizen:/scripting/lua/scheduler.lua:372>
Error: Unhandled error in timer: Error: BUFFER_SHORTAGE
Error: BUFFER_SHORTAGE
at n.e [as reserve] (citizen:/scripting/v8/msgpack.js:29:12766)
at h (citizen:/scripting/v8/msgpack.js:29:15761)
at n.r [as decode] (citizen:/scripting/v8/msgpack.js:29:13908)
at n.fetch (citizen:/scripting/v8/msgpack.js:29:6972)
at n.u [as read] (citizen:/scripting/v8/msgpack.js:29:12076)
at Object.n [as decode] (citizen:/scripting/v8/msgpack.js:29:7097)
at unpack (citizen:/scripting/v8/main.js:20:33)
at citizen:/scripting/v8/main.js:51:20
at setImmediate (ghmattimysql.js:278:1292)
at Object.callback (citizen:/scripting/v8/timer.js:96:21)
That ones pretty clear, your connection is being refused to the server. Is the IP/Port correct, do you require the port as the one shown is the default and shouldn’t be in the IP parameter.
Scalar is used when you need to return only one value.
Exports["ghmattimysql"].scalar($"SELECT a FROM table1 WHERE condition = '{condition}';", new Action<dynamic>((result) =>
{
//Code inside here is executed after the query
if (result != null)
//Query returned a value
else
//Query did not return any value
}));
Execute is used when you need to return an array of values.
Exports["ghmattimysql"].execute($"SELECT a FROM table1;", new Action<dynamic>((result) =>
{
if (result != null)
//Result becomes an array and you use it like any other array
//Example: result[index].money
//Where index is the row of the result
//And money is the column’s name
//result.Count returns how many rows the query has returned
else
//Query did not return any value
}));
Can someone please explain me which is better? This or zr0iq’s other project “fivem-mysql-async”? Is this only sync? Or what are the main differences and when to use what?
@Super_TSGamer use the C# version, that is linked in the respository for vRP.
@ForFi It uses the js syntax. mysql-async is originally from brouznouf and only works with lua. They are almost identical given the code. I mean I do both.
Update to 1.2.0
Breaking: Added the standard typecast for Lua, so it can be used for Lua, this might break some Date / Time field queries in other languages, but who can easier cope with the changes.
Added a GUI available for admins with the mysql command.
local result = exports.ghmattimysql:execute('SELECT * FROM users')
if(result[1])then
for _, v in ipairs(result) do
if(v.jail and v.jail ~= 0)then
local data = json.decode(v.jail)
if(data and data ~= 0)then
local identifier = v.identifier
Jail[identifier] = JailPlayer(data.prison, data.time)
end
end
end
end
does this mean if i have mysql and i dont get the option to use ghmattimysql, this will add the databse for me under ghmatti? as i use zaphosting for my server and cant get ghmattimysql
Hello, great script, I followed the tutorial, I deleted json and configured ghmattimysql with the mysql_connection_string, in all files __resource.lua I replaced ‘@ mysql-async / lib / MySQL.lua’, with ‘GHMattiMySQL’, but even so I receive these errors, I would appreciate your help.
I have tried with the advice he has given me, but with the same result, a picture is worth a thousand words.
Thanks again for your time, I thank you very much for your help, I want to use GHMattiMySQL on my server and fly happily.