Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Revert "refactor: use lib.triggerClientEvent" #524

Merged
merged 1 commit into from
Jul 26, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions bridge/qb/server/functions.lua
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,7 @@ local function AddItem(itemName, item)

QBX.Shared.Items[itemName] = item

lib.triggerClientEvent('QBCore:Client:OnSharedUpdate', -1, 'Items', itemName, item)
TriggerClientEvent('QBCore:Client:OnSharedUpdate', -1, 'Items', itemName, item)
TriggerEvent('QBCore:Server:UpdateObject')
return true, 'success'
end
Expand All @@ -164,7 +164,7 @@ local function UpdateItem(itemName, item)
return false, 'item_not_exists'
end
QBX.Shared.Items[itemName] = item
lib.triggerClientEvent('QBCore:Client:OnSharedUpdate', -1, 'Items', itemName, item)
TriggerClientEvent('QBCore:Client:OnSharedUpdate', -1, 'Items', itemName, item)
TriggerEvent('QBCore:Server:UpdateObject')
return true, 'success'
end
Expand Down Expand Up @@ -199,7 +199,7 @@ local function AddItems(items)
end

if not shouldContinue then return false, message, errorItem end
lib.triggerClientEvent('QBCore:Client:OnSharedUpdateMultiple', -1, 'Items', items)
TriggerClientEvent('QBCore:Client:OnSharedUpdateMultiple', -1, 'Items', items)
TriggerEvent('QBCore:Server:UpdateObject')
return true, message, nil
end
Expand All @@ -221,7 +221,7 @@ local function RemoveItem(itemName)

QBX.Shared.Items[itemName] = nil

lib.triggerClientEvent('QBCore:Client:OnSharedUpdate', -1, 'Items', itemName, nil)
TriggerClientEvent('QBCore:Client:OnSharedUpdate', -1, 'Items', itemName, nil)
TriggerEvent('QBCore:Server:UpdateObject')
return true, 'success'
end
Expand Down
20 changes: 10 additions & 10 deletions server/groups.lua
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ function CreateJobs(newJobs)
for jobName, job in pairs(newJobs) do
jobs[jobName] = job
TriggerEvent('qbx_core:server:onJobUpdate', jobName, job)
lib.triggerClientEvent('qbx_core:client:onJobUpdate', -1, jobName, job)
TriggerClientEvent('qbx_core:client:onJobUpdate', -1, jobName, job)
end
end

Expand All @@ -63,7 +63,7 @@ function RemoveJob(jobName)

jobs[jobName] = nil
TriggerEvent('qbx_core:server:onJobUpdate', jobName, nil)
lib.triggerClientEvent('qbx_core:client:onJobUpdate', -1, jobName, nil)
TriggerClientEvent('qbx_core:client:onJobUpdate', -1, jobName, nil)
return true, 'success'
end

Expand All @@ -75,7 +75,7 @@ function CreateGangs(newGangs)
for gangName, gang in pairs(newGangs) do
gangs[gangName] = gang
TriggerEvent('qbx_core:server:onGangUpdate', gangName, gang)
lib.triggerClientEvent('qbx_core:client:onGangUpdate', -1, gangName, gang)
TriggerClientEvent('qbx_core:client:onGangUpdate', -1, gangName, gang)
end
end

Expand All @@ -97,7 +97,7 @@ function RemoveGang(gangName)
gangs[gangName] = nil

TriggerEvent('qbx_core:server:onGangUpdate', gangName, nil)
lib.triggerClientEvent('qbx_core:client:onGangUpdate', -1, gangName, nil)
TriggerClientEvent('qbx_core:client:onGangUpdate', -1, gangName, nil)
return true, 'success'
end

Expand Down Expand Up @@ -151,7 +151,7 @@ local function upsertJobData(name, data)
}
end
TriggerEvent('qbx_core:server:onJobUpdate', name, jobs[name])
lib.triggerClientEvent('qbx_core:client:onJobUpdate', -1, name, jobs[name])
TriggerClientEvent('qbx_core:client:onJobUpdate', -1, name, jobs[name])
end

exports('UpsertJobData', upsertJobData)
Expand All @@ -168,7 +168,7 @@ local function upsertGangData(name, data)
}
end
TriggerEvent('qbx_core:server:onGangUpdate', name, gangs[name])
lib.triggerClientEvent('qbx_core:client:onGangUpdate', -1, name, gangs[name])
TriggerClientEvent('qbx_core:client:onGangUpdate', -1, name, gangs[name])
end

exports('UpsertGangData', upsertGangData)
Expand All @@ -183,7 +183,7 @@ local function upsertJobGrade(name, grade, data)
end
jobs[name].grades[grade] = data
TriggerEvent('qbx_core:server:onJobUpdate', name, jobs[name])
lib.triggerClientEvent('qbx_core:client:onJobUpdate', -1, name, jobs[name])
TriggerClientEvent('qbx_core:client:onJobUpdate', -1, name, jobs[name])
end

exports('UpsertJobGrade', upsertJobGrade)
Expand All @@ -198,7 +198,7 @@ local function upsertGangGrade(name, grade, data)
end
gangs[name].grades[grade] = data
TriggerEvent('qbx_core:server:onGangUpdate', name, gangs[name])
lib.triggerClientEvent('qbx_core:client:onGangUpdate', -1, name, gangs[name])
TriggerClientEvent('qbx_core:client:onGangUpdate', -1, name, gangs[name])
end

exports('UpsertGangGrade', upsertGangGrade)
Expand All @@ -212,7 +212,7 @@ local function removeJobGrade(name, grade)
end
jobs[name].grades[grade] = nil
TriggerEvent('qbx_core:server:onJobUpdate', name, jobs[name])
lib.triggerClientEvent('qbx_core:client:onJobUpdate', -1, name, jobs[name])
TriggerClientEvent('qbx_core:client:onJobUpdate', -1, name, jobs[name])
end

exports('RemoveJobGrade', removeJobGrade)
Expand All @@ -226,7 +226,7 @@ local function removeGangGrade(name, grade)
end
gangs[name].grades[grade] = nil
TriggerEvent('qbx_core:server:onGangUpdate', name, gangs[name])
lib.triggerClientEvent('qbx_core:client:onGangUpdate', -1, name, gangs[name])
TriggerClientEvent('qbx_core:client:onGangUpdate', -1, name, gangs[name])
end

exports('RemoveGangGrade', removeGangGrade)