Skip to content

Commit

Permalink
tweak(server) add ban function to prevent exploiting events
Browse files Browse the repository at this point in the history
  • Loading branch information
Gravxd committed Mar 23, 2024
1 parent 0be63c4 commit a1a129c
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 2 deletions.
2 changes: 1 addition & 1 deletion chroma-enginesoundmenu/fxmanifest.lua
Original file line number Diff line number Diff line change
Expand Up @@ -17,5 +17,5 @@ server_scripts {
dependency 'ox_lib'

author 'Grav'
version '1.2'
version '1.3'
description 'Engine sound menu that syncs to other players'
6 changes: 6 additions & 0 deletions chroma-enginesoundmenu/server.lua
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,15 @@ RegisterCommand("enginesound", function(source, args, rawCommand)
end, false)

RegisterServerEvent("Chroma:EngineSounds:ChangeEngineSound", function(data)

if not Config.HasPermission(source) then
return Config.BanPlayer(source)
end

local entity = NetworkGetEntityFromNetworkId(data.net)
if not DoesEntityExist(entity) then return end
Entity(entity).state['vehdata:sound'] = data.sound

end)

CreateThread(function()
Expand Down
5 changes: 5 additions & 0 deletions chroma-enginesoundmenu/server_config.lua
Original file line number Diff line number Diff line change
Expand Up @@ -13,4 +13,9 @@ Config = {
position = 'center-right',
})
end,
BanPlayer = function(src)
-- your ban function here
print(string.format("%s [%s] has been banned for exploiting events!", GetPlayerName(src), src))
DropPlayer(src, 'Exploiting Events!')
end,
}
2 changes: 1 addition & 1 deletion chroma-enginesoundmenu/version.txt
Original file line number Diff line number Diff line change
@@ -1 +1 @@
1.2
1.3

0 comments on commit a1a129c

Please sign in to comment.