forked from Gravxd/enginesound-menu
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathserver.lua
More file actions
47 lines (36 loc) · 1.63 KB
/
server.lua
File metadata and controls
47 lines (36 loc) · 1.63 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
local format = string.format
RegisterCommand("enginesound", function(source, args, rawCommand)
if not Config.HasPermission(source) then
Config.Notify(source, 'You do not have permission to use this command!', 'error')
return
end
TriggerClientEvent("GLabs:EngineSounds:OpenMenu", source)
end, false)
RegisterServerEvent("GLabs:EngineSounds:ChangeEngineSound", function(data)
local src = source
if not Config.HasPermission(src) then
-- this is to prevent again any potential exploiters triggering your events
return Config.BanPlayer(src)
end
if type(data) ~= "table" then
lib.print.error(format("[changeEngineSound] %s [%s] sent invalid data to the server.", GetPlayerName(src), src))
return
end
local entity = NetworkGetEntityFromNetworkId(data.net)
if not DoesEntityExist(entity) then return end
Entity(entity).state['vehdata:sound'] = data.sound
lib.print.debug(format("%s [%s] has changed their engine sound to %s", GetPlayerName(src), src, data.label))
end)
lib.callback.register("GLabs:EngineSounds:GetPerms", function(source)
return Config.HasPermission(source)
end)
-- Version Checking
CreateThread(function()
if not Config.CheckForUpdates then
print(
"\n^6GLabs_EngineSoundMenu ^2has been loaded - enjoy! ^1[VERSION CHECK DISABLED]\n^2For support or issues, please visit ^3https://discord.grav.wtf^7")
return
end
lib.versionCheck('Gravxd/enginesound-menu')
print(string.format("^6GLabs_EngineSoundMenu ^2has been loaded - enjoy!\n^2For support or issues, please visit ^3https://discord.grav.wtf^7"))
end)