- Katılım
- 3 yıl 4 ay 29 gün
- Mesajlar
- 2
Hello, I wanted to know if you know how to modify this so that it goes from taking data from the database to taking data from a config.
example:
now grab the data like this from the database.
And I want something like this to be taken from a config
RegisterServerEvent("mdt:getOffensesAndOfficer")
AddEventHandler("mdt:getOffensesAndOfficer", function()
src = source
local charges = {}
exports['ghmattimysql']:execute('SELECT * FROM fine_types', {
}, function(fines)
for j = 1, #fines do
table.insert(charges, fines[j])
end
local officer = GetCharacterName(src)
TriggerClientEvent("mdt:returnOffensesAndOfficer", src, charges, officer)
end)
end)
example:
now grab the data like this from the database.
INSERT INTO fine_types (id, label, amount, category, jailtime) VALUES
(1, 'Murder', 25000, 0, 0),
(2, 'Involuntary Manslaughter', 10000, 0, 120),
And I want something like this to be taken from a config
fine_types = {
[1] = {
label = "Murder",
amount = 25000,
category = 0,
jailtime = 0
},
[2] = {
label = "Involuntary Manslaughter",
amount = 10000,
category = 0,
jailtime = 120
},
}
}