forked from Sc0ttM/SEM_InteractionMenu
-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathserver.lua
More file actions
246 lines (201 loc) · 8.57 KB
/
server.lua
File metadata and controls
246 lines (201 loc) · 8.57 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
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
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
--[[
───────────────────────────────────────────────────────────────
SEM_InteractionMenu (server.lua) - Created by Scott M
Current Version: v1.7.1 (Sep 2021)
Support: https://semdevelopment.com/discord
!!! Change vaules in the 'config.lua' !!!
DO NOT EDIT THIS IF YOU DON'T KNOW WHAT YOU ARE DOING
───────────────────────────────────────────────────────────────
]]
RegisterServerEvent('SEM_InteractionMenu:GlobalChat')
AddEventHandler('SEM_InteractionMenu:GlobalChat', function(Color, Prefix, Message)
TriggerClientEvent('chatMessage', -1, Prefix, Color, Message)
end)
RegisterServerEvent('SEM_InteractionMenu:CuffNear')
AddEventHandler('SEM_InteractionMenu:CuffNear', function(ID)
if ID == -1 or ID == '-1' then
if source ~= '' then
print('^1[#' .. source .. '] ' .. GetPlayerName(source) .. ' - attempted to cuff all players^7')
DropPlayer(source, '\n[SEM_InteractionMenu] Attempting to cuff all players')
else
print('^1Someone attempted to cuff all players^7')
end
return
end
if ID ~= false then
TriggerClientEvent('SEM_InteractionMenu:Cuff', ID)
end
end)
RegisterServerEvent('SEM_InteractionMenu:DragNear')
AddEventHandler('SEM_InteractionMenu:DragNear', function(ID)
if ID == -1 or ID == '-1' then
if source ~= '' then
print('^1[#' .. source .. '] ' .. GetPlayerName(source) .. ' - attempted to drag all players^7')
DropPlayer(source, '\n[SEM_InteractionMenu] Attempting to drag all players')
else
print('^1Someone attempted to drag all players^7')
end
return
end
if ID ~= false and ID ~= source then
TriggerClientEvent('SEM_InteractionMenu:Drag', ID, source)
end
end)
RegisterServerEvent('SEM_InteractionMenu:SeatNear')
AddEventHandler('SEM_InteractionMenu:SeatNear', function(ID, Vehicle)
TriggerClientEvent('SEM_InteractionMenu:Seat', ID, Vehicle)
end)
RegisterServerEvent('SEM_InteractionMenu:UnseatNear')
AddEventHandler('SEM_InteractionMenu:UnseatNear', function(ID, Vehicle)
TriggerClientEvent('SEM_InteractionMenu:Unseat', ID, Vehicle)
end)
RegisterServerEvent('SEM_InteractionMenu:Jail')
AddEventHandler('SEM_InteractionMenu:Jail', function(ID, Time)
if ID == -1 or ID == '-1' then
if source ~= '' then
print('^1[#' .. source .. '] ' .. GetPlayerName(source) .. ' - attempted to jail all players^7')
DropPlayer(source, '\n[SEM_InteractionMenu] Attempting to jail all players')
else
print('^1Someone attempted to jail all players^7')
end
return
end
TriggerClientEvent('SEM_InteractionMenu:JailPlayer', ID, Time)
TriggerClientEvent('chatMessage', -1, 'Judge', {86, 96, 252}, GetPlayerName(ID) .. ' has been Jailed for ' .. Time .. ' months(s)')
end)
RegisterServerEvent('SEM_InteractionMenu:Unjail')
AddEventHandler('SEM_InteractionMenu:Unjail', function(ID)
TriggerClientEvent('SEM_InteractionMenu:UnjailPlayer', ID)
end)
RegisterServerEvent('SEM_InteractionMenu:Backup')
AddEventHandler('SEM_InteractionMenu:Backup', function(Code, StreetName, Coords)
TriggerClientEvent('SEM_InteractionMenu:CallBackup', -1, Code, StreetName, Coords)
end)
RegisterServerEvent('SEM_InteractionMenu:Ads')
AddEventHandler('SEM_InteractionMenu:Ads', function(Text, Name, Loc, File)
TriggerClientEvent('SEM_InteractionMenu:SyncAds', -1, Text, Name, Loc, File, source)
end)
BACList = {}
RegisterServerEvent('SEM_InteractionMenu:BACSet')
AddEventHandler('SEM_InteractionMenu:BACSet', function(BACLevel)
BACList[source] = BACLevel
end)
RegisterServerEvent('SEM_InteractionMenu:BACTest')
AddEventHandler('SEM_InteractionMenu:BACTest', function(ID)
local BACLevel = BACList[ID]
TriggerClientEvent('SEM_InteractionMenu:BACResult', source, BACLevel)
end)
Inventories = {}
RegisterServerEvent('SEM_InteractionMenu:InventorySet')
AddEventHandler('SEM_InteractionMenu:InventorySet', function(Items)
Inventories[source] = Items
end)
RegisterServerEvent('SEM_InteractionMenu:InventorySearch')
AddEventHandler('SEM_InteractionMenu:InventorySearch', function(ID)
local Inventory = Inventories[ID]
TriggerClientEvent('SEM_InteractionMenu:InventoryResult', source, Inventory)
end)
RegisterServerEvent('SEM_InteractionMenu:Hospitalize')
AddEventHandler('SEM_InteractionMenu:Hospitalize', function(ID, Time, Location)
if ID == -1 or ID == '-1' then
if source ~= '' then
print('^1[#' .. source .. '] ' .. GetPlayerName(source) .. ' - attempted to hospitalize all players^7')
DropPlayer(source, '\n[SEM_InteractionMenu] Attempting to hospitalize all players')
else
print('^1Someone attempted to hospitalize all players^7')
end
return
end
TriggerClientEvent('SEM_InteractionMenu:HospitalizePlayer', ID, Time, Location)
TriggerClientEvent('chatMessage', -1, 'Doctor', {86, 96, 252}, GetPlayerName(ID) .. ' has been Hospitalized for ' .. Time .. ' months(s)')
end)
RegisterServerEvent('SEM_InteractionMenu:Unhospitalize')
AddEventHandler('SEM_InteractionMenu:Unhospitalize', function(ID)
TriggerClientEvent('SEM_InteractionMenu:UnhospitalizePlayer', ID)
end)
RegisterServerEvent('SEM_InteractionMenu:LEOPerms')
AddEventHandler('SEM_InteractionMenu:LEOPerms', function()
if IsPlayerAceAllowed(source, 'sem_intmenu.leo') then
TriggerClientEvent('SEM_InteractionMenu:LEOPermsResult', source, true)
else
TriggerClientEvent('SEM_InteractionMenu:LEOPermsResult', source, false)
end
end)
RegisterServerEvent('SEM_InteractionMenu:FirePerms')
AddEventHandler('SEM_InteractionMenu:FirePerms', function()
if IsPlayerAceAllowed(source, 'sem_intmenu.fire') then
TriggerClientEvent('SEM_InteractionMenu:FirePermsResult', source, true)
else
TriggerClientEvent('SEM_InteractionMenu:FirePermsResult', source, false)
end
end)
RegisterServerEvent('SEM_InteractionMenu:UnjailPerms')
AddEventHandler('SEM_InteractionMenu:UnjailPerms', function()
if IsPlayerAceAllowed(source, 'sem_intmenu.unjail') then
TriggerClientEvent('SEM_InteractionMenu:UnjailPermsResult', source, true)
else
TriggerClientEvent('SEM_InteractionMenu:UnjailPermsResult', source, false)
end
end)
RegisterServerEvent('SEM_InteractionMenu:UnhospitalPerms')
AddEventHandler('SEM_InteractionMenu:UnhospitalPerms', function()
if IsPlayerAceAllowed(source, 'sem_intmenu.unhospital') then
TriggerClientEvent('SEM_InteractionMenu:UnhospitalPermsResult', source, true)
else
TriggerClientEvent('SEM_InteractionMenu:UnhospitalPermsResult', source, false)
end
end)
local resourceName =
[[^3
_____ ______ _____ _____
/ ____| | ___| | \ / |
| (___ | |___ | |\ \ / /| |
\___ \ | ___| | | \ \/ / | |
____) | | |___ | | \ / | |
\_____/ |______| |__| \__/ |__|^7
InteractionMenu
Created By Scott M
]]
Citizen.CreateThread(function()
local currentVersion = GetResourceMetadata(GetCurrentResourceName(), 'version', 0)
function VersionCheckHTTPRequest()
PerformHttpRequest('https://semdevelopment.com/releases/interactionmenu/info/version.json', VersionCheck, 'GET')
end
function VersionCheck(err, response, headers)
Citizen.Wait(3000)
if err == 200 then
local data = json.decode(response)
if Config.VersionChecker == 0 then
print(resourceName)
end
if currentVersion ~= data.NewestVersion then
if Config.VersionChecker == 0 then
print('\n ^1SEM_InteractionMenu is outdated!^7')
print(' Latest Version: ^2' .. data.NewestVersion .. '^7')
print(' Your Version: ^1' .. currentVersion .. '^7')
print(' Please download the leastest version from ^5' .. data.DownloadLocation .. '^7')
if data.Changes ~= '' then
print('\n ^5Changes: ^7' .. data.Changes)
end
elseif Config.VersionChecker == 1 then
print('\n^1SEM_InteractionMenu is outdated!^7')
print('Latest Version: ^2' .. data.NewestVersion .. '^7')
print('Please download the leastest version from ^5' .. data.DownloadLocation .. '^7\n')
end
else
print('\n ^2SEM_InteractionMenu is up to date!^7')
end
print('\n')
else
print('^1SEM_InteractionMenu Version Check Failed!^7')
end
SetTimeout(60000000, VersionCheckHTTPRequest)
end
if Config.VersionChecker ~= 2 then
if currentVersion then
VersionCheckHTTPRequest()
else
print('^1SEM_InteractionMenu Version Check Failed!^7')
end
end
end)