forked from At0mit0s/reportSystem
-
Notifications
You must be signed in to change notification settings - Fork 0
/
server.lua
70 lines (57 loc) · 2.47 KB
/
server.lua
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
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
ESX = exports["es_extended"]:getSharedObject()
ESX.RegisterServerCallback('adminCheck', function(source, cb)
local xPlayer = ESX.GetPlayerFromId(source)
cb(xPlayer.getGroup())
end)
ESX.RegisterServerCallback('sendDataToServer', function(source, cb, datas)
for _, playerId in ipairs(GetPlayers()) do
TriggerClientEvent('sendDataToClient', playerId, datas)
end
end)
ESX.RegisterServerCallback('getReportDatas', function(source, cb)
local xPlayer = ESX.GetPlayerFromId(source)
local Datas = {
name = xPlayer.getName(),
id = source,
date = os.date("%x")
}
cb(Datas)
end)
ESX.RegisterServerCallback('errorMessage', function(source, cb)
TriggerClientEvent('esx:showNotification', source, 'You don`t have permisson!', "error")
end)
ESX.RegisterServerCallback('report:Admin', function(source, cb, args)
for _, playerId in ipairs(GetPlayers()) do
local xTarget = ESX.GetPlayerFromId(playerId)
if xTarget.getGroup() == 'admin' then
TriggerClientEvent('reportAllAdmin', playerId, args)
end
end
end)
ESX.RegisterServerCallback('report:solvedReport', function(source, cb, playerId)
TriggerClientEvent('report:solvedMessage', playerId)
end)
ESX.RegisterServerCallback('report:removeCurrentReport', function(source, cb, currentReportIndex)
for _, playerId in ipairs(GetPlayers()) do
TriggerClientEvent('report:removedReport', playerId, currentReportIndex)
end
end)
ESX.RegisterServerCallback('report:deleteAllReports', function(source, cb, player)
for _, playerId in ipairs(GetPlayers()) do
TriggerClientEvent('report:deletedAllReports', playerId)
end
end)
ESX.RegisterServerCallback('report:gotoToPlayer', function(source, cb, playerId)
local xPlayer = ESX.GetPlayerFromId(source)
local xTarget = ESX.GetPlayerFromId(playerId)
xPlayer.setCoords(xTarget.getCoords())
TriggerClientEvent('report:gotoMessageToPlayer', playerId, {xPlayer.getName(), source})
TriggerClientEvent('report:gotoMessageToMe', source, {xTarget.getName(), playerId})
end)
ESX.RegisterServerCallback('report:bringPlayer', function(source, cb, playerId)
local xPlayer = ESX.GetPlayerFromId(source)
local xTarget = ESX.GetPlayerFromId(playerId)
xTarget.setCoords(xPlayer.getCoords())
TriggerClientEvent('report:bringMessageToPlayer', playerId, {xPlayer.getName(), source})
TriggerClientEvent('report:bringMessageToMe', source, {xTarget.getName(), playerId})
end)