From 4fde35eb325647b0a7e85bff363cf80332cc719c Mon Sep 17 00:00:00 2001 From: chip Date: Mon, 7 Sep 2020 18:40:13 +0200 Subject: [PATCH] Feat(Contact): SQL fetching/inserting --- resources/server/sv_contacts.lua | 12 +++--------- 1 file changed, 3 insertions(+), 9 deletions(-) diff --git a/resources/server/sv_contacts.lua b/resources/server/sv_contacts.lua index 440679b..be2d1f5 100644 --- a/resources/server/sv_contacts.lua +++ b/resources/server/sv_contacts.lua @@ -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) \ No newline at end of file +end)