diff --git a/wrapper.lua b/wrapper.lua index 14c1c72..a2c82d1 100644 --- a/wrapper.lua +++ b/wrapper.lua @@ -1242,6 +1242,60 @@ function getPlayer(source) local Player = {} return Player end +function sendPhoneMail(data) local phoneResource = "" + if GetResourceState("gksphone"):find("start") then phoneResource = "gksphone" + exports["gksphone"]:SendNewMail(data) + + elseif GetResourceState("yflip-phone"):find("start") then phoneResource = "yflip-phone" + TriggerServerEvent(GetCurrentResourceName()..":yflip:SendMail", data) + + elseif GetResourceState("qs-smartphone"):find("start") then phoneResource = "qs-smartphone" + TriggerServerEvent('qs-smartphone:server:sendNewMail', data) + + elseif GetResourceState("qs-smartphone-pro"):find("start") then phoneResource = "qs-smartphone-pro" + TriggerServerEvent('phone:sendNewMail', data) + + elseif GetResourceState("roadphone"):find("start") then phoneResource = "roadphone" + data.message = data.message:gsub("%
", "\n") + exports['roadphone']:sendMail(data) + + elseif GetResourceState("lb-phone"):find("start") then phoneResource = "lb-phone" + TriggerServerEvent(GetCurrentResourceName()..":lbphone:SendMail", data) + + elseif GetResourceState("qb-phone"):find("start") then phoneResource = "qb-phone" + TriggerServerEvent('qb-phone:server:sendNewMail', data) + end + + if phoneResource ~= "" then if Config.System.Debug then print("^6Bridge^7[^3"..phoneResource.."^7]: ^2Sending mail to player") end + else print("^6Bridge^7: ^1ERROR ^2Sending mail to player ^7 - ^2No supported phone found") end +end + +RegisterNetEvent(GetCurrentResourceName()..":lbphone:SendMail", function(data) + local src = source + local phoneNumber = exports["lb-phone"]:GetEquippedPhoneNumber(src) + local emailAddress = exports["lb-phone"]:GetEmailAddress(phoneNumber) + exports["lb-phone"]:SendMail({ + to = emailAddress, + subject = data.subject, + message = data.message, + --[[attachments = { + "https://cdn.discordapp.com/attachments/1035667053115363349/1042500877426110474/upload.png", + },]] + actions = data.buttons, + }) +end) + +RegisterNetEvent(GetCurrentResourceName()..":yflip:SendMail", function(data) + local src = source + exports["yflip-phone"]:SendMail({ + title = data.subject, + sender = data.sender, + senderDisplayName = data.sender, + content = data.message, + actions = data.buttons, + }, 'source', src) +end) + function registerCommand(command, options) if GetResourceState(OXLibExport):find("start") then if Config.System.Debug then print("^6Bridge^7: ^2Registering ^3Command^2 with ^7"..OXLibExport, command) end