From 1b5284bbb78e6712f78a17ef9a00945dece7e9cd Mon Sep 17 00:00:00 2001 From: Kakarot <57848836+GhzGarage@users.noreply.github.com> Date: Thu, 23 Nov 2023 11:11:55 -0600 Subject: [PATCH] Update export --- config.lua | 200 ++++++++++++++-------------- server/main.lua | 340 ++++++++++++++++++++++++------------------------ 2 files changed, 270 insertions(+), 270 deletions(-) diff --git a/config.lua b/config.lua index 4ad55518..bfe8766b 100644 --- a/config.lua +++ b/config.lua @@ -2,167 +2,167 @@ Config = Config or {} Config.BillingCommissions = { -- This is a percentage (0.10) == 10% mechanic = 0.10 } -Config.Linux = false -- True if linux +Config.Linux = false -- True if linux Config.TweetDuration = 12 -- How many hours to load tweets (12 will load the past 12 hours of tweets) Config.RepeatTimeout = 2000 Config.CallRepeats = 10 Config.OpenPhone = 244 Config.PhoneApplications = { - ["phone"] = { - app = "phone", - color = "#04b543", - icon = "fa fa-phone-alt", - tooltipText = "Phone", - tooltipPos = "top", + ['phone'] = { + app = 'phone', + color = '#04b543', + icon = 'fa fa-phone-alt', + tooltipText = 'Phone', + tooltipPos = 'top', job = false, blockedjobs = {}, slot = 1, Alerts = 0, }, - ["whatsapp"] = { - app = "whatsapp", - color = "#25d366", - icon = "fas fa-comment", - tooltipText = "Whatsapp", - tooltipPos = "top", - style = "font-size: 2.8vh"; + ['whatsapp'] = { + app = 'whatsapp', + color = '#25d366', + icon = 'fas fa-comment', + tooltipText = 'Whatsapp', + tooltipPos = 'top', + style = 'font-size: 2.8vh', job = false, blockedjobs = {}, slot = 2, Alerts = 0, }, - ["settings"] = { - app = "settings", - color = "#636e72", - icon = "fa fa-cogs", - tooltipText = "Settings", - tooltipPos = "top", - style = "padding-right: .08vh; font-size: 2.3vh"; + ['settings'] = { + app = 'settings', + color = '#636e72', + icon = 'fa fa-cogs', + tooltipText = 'Settings', + tooltipPos = 'top', + style = 'padding-right: .08vh; font-size: 2.3vh', job = false, blockedjobs = {}, slot = 3, Alerts = 0, }, - ["twitter"] = { - app = "twitter", - color = "#1da1f2", - icon = "fab fa-twitter", - tooltipText = "Twitter", - tooltipPos = "top", + ['twitter'] = { + app = 'twitter', + color = '#1da1f2', + icon = 'fab fa-twitter', + tooltipText = 'Twitter', + tooltipPos = 'top', job = false, blockedjobs = {}, slot = 4, Alerts = 0, }, - ["garage"] = { - app = "garage", - color = "#575fcf", - icon = "fas fa-car", - tooltipText = "Vehicles", + ['garage'] = { + app = 'garage', + color = '#575fcf', + icon = 'fas fa-car', + tooltipText = 'Vehicles', job = false, blockedjobs = {}, slot = 5, Alerts = 0, }, - ["mail"] = { - app = "mail", - color = "#ff002f", - icon = "fas fa-envelope-open-text", - tooltipText = "Mail", + ['mail'] = { + app = 'mail', + color = '#ff002f', + icon = 'fas fa-envelope-open-text', + tooltipText = 'Mail', job = false, blockedjobs = {}, slot = 6, Alerts = 0, }, - ["advert"] = { - app = "advert", - color = "#ff8f1a", - icon = "fas fa-bullhorn", - tooltipText = "Advertisements", + ['advert'] = { + app = 'advert', + color = '#ff8f1a', + icon = 'fas fa-bullhorn', + tooltipText = 'Advertisements', job = false, blockedjobs = {}, slot = 7, Alerts = 0, }, - ["bank"] = { - app = "bank", - color = "#9c88ff", - icon = "fas fa-money-check-alt", - tooltipText = "Bank", + ['bank'] = { + app = 'bank', + color = '#9c88ff', + icon = 'fas fa-money-check-alt', + tooltipText = 'Bank', job = false, blockedjobs = {}, slot = 8, Alerts = 0, }, - ["crypto"] = { - app = "crypto", - color = "#004682", - icon = "fas fa-coins", - tooltipText = "Crypto", + ['crypto'] = { + app = 'crypto', + color = '#004682', + icon = 'fas fa-coins', + tooltipText = 'Crypto', job = false, blockedjobs = {}, slot = 9, Alerts = 0, }, - ["racing"] = { - app = "racing", - color = "#353b48", - icon = "fas fa-flag-checkered", - tooltipText = "Racing", + ['racing'] = { + app = 'racing', + color = '#353b48', + icon = 'fas fa-flag-checkered', + tooltipText = 'Racing', job = false, blockedjobs = {}, slot = 10, Alerts = 0, }, - ["houses"] = { - app = "houses", - color = "#27ae60", - icon = "fas fa-home", - tooltipText = "Houses", + ['houses'] = { + app = 'houses', + color = '#27ae60', + icon = 'fas fa-home', + tooltipText = 'Houses', job = false, blockedjobs = {}, slot = 11, Alerts = 0, }, - ["meos"] = { - app = "meos", - color = "#004682", - icon = "fas fa-ad", - tooltipText = "MDT", - job = "police", + ['lawyers'] = { + app = 'lawyers', + color = '#26d4ce', + icon = 'fas fa-briefcase', + tooltipText = 'Services', + tooltipPos = 'bottom', + job = false, blockedjobs = {}, - slot = 13, + slot = 12, Alerts = 0, }, - ["lawyers"] = { - app = "lawyers", - color = "#26d4ce", - icon = "fas fa-briefcase", - tooltipText = "Services", - tooltipPos = "bottom", + ['gallery'] = { + app = 'gallery', + color = '#AC1D2C', + icon = 'fas fa-images', + tooltipText = 'Gallery', + tooltipPos = 'bottom', job = false, blockedjobs = {}, - slot = 12, + slot = 13, Alerts = 0, }, - ["gallery"] = { - app = "gallery", - color = "#AC1D2C", - icon = "fas fa-images", - tooltipText = "Gallery", - tooltipPos = "bottom", + ['camera'] = { + app = 'camera', + color = '#AC1D2C', + icon = 'fas fa-camera', + tooltipText = 'Camera', + tooltipPos = 'bottom', job = false, blockedjobs = {}, - slot = 16, + slot = 14, Alerts = 0, }, - ["camera"] = { - app = "camera", - color = "#AC1D2C", - icon = "fas fa-camera", - tooltipText = "Camera", - tooltipPos = "bottom", - job = false, + ['meos'] = { + app = 'meos', + color = '#004682', + icon = 'fas fa-ad', + tooltipText = 'MDT', + job = 'police', blockedjobs = {}, slot = 15, Alerts = 0, @@ -171,19 +171,19 @@ Config.PhoneApplications = { Config.MaxSlots = 20 Config.StoreApps = { - ["territory"] = { - app = "territory", - color = "#353b48", - icon = "fas fa-globe-europe", - tooltipText = "Territorium", - tooltipPos = "right", - style = ""; + ['territory'] = { + app = 'territory', + color = '#353b48', + icon = 'fas fa-globe-europe', + tooltipText = 'Territorium', + tooltipPos = 'right', + style = '', job = false, blockedjobs = {}, - slot = 15, + slot = 16, Alerts = 0, password = true, - creator = "QBCore", - title = "Territory", + creator = 'QBCore', + title = 'Territory', }, } diff --git a/server/main.lua b/server/main.lua index 6b30ef81..0b69d6b1 100644 --- a/server/main.lua +++ b/server/main.lua @@ -6,8 +6,8 @@ local Hashtags = {} local Calls = {} local Adverts = {} local GeneratedPlates = {} -local WebHook = "" -local bannedCharacters = {'%','$',';'} +local WebHook = '' +local bannedCharacters = { '%', '$', ';' } local TWData = {} -- Functions @@ -45,7 +45,7 @@ function QBPhone.AddMentionedTweet(citizenid, TweetData) if MentionedTweets[citizenid] == nil then MentionedTweets[citizenid] = {} end - MentionedTweets[citizenid][#MentionedTweets[citizenid]+1] = TweetData + MentionedTweets[citizenid][#MentionedTweets[citizenid] + 1] = TweetData end function QBPhone.SetPhoneAlerts(citizenid, app, alerts) @@ -79,47 +79,47 @@ end local function SplitStringToArray(string) local retval = {} - for i in string.gmatch(string, "%S+") do - retval[#retval+1] = i + for i in string.gmatch(string, '%S+') do + retval[#retval + 1] = i end return retval end local function GenerateOwnerName() local names = { - [1] = { name = "Bailey Sykes", citizenid = "DSH091G93" }, - [2] = { name = "Aroush Goodwin", citizenid = "AVH09M193" }, - [3] = { name = "Tom Warren", citizenid = "DVH091T93" }, - [4] = { name = "Abdallah Friedman", citizenid = "GZP091G93" }, - [5] = { name = "Lavinia Powell", citizenid = "DRH09Z193" }, - [6] = { name = "Andrew Delarosa", citizenid = "KGV091J93" }, - [7] = { name = "Skye Cardenas", citizenid = "ODF09S193" }, - [8] = { name = "Amelia-Mae Walter", citizenid = "KSD0919H3" }, - [9] = { name = "Elisha Cote", citizenid = "NDX091D93" }, - [10] = { name = "Janice Rhodes", citizenid = "ZAL0919X3" }, - [11] = { name = "Justin Harris", citizenid = "ZAK09D193" }, - [12] = { name = "Montel Graves", citizenid = "POL09F193" }, - [13] = { name = "Benjamin Zavala", citizenid = "TEW0J9193" }, - [14] = { name = "Mia Willis", citizenid = "YOO09H193" }, - [15] = { name = "Jacques Schmitt", citizenid = "QBC091H93" }, - [16] = { name = "Mert Simmonds", citizenid = "YDN091H93" }, - [17] = { name = "Rickie Browne", citizenid = "PJD09D193" }, - [18] = { name = "Deacon Stanley", citizenid = "RND091D93" }, - [19] = { name = "Daisy Fraser", citizenid = "QWE091A93" }, - [20] = { name = "Kitty Walters", citizenid = "KJH0919M3" }, - [21] = { name = "Jareth Fernandez", citizenid = "ZXC09D193" }, - [22] = { name = "Meredith Calhoun", citizenid = "XYZ0919C3" }, - [23] = { name = "Teagan Mckay", citizenid = "ZYX0919F3" }, - [24] = { name = "Kurt Bain", citizenid = "IOP091O93" }, - [25] = { name = "Burt Kain", citizenid = "PIO091R93" }, - [26] = { name = "Joanna Huff", citizenid = "LEK091X93" }, - [27] = { name = "Carrie-Ann Pineda", citizenid = "ALG091Y93" }, - [28] = { name = "Gracie-Mai Mcghee", citizenid = "YUR09E193" }, - [29] = { name = "Robyn Boone", citizenid = "SOM091W93" }, - [30] = { name = "Aliya William", citizenid = "KAS009193" }, - [31] = { name = "Rohit West", citizenid = "SOK091093" }, - [32] = { name = "Skylar Archer", citizenid = "LOK091093" }, - [33] = { name = "Jake Kumar", citizenid = "AKA420609" }, + [1] = { name = 'Bailey Sykes', citizenid = 'DSH091G93' }, + [2] = { name = 'Aroush Goodwin', citizenid = 'AVH09M193' }, + [3] = { name = 'Tom Warren', citizenid = 'DVH091T93' }, + [4] = { name = 'Abdallah Friedman', citizenid = 'GZP091G93' }, + [5] = { name = 'Lavinia Powell', citizenid = 'DRH09Z193' }, + [6] = { name = 'Andrew Delarosa', citizenid = 'KGV091J93' }, + [7] = { name = 'Skye Cardenas', citizenid = 'ODF09S193' }, + [8] = { name = 'Amelia-Mae Walter', citizenid = 'KSD0919H3' }, + [9] = { name = 'Elisha Cote', citizenid = 'NDX091D93' }, + [10] = { name = 'Janice Rhodes', citizenid = 'ZAL0919X3' }, + [11] = { name = 'Justin Harris', citizenid = 'ZAK09D193' }, + [12] = { name = 'Montel Graves', citizenid = 'POL09F193' }, + [13] = { name = 'Benjamin Zavala', citizenid = 'TEW0J9193' }, + [14] = { name = 'Mia Willis', citizenid = 'YOO09H193' }, + [15] = { name = 'Jacques Schmitt', citizenid = 'QBC091H93' }, + [16] = { name = 'Mert Simmonds', citizenid = 'YDN091H93' }, + [17] = { name = 'Rickie Browne', citizenid = 'PJD09D193' }, + [18] = { name = 'Deacon Stanley', citizenid = 'RND091D93' }, + [19] = { name = 'Daisy Fraser', citizenid = 'QWE091A93' }, + [20] = { name = 'Kitty Walters', citizenid = 'KJH0919M3' }, + [21] = { name = 'Jareth Fernandez', citizenid = 'ZXC09D193' }, + [22] = { name = 'Meredith Calhoun', citizenid = 'XYZ0919C3' }, + [23] = { name = 'Teagan Mckay', citizenid = 'ZYX0919F3' }, + [24] = { name = 'Kurt Bain', citizenid = 'IOP091O93' }, + [25] = { name = 'Burt Kain', citizenid = 'PIO091R93' }, + [26] = { name = 'Joanna Huff', citizenid = 'LEK091X93' }, + [27] = { name = 'Carrie-Ann Pineda', citizenid = 'ALG091Y93' }, + [28] = { name = 'Gracie-Mai Mcghee', citizenid = 'YUR09E193' }, + [29] = { name = 'Robyn Boone', citizenid = 'SOM091W93' }, + [30] = { name = 'Aliya William', citizenid = 'KAS009193' }, + [31] = { name = 'Rohit West', citizenid = 'SOK091093' }, + [32] = { name = 'Skylar Archer', citizenid = 'LOK091093' }, + [33] = { name = 'Jake Kumar', citizenid = 'AKA420609' }, } return names[math.random(1, #names)] end @@ -130,15 +130,15 @@ local function sendNewMailToOffline(citizenid, mailData) if Player then local src = Player.PlayerData.source if mailData.button == nil then - MySQL.insert('INSERT INTO player_mails (`citizenid`, `sender`, `subject`, `message`, `mailid`, `read`) VALUES (?, ?, ?, ?, ?, ?)', {Player.PlayerData.citizenid, mailData.sender, mailData.subject, mailData.message, GenerateMailId(), 0}) + MySQL.insert('INSERT INTO player_mails (`citizenid`, `sender`, `subject`, `message`, `mailid`, `read`) VALUES (?, ?, ?, ?, ?, ?)', { Player.PlayerData.citizenid, mailData.sender, mailData.subject, mailData.message, GenerateMailId(), 0 }) TriggerClientEvent('qb-phone:client:NewMailNotify', src, mailData) else - MySQL.insert('INSERT INTO player_mails (`citizenid`, `sender`, `subject`, `message`, `mailid`, `read`, `button`) VALUES (?, ?, ?, ?, ?, ?, ?)', {Player.PlayerData.citizenid, mailData.sender, mailData.subject, mailData.message, GenerateMailId(), 0, json.encode(mailData.button)}) + MySQL.insert('INSERT INTO player_mails (`citizenid`, `sender`, `subject`, `message`, `mailid`, `read`, `button`) VALUES (?, ?, ?, ?, ?, ?, ?)', { Player.PlayerData.citizenid, mailData.sender, mailData.subject, mailData.message, GenerateMailId(), 0, json.encode(mailData.button) }) TriggerClientEvent('qb-phone:client:NewMailNotify', src, mailData) end SetTimeout(200, function() local mails = MySQL.query.await( - 'SELECT * FROM player_mails WHERE citizenid = ? ORDER BY `date` ASC', {Player.PlayerData.citizenid}) + 'SELECT * FROM player_mails WHERE citizenid = ? ORDER BY `date` ASC', { Player.PlayerData.citizenid }) if mails[1] ~= nil then for k, _ in pairs(mails) do if mails[k].button ~= nil then @@ -151,13 +151,13 @@ local function sendNewMailToOffline(citizenid, mailData) end) else if mailData.button == nil then - MySQL.insert('INSERT INTO player_mails (`citizenid`, `sender`, `subject`, `message`, `mailid`, `read`) VALUES (?, ?, ?, ?, ?, ?)', {citizenid, mailData.sender, mailData.subject, mailData.message, GenerateMailId(), 0}) + MySQL.insert('INSERT INTO player_mails (`citizenid`, `sender`, `subject`, `message`, `mailid`, `read`) VALUES (?, ?, ?, ?, ?, ?)', { citizenid, mailData.sender, mailData.subject, mailData.message, GenerateMailId(), 0 }) else - MySQL.insert('INSERT INTO player_mails (`citizenid`, `sender`, `subject`, `message`, `mailid`, `read`, `button`) VALUES (?, ?, ?, ?, ?, ?, ?)', {citizenid, mailData.sender, mailData.subject, mailData.message, GenerateMailId(), 0, json.encode(mailData.button)}) + MySQL.insert('INSERT INTO player_mails (`citizenid`, `sender`, `subject`, `message`, `mailid`, `read`, `button`) VALUES (?, ?, ?, ?, ?, ?, ?)', { citizenid, mailData.sender, mailData.subject, mailData.message, GenerateMailId(), 0, json.encode(mailData.button) }) end end end -exports("sendNewMailToOffline",sendNewMailToOffline) +exports('sendNewMailToOffline', sendNewMailToOffline) -- Callbacks QBCore.Functions.CreateCallback('qb-phone:server:GetCallState', function(_, cb, ContactData) @@ -194,11 +194,11 @@ QBCore.Functions.CreateCallback('qb-phone:server:GetPhoneData', function(source, CryptoTransactions = {}, Tweets = {}, Images = {}, - InstalledApps = Player.PlayerData.metadata["phonedata"].InstalledApps + InstalledApps = Player.PlayerData.metadata['phonedata'].InstalledApps } PhoneData.Adverts = Adverts - local result = MySQL.query.await('SELECT * FROM player_contacts WHERE citizenid = ? ORDER BY name ASC', {Player.PlayerData.citizenid}) + local result = MySQL.query.await('SELECT * FROM player_contacts WHERE citizenid = ? ORDER BY name ASC', { Player.PlayerData.citizenid }) if result[1] ~= nil then for _, v in pairs(result) do v.status = GetOnlineStatus(v.number) @@ -207,14 +207,14 @@ QBCore.Functions.CreateCallback('qb-phone:server:GetPhoneData', function(source, PhoneData.PlayerContacts = result end - local invoices = MySQL.query.await('SELECT * FROM phone_invoices WHERE citizenid = ?', {Player.PlayerData.citizenid}) + local invoices = MySQL.query.await('SELECT * FROM phone_invoices WHERE citizenid = ?', { Player.PlayerData.citizenid }) if invoices[1] ~= nil then for _, v in pairs(invoices) do local Ply = QBCore.Functions.GetPlayerByCitizenId(v.sender) if Ply ~= nil then v.number = Ply.PlayerData.charinfo.phone else - local res = MySQL.query.await('SELECT * FROM players WHERE citizenid = ?', {v.sender}) + local res = MySQL.query.await('SELECT * FROM players WHERE citizenid = ?', { v.sender }) if res[1] ~= nil then res[1].charinfo = json.decode(res[1].charinfo) v.number = res[1].charinfo.phone @@ -226,12 +226,12 @@ QBCore.Functions.CreateCallback('qb-phone:server:GetPhoneData', function(source, PhoneData.Invoices = invoices end - local garageresult = MySQL.query.await('SELECT * FROM player_vehicles WHERE citizenid = ?', {Player.PlayerData.citizenid}) + local garageresult = MySQL.query.await('SELECT * FROM player_vehicles WHERE citizenid = ?', { Player.PlayerData.citizenid }) if garageresult[1] ~= nil then PhoneData.Garage = garageresult end - local messages = MySQL.query.await('SELECT * FROM phone_messages WHERE citizenid = ?', {Player.PlayerData.citizenid}) + local messages = MySQL.query.await('SELECT * FROM phone_messages WHERE citizenid = ?', { Player.PlayerData.citizenid }) if messages ~= nil and next(messages) ~= nil then PhoneData.Chats = messages end @@ -248,14 +248,14 @@ QBCore.Functions.CreateCallback('qb-phone:server:GetPhoneData', function(source, PhoneData.Hashtags = Hashtags end - local Tweets = MySQL.query.await('SELECT * FROM phone_tweets WHERE `date` > NOW() - INTERVAL ? hour', {Config.TweetDuration}) + local Tweets = MySQL.query.await('SELECT * FROM phone_tweets WHERE `date` > NOW() - INTERVAL ? hour', { Config.TweetDuration }) if Tweets ~= nil and next(Tweets) ~= nil then PhoneData.Tweets = Tweets TWData = Tweets end - local mails = MySQL.query.await('SELECT * FROM player_mails WHERE citizenid = ? ORDER BY `date` ASC', {Player.PlayerData.citizenid}) + local mails = MySQL.query.await('SELECT * FROM player_mails WHERE citizenid = ? ORDER BY `date` ASC', { Player.PlayerData.citizenid }) if mails[1] ~= nil then for k, _ in pairs(mails) do if mails[k].button ~= nil then @@ -265,16 +265,16 @@ QBCore.Functions.CreateCallback('qb-phone:server:GetPhoneData', function(source, PhoneData.Mails = mails end - local transactions = MySQL.query.await('SELECT * FROM crypto_transactions WHERE citizenid = ? ORDER BY `date` ASC', {Player.PlayerData.citizenid}) + local transactions = MySQL.query.await('SELECT * FROM crypto_transactions WHERE citizenid = ? ORDER BY `date` ASC', { Player.PlayerData.citizenid }) if transactions[1] ~= nil then for _, v in pairs(transactions) do - PhoneData.CryptoTransactions[#PhoneData.CryptoTransactions+1] = { + PhoneData.CryptoTransactions[#PhoneData.CryptoTransactions + 1] = { TransactionTitle = v.title, TransactionMessage = v.message } end end - local images = MySQL.query.await('SELECT * FROM phone_gallery WHERE citizenid = ? ORDER BY `date` DESC',{Player.PlayerData.citizenid}) + local images = MySQL.query.await('SELECT * FROM phone_gallery WHERE citizenid = ? ORDER BY `date` DESC', { Player.PlayerData.citizenid }) if images ~= nil and next(images) ~= nil then PhoneData.Images = images end @@ -302,11 +302,11 @@ QBCore.Functions.CreateCallback('qb-phone:server:PayInvoice', function(source, c message = string.format('%s %s paid a bill of $%s', Ply.PlayerData.charinfo.firstname, Ply.PlayerData.charinfo.lastname, amount) } end - Ply.Functions.RemoveMoney('bank', amount, "paid-invoice") + Ply.Functions.RemoveMoney('bank', amount, 'paid-invoice') exports['qb-phone']:sendNewMailToOffline(sendercitizenid, invoiceMailData) - exports['qb-management']:AddMoney(society, amount) - MySQL.query('DELETE FROM phone_invoices WHERE id = ?', {invoiceId}) - local invoices = MySQL.query.await('SELECT * FROM phone_invoices WHERE citizenid = ?', {Ply.PlayerData.citizenid}) + exports['qb-banking']:AddMoney(society, amount, 'Phone invoice') + MySQL.query('DELETE FROM phone_invoices WHERE id = ?', { invoiceId }) + local invoices = MySQL.query.await('SELECT * FROM phone_invoices WHERE citizenid = ?', { Ply.PlayerData.citizenid }) if invoices[1] ~= nil then Invoices = invoices end @@ -316,8 +316,8 @@ end) QBCore.Functions.CreateCallback('qb-phone:server:DeclineInvoice', function(source, cb, _, _, invoiceId) local Invoices = {} local Ply = QBCore.Functions.GetPlayer(source) - MySQL.query('DELETE FROM phone_invoices WHERE id = ?', {invoiceId}) - local invoices = MySQL.query.await('SELECT * FROM phone_invoices WHERE citizenid = ?', {Ply.PlayerData.citizenid}) + MySQL.query('DELETE FROM phone_invoices WHERE id = ?', { invoiceId }) + local invoices = MySQL.query.await('SELECT * FROM phone_invoices WHERE citizenid = ?', { Ply.PlayerData.citizenid }) if invoices[1] ~= nil then Invoices = invoices end @@ -327,14 +327,14 @@ end) QBCore.Functions.CreateCallback('qb-phone:server:GetContactPictures', function(_, cb, Chats) for _, v in pairs(Chats) do local query = '%' .. v.number .. '%' - local result = MySQL.query.await('SELECT * FROM players WHERE charinfo LIKE ?', {query}) + local result = MySQL.query.await('SELECT * FROM players WHERE charinfo LIKE ?', { query }) if result[1] ~= nil then local MetaData = json.decode(result[1].metadata) if MetaData.phone.profilepicture ~= nil then v.picture = MetaData.phone.profilepicture else - v.picture = "default" + v.picture = 'default' end end end @@ -345,12 +345,12 @@ end) QBCore.Functions.CreateCallback('qb-phone:server:GetContactPicture', function(_, cb, Chat) local query = '%' .. Chat.number .. '%' - local result = MySQL.query.await('SELECT * FROM players WHERE charinfo LIKE ?', {query}) + local result = MySQL.query.await('SELECT * FROM players WHERE charinfo LIKE ?', { query }) local MetaData = json.decode(result[1].metadata) if MetaData.phone.profilepicture ~= nil then Chat.picture = MetaData.phone.profilepicture else - Chat.picture = "default" + Chat.picture = 'default' end SetTimeout(100, function() cb(Chat) @@ -359,9 +359,9 @@ end) QBCore.Functions.CreateCallback('qb-phone:server:GetPicture', function(_, cb, number) local query = '%' .. number .. '%' - local result = MySQL.query.await('SELECT * FROM players WHERE charinfo LIKE ?', {query}) + local result = MySQL.query.await('SELECT * FROM players WHERE charinfo LIKE ?', { query }) if result[1] ~= nil then - local Picture = "default" + local Picture = 'default' local MetaData = json.decode(result[1].metadata) if MetaData.phone.profilepicture ~= nil then Picture = MetaData.phone.profilepicture @@ -401,7 +401,7 @@ QBCore.Functions.CreateCallback('qb-phone:server:FetchResult', function(_, cb, s if ApaData[v.citizenid] ~= nil and next(ApaData[v.citizenid]) ~= nil then appiepappie = ApaData[v.citizenid] end - searchData[#searchData+1] = { + searchData[#searchData + 1] = { citizenid = v.citizenid, firstname = charinfo.firstname, lastname = charinfo.lastname, @@ -410,7 +410,7 @@ QBCore.Functions.CreateCallback('qb-phone:server:FetchResult', function(_, cb, s nationality = charinfo.nationality, gender = charinfo.gender, warrant = false, - driverlicense = metadata["licences"]["driver"], + driverlicense = metadata['licences']['driver'], appartmentdata = appiepappie } end @@ -425,40 +425,40 @@ QBCore.Functions.CreateCallback('qb-phone:server:GetVehicleSearchResults', funct local searchData = {} local query = '%' .. search .. '%' local result = MySQL.query.await('SELECT * FROM player_vehicles WHERE plate LIKE ? OR citizenid = ?', - {query, search}) + { query, search }) if result[1] ~= nil then for k, _ in pairs(result) do - local player = MySQL.query.await('SELECT * FROM players WHERE citizenid = ?', {result[k].citizenid}) + local player = MySQL.query.await('SELECT * FROM players WHERE citizenid = ?', { result[k].citizenid }) if player[1] ~= nil then local charinfo = json.decode(player[1].charinfo) local vehicleInfo = QBCore.Shared.Vehicles[result[k].vehicle] if vehicleInfo ~= nil then - searchData[#searchData+1] = { + searchData[#searchData + 1] = { plate = result[k].plate, status = true, - owner = charinfo.firstname .. " " .. charinfo.lastname, + owner = charinfo.firstname .. ' ' .. charinfo.lastname, citizenid = result[k].citizenid, - label = vehicleInfo["name"] + label = vehicleInfo['name'] } else - searchData[#searchData+1] = { + searchData[#searchData + 1] = { plate = result[k].plate, status = true, - owner = charinfo.firstname .. " " .. charinfo.lastname, + owner = charinfo.firstname .. ' ' .. charinfo.lastname, citizenid = result[k].citizenid, - label = "Name not found.." + label = 'Name not found..' } end end end else if GeneratedPlates[search] ~= nil then - searchData[#searchData+1] = { + searchData[#searchData + 1] = { plate = GeneratedPlates[search].plate, status = GeneratedPlates[search].status, owner = GeneratedPlates[search].owner, citizenid = GeneratedPlates[search].citizenid, - label = "Brand unknown.." + label = 'Brand unknown..' } else local ownerInfo = GenerateOwnerName() @@ -468,12 +468,12 @@ QBCore.Functions.CreateCallback('qb-phone:server:GetVehicleSearchResults', funct owner = ownerInfo.name, citizenid = ownerInfo.citizenid } - searchData[#searchData+1] = { + searchData[#searchData + 1] = { plate = search, status = true, owner = ownerInfo.name, citizenid = ownerInfo.citizenid, - label = "Brand unknown.." + label = 'Brand unknown..' } end end @@ -484,14 +484,14 @@ QBCore.Functions.CreateCallback('qb-phone:server:ScanPlate', function(source, cb local src = source local vehicleData if plate ~= nil then - local result = MySQL.query.await('SELECT * FROM player_vehicles WHERE plate = ?', {plate}) + local result = MySQL.query.await('SELECT * FROM player_vehicles WHERE plate = ?', { plate }) if result[1] ~= nil then - local player = MySQL.query.await('SELECT * FROM players WHERE citizenid = ?', {result[1].citizenid}) + local player = MySQL.query.await('SELECT * FROM players WHERE citizenid = ?', { result[1].citizenid }) local charinfo = json.decode(player[1].charinfo) vehicleData = { plate = plate, status = true, - owner = charinfo.firstname .. " " .. charinfo.lastname, + owner = charinfo.firstname .. ' ' .. charinfo.lastname, citizenid = result[1].citizenid } elseif GeneratedPlates ~= nil and GeneratedPlates[plate] ~= nil then @@ -521,7 +521,7 @@ end) QBCore.Functions.CreateCallback('qb-phone:server:HasPhone', function(source, cb) local Player = QBCore.Functions.GetPlayer(source) if Player ~= nil then - local HasPhone = Player.Functions.GetItemByName("phone") + local HasPhone = Player.Functions.GetItemByName('phone') if HasPhone ~= nil then cb(true) else @@ -544,7 +544,7 @@ QBCore.Functions.CreateCallback('qb-phone:server:CanTransferMoney', function(sou local Player = QBCore.Functions.GetPlayer(source) if (Player.PlayerData.money.bank - amount) >= 0 then local query = '%"account":"' .. iban .. '"%' - local result = MySQL.query.await('SELECT * FROM players WHERE charinfo LIKE ?', {query}) + local result = MySQL.query.await('SELECT * FROM players WHERE charinfo LIKE ?', { query }) if result[1] ~= nil then local Reciever = QBCore.Functions.GetPlayerByCitizenId(result[1].citizenid) Player.Functions.RemoveMoney('bank', amount) @@ -553,7 +553,7 @@ QBCore.Functions.CreateCallback('qb-phone:server:CanTransferMoney', function(sou else local RecieverMoney = json.decode(result[1].money) RecieverMoney.bank = (RecieverMoney.bank + amount) - MySQL.update('UPDATE players SET money = ? WHERE citizenid = ?', {json.encode(RecieverMoney), result[1].citizenid}) + MySQL.update('UPDATE players SET money = ? WHERE citizenid = ?', { json.encode(RecieverMoney), result[1].citizenid }) end cb(true) else @@ -567,12 +567,12 @@ QBCore.Functions.CreateCallback('qb-phone:server:GetCurrentLawyers', function(_, for _, v in pairs(QBCore.Functions.GetPlayers()) do local Player = QBCore.Functions.GetPlayer(v) if Player ~= nil then - if (Player.PlayerData.job.name == "lawyer" or Player.PlayerData.job.name == "realestate" or - Player.PlayerData.job.name == "mechanic" or Player.PlayerData.job.name == "taxi" or - Player.PlayerData.job.name == "police" or Player.PlayerData.job.name == "ambulance") and + if (Player.PlayerData.job.name == 'lawyer' or Player.PlayerData.job.name == 'realestate' or + Player.PlayerData.job.name == 'mechanic' or Player.PlayerData.job.name == 'taxi' or + Player.PlayerData.job.name == 'police' or Player.PlayerData.job.name == 'ambulance') and Player.PlayerData.job.onduty then - Lawyers[#Lawyers+1] = { - name = Player.PlayerData.charinfo.firstname .. " " .. Player.PlayerData.charinfo.lastname, + Lawyers[#Lawyers + 1] = { + name = Player.PlayerData.charinfo.firstname .. ' ' .. Player.PlayerData.charinfo.lastname, phone = Player.PlayerData.charinfo.phone, typejob = Player.PlayerData.job.name } @@ -582,13 +582,13 @@ QBCore.Functions.CreateCallback('qb-phone:server:GetCurrentLawyers', function(_, cb(Lawyers) end) -QBCore.Functions.CreateCallback("qb-phone:server:GetWebhook",function(_,cb) - if WebHook ~= "" then - cb(WebHook) - else - print('Set your webhook to ensure that your camera will work!!!!!! Set this on line 10 of the server sided script!!!!!') - cb(nil) - end +QBCore.Functions.CreateCallback('qb-phone:server:GetWebhook', function(_, cb) + if WebHook ~= '' then + cb(WebHook) + else + print('Set your webhook to ensure that your camera will work!!!!!! Set this on line 10 of the server sided script!!!!!') + cb(nil) + end end) -- Events @@ -599,18 +599,18 @@ RegisterNetEvent('qb-phone:server:AddAdvert', function(msg, url) local CitizenId = Player.PlayerData.citizenid if Adverts[CitizenId] ~= nil then Adverts[CitizenId].message = msg - Adverts[CitizenId].name = "@" .. Player.PlayerData.charinfo.firstname .. "" .. Player.PlayerData.charinfo.lastname + Adverts[CitizenId].name = '@' .. Player.PlayerData.charinfo.firstname .. '' .. Player.PlayerData.charinfo.lastname Adverts[CitizenId].number = Player.PlayerData.charinfo.phone Adverts[CitizenId].url = url else Adverts[CitizenId] = { message = msg, - name = "@" .. Player.PlayerData.charinfo.firstname .. "" .. Player.PlayerData.charinfo.lastname, + name = '@' .. Player.PlayerData.charinfo.firstname .. '' .. Player.PlayerData.charinfo.lastname, number = Player.PlayerData.charinfo.phone, url = url } end - TriggerClientEvent('qb-phone:client:UpdateAdverts', -1, Adverts, "@" .. Player.PlayerData.charinfo.firstname .. "" .. Player.PlayerData.charinfo.lastname) + TriggerClientEvent('qb-phone:client:UpdateAdverts', -1, Adverts, '@' .. Player.PlayerData.charinfo.firstname .. '' .. Player.PlayerData.charinfo.lastname) end) RegisterNetEvent('qb-phone:server:DeleteAdvert', function() @@ -634,9 +634,9 @@ end) RegisterNetEvent('qb-phone:server:RemoveMail', function(MailId) local src = source local Player = QBCore.Functions.GetPlayer(src) - MySQL.query('DELETE FROM player_mails WHERE mailid = ? AND citizenid = ?', {MailId, Player.PlayerData.citizenid}) + MySQL.query('DELETE FROM player_mails WHERE mailid = ? AND citizenid = ?', { MailId, Player.PlayerData.citizenid }) SetTimeout(100, function() - local mails = MySQL.query.await('SELECT * FROM player_mails WHERE citizenid = ? ORDER BY `date` ASC', {Player.PlayerData.citizenid}) + local mails = MySQL.query.await('SELECT * FROM player_mails WHERE citizenid = ? ORDER BY `date` ASC', { Player.PlayerData.citizenid }) if mails[1] ~= nil then for k, _ in pairs(mails) do if mails[k].button ~= nil then @@ -652,14 +652,14 @@ RegisterNetEvent('qb-phone:server:sendNewMail', function(mailData) local src = source local Player = QBCore.Functions.GetPlayer(src) if mailData.button == nil then - MySQL.insert('INSERT INTO player_mails (`citizenid`, `sender`, `subject`, `message`, `mailid`, `read`) VALUES (?, ?, ?, ?, ?, ?)', {Player.PlayerData.citizenid, mailData.sender, mailData.subject, mailData.message, GenerateMailId(), 0}) + MySQL.insert('INSERT INTO player_mails (`citizenid`, `sender`, `subject`, `message`, `mailid`, `read`) VALUES (?, ?, ?, ?, ?, ?)', { Player.PlayerData.citizenid, mailData.sender, mailData.subject, mailData.message, GenerateMailId(), 0 }) else - MySQL.insert('INSERT INTO player_mails (`citizenid`, `sender`, `subject`, `message`, `mailid`, `read`, `button`) VALUES (?, ?, ?, ?, ?, ?, ?)', {Player.PlayerData.citizenid, mailData.sender, mailData.subject, mailData.message, GenerateMailId(), 0, json.encode(mailData.button)}) + MySQL.insert('INSERT INTO player_mails (`citizenid`, `sender`, `subject`, `message`, `mailid`, `read`, `button`) VALUES (?, ?, ?, ?, ?, ?, ?)', { Player.PlayerData.citizenid, mailData.sender, mailData.subject, mailData.message, GenerateMailId(), 0, json.encode(mailData.button) }) end TriggerClientEvent('qb-phone:client:NewMailNotify', src, mailData) SetTimeout(200, function() local mails = MySQL.query.await('SELECT * FROM player_mails WHERE citizenid = ? ORDER BY `date` DESC', - {Player.PlayerData.citizenid}) + { Player.PlayerData.citizenid }) if mails[1] ~= nil then for k, _ in pairs(mails) do if mails[k].button ~= nil then @@ -675,12 +675,12 @@ end) RegisterNetEvent('qb-phone:server:sendNewEventMail', function(citizenid, mailData) local Player = QBCore.Functions.GetPlayerByCitizenId(citizenid) if mailData.button == nil then - MySQL.insert('INSERT INTO player_mails (`citizenid`, `sender`, `subject`, `message`, `mailid`, `read`) VALUES (?, ?, ?, ?, ?, ?)', {citizenid, mailData.sender, mailData.subject, mailData.message, GenerateMailId(), 0}) + MySQL.insert('INSERT INTO player_mails (`citizenid`, `sender`, `subject`, `message`, `mailid`, `read`) VALUES (?, ?, ?, ?, ?, ?)', { citizenid, mailData.sender, mailData.subject, mailData.message, GenerateMailId(), 0 }) else - MySQL.insert('INSERT INTO player_mails (`citizenid`, `sender`, `subject`, `message`, `mailid`, `read`, `button`) VALUES (?, ?, ?, ?, ?, ?, ?)', {citizenid, mailData.sender, mailData.subject, mailData.message, GenerateMailId(), 0, json.encode(mailData.button)}) + MySQL.insert('INSERT INTO player_mails (`citizenid`, `sender`, `subject`, `message`, `mailid`, `read`, `button`) VALUES (?, ?, ?, ?, ?, ?, ?)', { citizenid, mailData.sender, mailData.subject, mailData.message, GenerateMailId(), 0, json.encode(mailData.button) }) end SetTimeout(200, function() - local mails = MySQL.query.await('SELECT * FROM player_mails WHERE citizenid = ? ORDER BY `date` ASC', {citizenid}) + local mails = MySQL.query.await('SELECT * FROM player_mails WHERE citizenid = ? ORDER BY `date` ASC', { citizenid }) if mails[1] ~= nil then for k, _ in pairs(mails) do if mails[k].button ~= nil then @@ -695,9 +695,9 @@ end) RegisterNetEvent('qb-phone:server:ClearButtonData', function(mailId) local src = source local Player = QBCore.Functions.GetPlayer(src) - MySQL.update('UPDATE player_mails SET button = ? WHERE mailid = ? AND citizenid = ?', {'', mailId, Player.PlayerData.citizenid}) + MySQL.update('UPDATE player_mails SET button = ? WHERE mailid = ? AND citizenid = ?', { '', mailId, Player.PlayerData.citizenid }) SetTimeout(200, function() - local mails = MySQL.query.await('SELECT * FROM player_mails WHERE citizenid = ? ORDER BY `date` ASC', {Player.PlayerData.citizenid}) + local mails = MySQL.query.await('SELECT * FROM player_mails WHERE citizenid = ? ORDER BY `date` ASC', { Player.PlayerData.citizenid }) if mails[1] ~= nil then for k, _ in pairs(mails) do if mails[k].button ~= nil then @@ -714,16 +714,16 @@ RegisterNetEvent('qb-phone:server:MentionedPlayer', function(firstName, lastName local Player = QBCore.Functions.GetPlayer(v) if Player ~= nil then if (Player.PlayerData.charinfo.firstname == firstName and Player.PlayerData.charinfo.lastname == lastName) then - QBPhone.SetPhoneAlerts(Player.PlayerData.citizenid, "twitter") + QBPhone.SetPhoneAlerts(Player.PlayerData.citizenid, 'twitter') QBPhone.AddMentionedTweet(Player.PlayerData.citizenid, TweetMessage) - TriggerClientEvent('qb-phone:client:GetMentioned', Player.PlayerData.source, TweetMessage, AppAlerts[Player.PlayerData.citizenid]["twitter"]) + TriggerClientEvent('qb-phone:client:GetMentioned', Player.PlayerData.source, TweetMessage, AppAlerts[Player.PlayerData.citizenid]['twitter']) else local query1 = '%' .. firstName .. '%' local query2 = '%' .. lastName .. '%' - local result = MySQL.query.await('SELECT * FROM players WHERE charinfo LIKE ? AND charinfo LIKE ?', {query1, query2}) + local result = MySQL.query.await('SELECT * FROM players WHERE charinfo LIKE ? AND charinfo LIKE ?', { query1, query2 }) if result[1] ~= nil then local MentionedTarget = result[1].citizenid - QBPhone.SetPhoneAlerts(MentionedTarget, "twitter") + QBPhone.SetPhoneAlerts(MentionedTarget, 'twitter') QBPhone.AddMentionedTweet(MentionedTarget, TweetMessage) end end @@ -757,13 +757,13 @@ end) RegisterNetEvent('qb-phone:server:UpdateHashtags', function(Handle, messageData) if Hashtags[Handle] ~= nil and next(Hashtags[Handle]) ~= nil then - Hashtags[Handle].messages[#Hashtags[Handle].messages+1] = messageData + Hashtags[Handle].messages[#Hashtags[Handle].messages + 1] = messageData else Hashtags[Handle] = { hashtag = Handle, messages = {} } - Hashtags[Handle].messages[#Hashtags[Handle].messages+1] = messageData + Hashtags[Handle].messages[#Hashtags[Handle].messages + 1] = messageData end TriggerClientEvent('qb-phone:client:UpdateHashtags', -1, Handle, messageData) end) @@ -778,9 +778,9 @@ RegisterNetEvent('qb-phone:server:DeleteTweet', function(tweetId) local Player = QBCore.Functions.GetPlayer(source) local delete = false local TID = tweetId - local Data = MySQL.scalar.await('SELECT citizenid FROM phone_tweets WHERE tweetId = ?', {TID}) + local Data = MySQL.scalar.await('SELECT citizenid FROM phone_tweets WHERE tweetId = ?', { TID }) if Data == Player.PlayerData.citizenid then - MySQL.query.await('DELETE FROM phone_tweets WHERE tweetId = ?', {TID}) + MySQL.query.await('DELETE FROM phone_tweets WHERE tweetId = ?', { TID }) delete = true end @@ -803,8 +803,8 @@ RegisterNetEvent('qb-phone:server:UpdateTweets', function(NewTweets, TweetData) TweetData.lastName, TweetData.message, TweetData.date, - TweetData.url:gsub("[%<>\"()\' $]",""), - TweetData.picture:gsub("[%<>\"()\' $]",""), + TweetData.url:gsub('[%<>\"()\' $]', ''), + TweetData.picture:gsub('[%<>\"()\' $]', ''), TweetData.tweetId }) TriggerClientEvent('qb-phone:client:UpdateTweets', -1, src, NewTweets, TweetData, false) @@ -815,8 +815,8 @@ RegisterNetEvent('qb-phone:server:UpdateTweets', function(NewTweets, TweetData) TweetData.lastName, TweetData.message, TweetData.time, - TweetData.url:gsub("[%<>\"()\' $]",""), - TweetData.picture:gsub("[%<>\"()\' $]",""), + TweetData.url:gsub('[%<>\"()\' $]', ''), + TweetData.picture:gsub('[%<>\"()\' $]', ''), TweetData.tweetId }) TriggerClientEvent('qb-phone:client:UpdateTweets', -1, src, NewTweets, TweetData, false) @@ -828,14 +828,14 @@ RegisterNetEvent('qb-phone:server:TransferMoney', function(iban, amount) local sender = QBCore.Functions.GetPlayer(src) local query = '%' .. iban .. '%' - local result = MySQL.query.await('SELECT * FROM players WHERE charinfo LIKE ?', {query}) + local result = MySQL.query.await('SELECT * FROM players WHERE charinfo LIKE ?', { query }) if result[1] ~= nil then local reciever = QBCore.Functions.GetPlayerByCitizenId(result[1].citizenid) if reciever ~= nil then - local PhoneItem = reciever.Functions.GetItemByName("phone") - reciever.Functions.AddMoney('bank', amount, "phone-transfered-from-" .. sender.PlayerData.citizenid) - sender.Functions.RemoveMoney('bank', amount, "phone-transfered-to-" .. reciever.PlayerData.citizenid) + local PhoneItem = reciever.Functions.GetItemByName('phone') + reciever.Functions.AddMoney('bank', amount, 'phone-transfered-from-' .. sender.PlayerData.citizenid) + sender.Functions.RemoveMoney('bank', amount, 'phone-transfered-to-' .. reciever.PlayerData.citizenid) if PhoneItem ~= nil then TriggerClientEvent('qb-phone:client:TransferMoney', reciever.PlayerData.source, amount, @@ -845,11 +845,11 @@ RegisterNetEvent('qb-phone:server:TransferMoney', function(iban, amount) local moneyInfo = json.decode(result[1].money) moneyInfo.bank = round((moneyInfo.bank + amount)) MySQL.update('UPDATE players SET money = ? WHERE citizenid = ?', - {json.encode(moneyInfo), result[1].citizenid}) - sender.Functions.RemoveMoney('bank', amount, "phone-transfered") + { json.encode(moneyInfo), result[1].citizenid }) + sender.Functions.RemoveMoney('bank', amount, 'phone-transfered') end else - TriggerClientEvent('QBCore:Notify', src, "This account number doesn't exist!", "error") + TriggerClientEvent('QBCore:Notify', src, "This account number doesn't exist!", 'error') end end) @@ -858,60 +858,60 @@ RegisterNetEvent('qb-phone:server:EditContact', function(newName, newNumber, new local Player = QBCore.Functions.GetPlayer(src) MySQL.update( 'UPDATE player_contacts SET name = ?, number = ?, iban = ? WHERE citizenid = ? AND name = ? AND number = ?', - {newName, newNumber, newIban, Player.PlayerData.citizenid, oldName, oldNumber}) + { newName, newNumber, newIban, Player.PlayerData.citizenid, oldName, oldNumber }) end) RegisterNetEvent('qb-phone:server:RemoveContact', function(Name, Number) local src = source local Player = QBCore.Functions.GetPlayer(src) MySQL.query('DELETE FROM player_contacts WHERE name = ? AND number = ? AND citizenid = ?', - {Name, Number, Player.PlayerData.citizenid}) + { Name, Number, Player.PlayerData.citizenid }) end) RegisterNetEvent('qb-phone:server:AddNewContact', function(name, number, iban) local src = source local Player = QBCore.Functions.GetPlayer(src) - MySQL.insert('INSERT INTO player_contacts (citizenid, name, number, iban) VALUES (?, ?, ?, ?)', {Player.PlayerData.citizenid, tostring(name), tostring(number), tostring(iban)}) + MySQL.insert('INSERT INTO player_contacts (citizenid, name, number, iban) VALUES (?, ?, ?, ?)', { Player.PlayerData.citizenid, tostring(name), tostring(number), tostring(iban) }) end) RegisterNetEvent('qb-phone:server:UpdateMessages', function(ChatMessages, ChatNumber, _) local src = source local SenderData = QBCore.Functions.GetPlayer(src) local query = '%' .. ChatNumber .. '%' - local Player = MySQL.query.await('SELECT * FROM players WHERE charinfo LIKE ?', {query}) + local Player = MySQL.query.await('SELECT * FROM players WHERE charinfo LIKE ?', { query }) if Player[1] ~= nil then local TargetData = QBCore.Functions.GetPlayerByCitizenId(Player[1].citizenid) if TargetData ~= nil then - local Chat = MySQL.query.await('SELECT * FROM phone_messages WHERE citizenid = ? AND number = ?', {SenderData.PlayerData.citizenid, ChatNumber}) + local Chat = MySQL.query.await('SELECT * FROM phone_messages WHERE citizenid = ? AND number = ?', { SenderData.PlayerData.citizenid, ChatNumber }) if Chat[1] ~= nil then -- Update for target - MySQL.update('UPDATE phone_messages SET messages = ? WHERE citizenid = ? AND number = ?', {json.encode(ChatMessages), TargetData.PlayerData.citizenid, SenderData.PlayerData.charinfo.phone}) + MySQL.update('UPDATE phone_messages SET messages = ? WHERE citizenid = ? AND number = ?', { json.encode(ChatMessages), TargetData.PlayerData.citizenid, SenderData.PlayerData.charinfo.phone }) -- Update for sender - MySQL.update('UPDATE phone_messages SET messages = ? WHERE citizenid = ? AND number = ?', {json.encode(ChatMessages), SenderData.PlayerData.citizenid, TargetData.PlayerData.charinfo.phone}) + MySQL.update('UPDATE phone_messages SET messages = ? WHERE citizenid = ? AND number = ?', { json.encode(ChatMessages), SenderData.PlayerData.citizenid, TargetData.PlayerData.charinfo.phone }) -- Send notification & Update messages for target TriggerClientEvent('qb-phone:client:UpdateMessages', TargetData.PlayerData.source, ChatMessages, SenderData.PlayerData.charinfo.phone, false) else -- Insert for target - MySQL.insert('INSERT INTO phone_messages (citizenid, number, messages) VALUES (?, ?, ?)', {TargetData.PlayerData.citizenid, SenderData.PlayerData.charinfo.phone, json.encode(ChatMessages)}) + MySQL.insert('INSERT INTO phone_messages (citizenid, number, messages) VALUES (?, ?, ?)', { TargetData.PlayerData.citizenid, SenderData.PlayerData.charinfo.phone, json.encode(ChatMessages) }) -- Insert for sender - MySQL.insert('INSERT INTO phone_messages (citizenid, number, messages) VALUES (?, ?, ?)', {SenderData.PlayerData.citizenid, TargetData.PlayerData.charinfo.phone, json.encode(ChatMessages)}) + MySQL.insert('INSERT INTO phone_messages (citizenid, number, messages) VALUES (?, ?, ?)', { SenderData.PlayerData.citizenid, TargetData.PlayerData.charinfo.phone, json.encode(ChatMessages) }) -- Send notification & Update messages for target TriggerClientEvent('qb-phone:client:UpdateMessages', TargetData.PlayerData.source, ChatMessages, SenderData.PlayerData.charinfo.phone, true) end else - local Chat = MySQL.query.await('SELECT * FROM phone_messages WHERE citizenid = ? AND number = ?', {SenderData.PlayerData.citizenid, ChatNumber}) + local Chat = MySQL.query.await('SELECT * FROM phone_messages WHERE citizenid = ? AND number = ?', { SenderData.PlayerData.citizenid, ChatNumber }) if Chat[1] ~= nil then -- Update for target - MySQL.update('UPDATE phone_messages SET messages = ? WHERE citizenid = ? AND number = ?', {json.encode(ChatMessages), Player[1].citizenid, SenderData.PlayerData.charinfo.phone}) + MySQL.update('UPDATE phone_messages SET messages = ? WHERE citizenid = ? AND number = ?', { json.encode(ChatMessages), Player[1].citizenid, SenderData.PlayerData.charinfo.phone }) -- Update for sender Player[1].charinfo = json.decode(Player[1].charinfo) - MySQL.update('UPDATE phone_messages SET messages = ? WHERE citizenid = ? AND number = ?', {json.encode(ChatMessages), SenderData.PlayerData.citizenid, Player[1].charinfo.phone}) + MySQL.update('UPDATE phone_messages SET messages = ? WHERE citizenid = ? AND number = ?', { json.encode(ChatMessages), SenderData.PlayerData.citizenid, Player[1].charinfo.phone }) else -- Insert for target - MySQL.insert('INSERT INTO phone_messages (citizenid, number, messages) VALUES (?, ?, ?)', {Player[1].citizenid, SenderData.PlayerData.charinfo.phone, json.encode(ChatMessages)}) + MySQL.insert('INSERT INTO phone_messages (citizenid, number, messages) VALUES (?, ?, ?)', { Player[1].citizenid, SenderData.PlayerData.charinfo.phone, json.encode(ChatMessages) }) -- Insert for sender Player[1].charinfo = json.decode(Player[1].charinfo) - MySQL.insert('INSERT INTO phone_messages (citizenid, number, messages) VALUES (?, ?, ?)', {SenderData.PlayerData.citizenid, Player[1].charinfo.phone, json.encode(ChatMessages)}) + MySQL.insert('INSERT INTO phone_messages (citizenid, number, messages) VALUES (?, ?, ?)', { SenderData.PlayerData.citizenid, Player[1].charinfo.phone, json.encode(ChatMessages) }) end end end @@ -920,17 +920,17 @@ end) RegisterNetEvent('qb-phone:server:AddRecentCall', function(type, data) local src = source local Ply = QBCore.Functions.GetPlayer(src) - local Hour = os.date("%H") - local Minute = os.date("%M") - local label = Hour .. ":" .. Minute + local Hour = os.date('%H') + local Minute = os.date('%M') + local label = Hour .. ':' .. Minute TriggerClientEvent('qb-phone:client:AddRecentCall', src, data, label, type) local Trgt = QBCore.Functions.GetPlayerByPhone(data.number) if Trgt ~= nil then TriggerClientEvent('qb-phone:client:AddRecentCall', Trgt.PlayerData.source, { - name = Ply.PlayerData.charinfo.firstname .. " " .. Ply.PlayerData.charinfo.lastname, + name = Ply.PlayerData.charinfo.firstname .. ' ' .. Ply.PlayerData.charinfo.lastname, number = Ply.PlayerData.charinfo.phone, anonymous = data.anonymous - }, label, "outgoing") + }, label, 'outgoing') end end) @@ -951,12 +951,12 @@ end) RegisterNetEvent('qb-phone:server:SaveMetaData', function(MData) local src = source local Player = QBCore.Functions.GetPlayer(src) - local result = MySQL.query.await('SELECT * FROM players WHERE citizenid = ?', {Player.PlayerData.citizenid}) + local result = MySQL.query.await('SELECT * FROM players WHERE citizenid = ?', { Player.PlayerData.citizenid }) local MetaData = json.decode(result[1].metadata) MetaData.phone = MData MySQL.update('UPDATE players SET metadata = ? WHERE citizenid = ?', - {json.encode(MetaData), Player.PlayerData.citizenid}) - Player.Functions.SetMetaData("phone", MData) + { json.encode(MetaData), Player.PlayerData.citizenid }) + Player.Functions.SetMetaData('phone', MData) end) RegisterNetEvent('qb-phone:server:GiveContactDetails', function(PlayerId) @@ -987,8 +987,8 @@ end) RegisterNetEvent('qb-phone:server:InstallApplication', function(ApplicationData) local src = source local Player = QBCore.Functions.GetPlayer(src) - Player.PlayerData.metadata["phonedata"].InstalledApps[ApplicationData.app] = ApplicationData - Player.Functions.SetMetaData("phonedata", Player.PlayerData.metadata["phonedata"]) + Player.PlayerData.metadata['phonedata'].InstalledApps[ApplicationData.app] = ApplicationData + Player.Functions.SetMetaData('phonedata', Player.PlayerData.metadata['phonedata']) -- TriggerClientEvent('qb-phone:RefreshPhone', src) end) @@ -996,8 +996,8 @@ end) RegisterNetEvent('qb-phone:server:RemoveInstallation', function(App) local src = source local Player = QBCore.Functions.GetPlayer(src) - Player.PlayerData.metadata["phonedata"].InstalledApps[App] = nil - Player.Functions.SetMetaData("phonedata", Player.PlayerData.metadata["phonedata"]) + Player.PlayerData.metadata['phonedata'].InstalledApps[App] = nil + Player.Functions.SetMetaData('phonedata', Player.PlayerData.metadata['phonedata']) -- TriggerClientEvent('qb-phone:RefreshPhone', src) end) @@ -1005,13 +1005,13 @@ end) RegisterNetEvent('qb-phone:server:addImageToGallery', function(image) local src = source local Player = QBCore.Functions.GetPlayer(src) - MySQL.insert('INSERT INTO phone_gallery (`citizenid`, `image`) VALUES (?, ?)',{Player.PlayerData.citizenid,image}) + MySQL.insert('INSERT INTO phone_gallery (`citizenid`, `image`) VALUES (?, ?)', { Player.PlayerData.citizenid, image }) end) RegisterNetEvent('qb-phone:server:getImageFromGallery', function() local src = source local Player = QBCore.Functions.GetPlayer(src) - local images = MySQL.query.await('SELECT * FROM phone_gallery WHERE citizenid = ? ORDER BY `date` DESC',{Player.PlayerData.citizenid}) + local images = MySQL.query.await('SELECT * FROM phone_gallery WHERE citizenid = ? ORDER BY `date` DESC', { Player.PlayerData.citizenid }) TriggerClientEvent('qb-phone:refreshImages', src, images) end) @@ -1019,43 +1019,43 @@ RegisterNetEvent('qb-phone:server:RemoveImageFromGallery', function(data) local src = source local Player = QBCore.Functions.GetPlayer(src) local image = data.image - MySQL.query('DELETE FROM phone_gallery WHERE citizenid = ? AND image = ?',{Player.PlayerData.citizenid,image}) + MySQL.query('DELETE FROM phone_gallery WHERE citizenid = ? AND image = ?', { Player.PlayerData.citizenid, image }) end) RegisterNetEvent('qb-phone:server:sendPing', function(data) local src = source if src == data then - TriggerClientEvent("QBCore:Notify", src, "You cannot ping yourself", "error") + TriggerClientEvent('QBCore:Notify', src, 'You cannot ping yourself', 'error') end end) -- Command -QBCore.Commands.Add("setmetadata", "Set Player Metadata (God Only)", {}, false, function(source, args) +QBCore.Commands.Add('setmetadata', 'Set Player Metadata (God Only)', {}, false, function(source, args) local Player = QBCore.Functions.GetPlayer(source) if args[1] then - if args[1] == "trucker" then + if args[1] == 'trucker' then if args[2] then - local newrep = Player.PlayerData.metadata["jobrep"] + local newrep = Player.PlayerData.metadata['jobrep'] newrep.trucker = tonumber(args[2]) - Player.Functions.SetMetaData("jobrep", newrep) + Player.Functions.SetMetaData('jobrep', newrep) end end end -end, "god") +end, 'god') -QBCore.Commands.Add('bill', 'Bill A Player', {{name = 'id', help = 'Player ID'}, {name = 'amount', help = 'Fine Amount'}}, false, function(source, args) +QBCore.Commands.Add('bill', 'Bill A Player', { { name = 'id', help = 'Player ID' }, { name = 'amount', help = 'Fine Amount' } }, false, function(source, args) local biller = QBCore.Functions.GetPlayer(source) local billed = QBCore.Functions.GetPlayer(tonumber(args[1])) local amount = tonumber(args[2]) - if biller.PlayerData.job.name == "police" or biller.PlayerData.job.name == 'ambulance' or biller.PlayerData.job.name == 'mechanic' then + if biller.PlayerData.job.name == 'police' or biller.PlayerData.job.name == 'ambulance' or biller.PlayerData.job.name == 'mechanic' then if billed ~= nil then if biller.PlayerData.citizenid ~= billed.PlayerData.citizenid then if amount and amount > 0 then MySQL.insert( 'INSERT INTO phone_invoices (citizenid, amount, society, sender, sendercitizenid) VALUES (?, ?, ?, ?, ?)', - {billed.PlayerData.citizenid, amount, biller.PlayerData.job.name, - biller.PlayerData.charinfo.firstname, biller.PlayerData.citizenid}) + { billed.PlayerData.citizenid, amount, biller.PlayerData.job.name, + biller.PlayerData.charinfo.firstname, biller.PlayerData.citizenid }) TriggerClientEvent('qb-phone:RefreshPhone', billed.PlayerData.source) TriggerClientEvent('QBCore:Notify', source, 'Invoice Successfully Sent', 'success') TriggerClientEvent('QBCore:Notify', billed.PlayerData.source, 'New Invoice Received')