Skip to content

Commit

Permalink
rewrite: overhaul backend (#2)
Browse files Browse the repository at this point in the history
Use code `griefa` for 10% off renewed.dev
  • Loading branch information
solareon authored Jun 26, 2024
2 parents e762f1b + c0b80d8 commit 62f6b43
Show file tree
Hide file tree
Showing 5 changed files with 639 additions and 326 deletions.
35 changes: 27 additions & 8 deletions client/main.lua
Original file line number Diff line number Diff line change
Expand Up @@ -183,7 +183,13 @@ RegisterNUICallback('onStartup', function(data, cb)
end)

RegisterNUICallback('jobcenter_JoinTheGroup', function(data, cb)
TriggerServerEvent('slrn_groups:server:jobcenter_JoinTheGroup', data)
local message = lib.callback.await('slrn_groups:server:jobcenter_JoinTheGroup')

exports['lb-phone']:SendNotification({
app = identifier,
content = message,
})

cb('ok')
end)

Expand All @@ -195,24 +201,37 @@ RegisterNetEvent('slrn_groups:client:CustomNotification', function(header, msg)
})
end)

RegisterNUICallback('jobcenter_leave_grouped', function(data, cb)
if not data then return end
RegisterNUICallback('jobcenter_leave_grouped', function(_, cb)

local success = PhoneNotification('Job Center', 'Are you sure you want to leave the group?', 'Accept', 'Deny')

if success then
TriggerServerEvent('slrn_groups:server:jobcenter_leave_grouped', data)
local message = lib.callback.await('slrn_groups:server:jobcenter_leave_grouped')

exports['lb-phone']:SendNotification({
app = identifier,
content = message,
})
end

cb('ok')
end)

RegisterNUICallback('jobcenter_DeleteGroup', function(data, cb)
TriggerServerEvent('slrn_groups:server:jobcenter_DeleteGroup', data)
local message = lib.callback.await('slrn_groups:server:jobcenter_DeleteGroup')

exports['lb-phone']:SendNotification({
app = identifier,
content = message,
})

cb('ok')
end)

RegisterNUICallback('jobcenter_CheckPlayerNames', function(data, cb)
lib.callback('slrn_groups:server:jobcenter_CheckPlayerNames', false, function(HasName)
cb(HasName)
end, data.id)
local groupNames = lib.callback.await('slrn_groups:server:jobcenter_CheckPlayerNames')

cb(groupNames)
end)

RegisterCommand('testpass', function()
Expand Down
Loading

0 comments on commit 62f6b43

Please sign in to comment.