Feat(Contact): SQL fetching/inserting

This commit is contained in:
chip committed 2020-09-07 18:40:13 +02:00
1 parent 2335d2e6df
commit 4fde35eb32
1 file changed
+3 -9
+3 -9
View File
@@ -20,18 +20,12 @@ ESX.RegisterServerCallback('phone:getContacts', function(source, cb)
end)
end)
RegisterCommand('add_contact', function(source, args, rawCommand)
local _source = source
local display = args[1]
local number = args[2]
TriggerEvent('phone:addContacts', source, display, number)
end)
RegisterServerEvent('phone:addContacts')
AddEventHandler('phone:addContacts', function(source, display, number)
AddEventHandler('phone:addContacts', function(display, number)
local _source = source
local xPlayer = ESX.GetPlayerFromId(_source)
local _identifier = xPlayer.getIdentifier()
print(display, number)
MySQL.Async.execute('INSERT INTO phone_contacts (`identifier`, `number`, `display`) VALUES (@identifier, @number, @display)',
{
identifier = _identifier,
@@ -39,4 +33,4 @@ AddEventHandler('phone:addContacts', function(source, display, number)
display = display
}, function()
end)
end)
end)