142 lines
5.1 KiB
Lua
142 lines
5.1 KiB
Lua
|
|
-- ─────────────────────────────────────────────────────────────────────────────
|
|||
|
|
-- Client Main – event listeners, glue
|
|||
|
|
-- ─────────────────────────────────────────────────────────────────────────────
|
|||
|
|
|
|||
|
|
Bridge = Bridge or {}
|
|||
|
|
|
|||
|
|
-- ── Server → Client events ───────────────────────────────────────────────────
|
|||
|
|
|
|||
|
|
-- Session granted by server
|
|||
|
|
RegisterNetEvent('pc-live:client:sessionStart', function(data)
|
|||
|
|
Interaction.OnSessionStart(data)
|
|||
|
|
-- Add accent color to data
|
|||
|
|
data.accentColor = Config.AccentColor
|
|||
|
|
NUIBridge.Boot(data)
|
|||
|
|
end)
|
|||
|
|
|
|||
|
|
-- Desktop app list update
|
|||
|
|
RegisterNetEvent('pc-live:client:installedApps', function(apps)
|
|||
|
|
NUIBridge.SetInstalledApps(apps)
|
|||
|
|
end)
|
|||
|
|
|
|||
|
|
-- Mail
|
|||
|
|
RegisterNetEvent('pc-live:client:inboxData', function(rows, folders)
|
|||
|
|
NUIBridge.SetInbox(rows, folders)
|
|||
|
|
end)
|
|||
|
|
|
|||
|
|
RegisterNetEvent('pc-live:client:mailContent', function(mail)
|
|||
|
|
NUIBridge.SetMailContent(mail)
|
|||
|
|
end)
|
|||
|
|
|
|||
|
|
RegisterNetEvent('pc-live:client:mailSent', function()
|
|||
|
|
NUIBridge.MailSent()
|
|||
|
|
end)
|
|||
|
|
|
|||
|
|
RegisterNetEvent('pc-live:client:mailDeleted', function(id)
|
|||
|
|
NUIBridge.MailDeleted(id)
|
|||
|
|
end)
|
|||
|
|
|
|||
|
|
RegisterNetEvent('pc-live:client:newMailNotify', function()
|
|||
|
|
NUIBridge.NewMailNotify()
|
|||
|
|
end)
|
|||
|
|
|
|||
|
|
RegisterNetEvent('pc-live:client:mailMoved', function(mailId, folderId)
|
|||
|
|
SendNUIMessage({ action = 'mailMoved', data = { id = mailId, folderId = folderId } })
|
|||
|
|
end)
|
|||
|
|
|
|||
|
|
RegisterNetEvent('pc-live:client:sentData', function(rows)
|
|||
|
|
SendNUIMessage({ action = 'setSent', data = rows })
|
|||
|
|
end)
|
|||
|
|
|
|||
|
|
RegisterNetEvent('pc-live:client:folderCreated', function(folder)
|
|||
|
|
SendNUIMessage({ action = 'folderCreated', data = folder })
|
|||
|
|
end)
|
|||
|
|
|
|||
|
|
RegisterNetEvent('pc-live:client:folderDeleted', function(folderId, address)
|
|||
|
|
SendNUIMessage({ action = 'folderDeleted', data = { id = folderId, address = address or '' } })
|
|||
|
|
end)
|
|||
|
|
|
|||
|
|
RegisterNetEvent('pc-live:client:folderMailsData', function(folderId, rows)
|
|||
|
|
SendNUIMessage({ action = 'folderMailsData', data = { folderId = folderId, rows = rows } })
|
|||
|
|
end)
|
|||
|
|
|
|||
|
|
-- Calendar
|
|||
|
|
RegisterNetEvent('pc-live:client:calendarData', function(rows)
|
|||
|
|
SendNUIMessage({ action = 'calendarData', data = rows })
|
|||
|
|
end)
|
|||
|
|
|
|||
|
|
RegisterNetEvent('pc-live:client:calendarEventAdded', function(ev)
|
|||
|
|
SendNUIMessage({ action = 'calendarEventAdded', data = ev })
|
|||
|
|
end)
|
|||
|
|
|
|||
|
|
RegisterNetEvent('pc-live:client:calendarEventUpdated', function(ev)
|
|||
|
|
SendNUIMessage({ action = 'calendarEventUpdated', data = ev })
|
|||
|
|
end)
|
|||
|
|
|
|||
|
|
RegisterNetEvent('pc-live:client:calendarEventDeleted', function(id)
|
|||
|
|
SendNUIMessage({ action = 'calendarEventDeleted', data = { id = id } })
|
|||
|
|
end)
|
|||
|
|
|
|||
|
|
-- Contacts
|
|||
|
|
RegisterNetEvent('pc-live:client:contactsData', function(rows)
|
|||
|
|
SendNUIMessage({ action = 'contactsData', data = rows })
|
|||
|
|
end)
|
|||
|
|
|
|||
|
|
RegisterNetEvent('pc-live:client:contactAdded', function(c)
|
|||
|
|
SendNUIMessage({ action = 'contactAdded', data = c })
|
|||
|
|
end)
|
|||
|
|
|
|||
|
|
RegisterNetEvent('pc-live:client:contactUpdated', function(c)
|
|||
|
|
SendNUIMessage({ action = 'contactUpdated', data = c })
|
|||
|
|
end)
|
|||
|
|
|
|||
|
|
RegisterNetEvent('pc-live:client:contactDeleted', function(id)
|
|||
|
|
SendNUIMessage({ action = 'contactDeleted', data = { id = id } })
|
|||
|
|
end)
|
|||
|
|
|
|||
|
|
-- Geteilte Postfächer
|
|||
|
|
RegisterNetEvent('pc-live:client:foldersData', function(address, folders)
|
|||
|
|
SendNUIMessage({ action = 'foldersData', data = { address = address, folders = folders } })
|
|||
|
|
end)
|
|||
|
|
|
|||
|
|
RegisterNetEvent('pc-live:client:signatureSaved', function(ok, err)
|
|||
|
|
SendNUIMessage({ action = 'signatureSaved', data = { ok = ok, error = err } })
|
|||
|
|
end)
|
|||
|
|
|
|||
|
|
RegisterNetEvent('pc-live:client:sharedMailboxes', function(mailboxes, personalAddr, personalSig)
|
|||
|
|
SendNUIMessage({ action = 'sharedMailboxes', data = {
|
|||
|
|
mailboxes = mailboxes, personalAddress = personalAddr,
|
|||
|
|
personalSignature = personalSig or '',
|
|||
|
|
} })
|
|||
|
|
end)
|
|||
|
|
|
|||
|
|
-- Store
|
|||
|
|
RegisterNetEvent('pc-live:client:storeData', function(apps)
|
|||
|
|
NUIBridge.SetStoreList(apps)
|
|||
|
|
end)
|
|||
|
|
|
|||
|
|
-- Disable attack controls while PC is open (prevents character punching on mouse click)
|
|||
|
|
CreateThread(function()
|
|||
|
|
while true do
|
|||
|
|
Wait(0)
|
|||
|
|
if IsNuiFocused() then
|
|||
|
|
DisableControlAction(0, 24, true) -- Attack (left click)
|
|||
|
|
DisableControlAction(0, 25, true) -- Aim (right click)
|
|||
|
|
DisableControlAction(0, 140, true) -- Melee Attack Light
|
|||
|
|
DisableControlAction(0, 141, true) -- Melee Attack Heavy
|
|||
|
|
DisableControlAction(0, 142, true) -- Melee Attack Alternate
|
|||
|
|
DisableControlAction(0, 143, true) -- Melee Attack 2
|
|||
|
|
end
|
|||
|
|
end
|
|||
|
|
end)
|
|||
|
|
|
|||
|
|
Utils.Log("Client main loaded.")
|
|||
|
|
|
|||
|
|
RegisterNetEvent('pc-live:client:mailAddressStatus', function(hasAddress, address, realms)
|
|||
|
|
NUIBridge.MailAddressStatus(hasAddress, address, realms)
|
|||
|
|
end)
|
|||
|
|
|
|||
|
|
RegisterNetEvent('pc-live:client:mailCreateResult', function(success, err, address)
|
|||
|
|
NUIBridge.MailCreateResult(success, err, address)
|
|||
|
|
end)
|