-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathserver.lua
More file actions
37 lines (30 loc) · 1.11 KB
/
server.lua
File metadata and controls
37 lines (30 loc) · 1.11 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
local QBCore = exports['qb-core']:GetCoreObject()
RegisterNetEvent('qb-warnings:server:RequestWarnings', function()
local src = source
local license = nil
for _, id in ipairs(GetPlayerIdentifiers(src)) do
if id:find("license:") then
license = id
break
end
end
if not license then return end
exports.oxmysql:execute('SELECT reason, senderIdentifier, warnId FROM player_warns WHERE targetIdentifier = ?', {
license
}, function(results)
TriggerClientEvent('qb-warnings:client:ShowWarnings', src, results)
end)
end)
RegisterNetEvent('qb-warnings:server:DeleteWarning', function(warnId)
local src = source
-- ACE permission check
if not IsPlayerAceAllowed(src, "command") then
TriggerClientEvent('qb-warnings:client:NotifyDeleted', src, false)
return
end
exports.oxmysql:execute('DELETE FROM player_warns WHERE warnId = ?', {
warnId
}, function(rowsChanged)
TriggerClientEvent('qb-warnings:client:NotifyDeleted', src, rowsChanged > 0)
end)
end)