Mdt Menu not working

We are currently using the mdt menu for our Server. The problem is, that we cant save changes we made to players, like Warrants, select if they are on bail or not or just to add a Note, whenever we click on save, the console gives out this Error:
[ script:mdt] SCRIPT ERROR: @mdt/sv_mdt.lua:222: attempt to index a nil value (upvalue ‘changes’)
[ script:mdt] > ref (@mdt/sv_mdt.lua:222)
[ script:mdt] > (@mysql-async/mysql-async.js:15543)

this is line 222: [’@notes’] = changes.notes,

this is everything else, which is around it :
RegisterServerEvent(“mdt:saveOffenderChanges”)
AddEventHandler(“mdt:saveOffenderChanges”, function(id, changes, identifier)
local usource = source
MySQL.Async.fetchAll(‘SELECT * FROM user_mdt WHERE char_id = @id’, {
[’@id’] = id
}, function(result)
if result[1] then
MySQL.Async.execute(‘UPDATE user_mdt SET notes = @notes, mugshot_url = @mugshot_url, bail = @bail WHERE char_id = @id’, {
[’@id’] = id,
[’@notes’] = changes.notes,
[’@mugshot_url’] = changes.mugshot_url,
[’@bail’] = changes.bail
})
else
MySQL.Async.insert(‘INSERT INTO user_mdt (char_id, notes, mugshot_url, bail) VALUES (@id, @notes, @mugshot_url, @bail)’, {
[’@id’] = id,
[’@notes’] = changes.notes,
[’@mugshot_url’] = changes.mugshot_url,
[’@bail’] = changes.bail
})
end
for i = 1, #changes.licenses_removed do
local license = changes.licenses_removed[i]
MySQL.Async.execute(‘DELETE FROM user_licenses WHERE type = @type AND owner = @identifier’, {
[’@type’] = license.type,
[’@identifier’] = identifier
})
end

	if changes.convictions ~= nil then
		for conviction, amount in pairs(changes.convictions) do	
			MySQL.Async.execute('UPDATE `user_convictions` SET `count` = @count WHERE `char_id` = @id AND `offense` = @offense', {
				['@id'] = id,
				['@count'] = amount,
				['@offense'] = conviction
			})
		end
	end

	for i = 1, #changes.convictions_removed do
		MySQL.Async.execute('DELETE FROM `user_convictions` WHERE `char_id` = @id AND `offense` = @offense', {
			['@id'] = id,
			['offense'] = changes.convictions_removed[i]
		})
	end

	TriggerClientEvent("mdt:sendNotification", usource, "Offender changes have been saved.")
end)

end)

  • Everything else should be done right, correct me if something is missing and so on and so on

I hope someone of you can help us, after hours of searching we still cant find any answer to our problem :confused:
Thank you in advance

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.