-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
V1.2 - separate config for server/client, more configurables
- Loading branch information
Showing
7 changed files
with
68 additions
and
45 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
Config = { | ||
Keybind = "", -- E.G F7 ---> https://docs.fivem.net/docs/game-references/controls/ | ||
MenuPosition = "bottom-right", -- bottom-right, bottom-left, top-right, top-left | ||
Notify = function(msg, type) | ||
-- customise this notification function to whatever you desire - by default it uses ox_lib but you can edit this | ||
lib.notify({ | ||
title = 'chroma-enginesoundmenu', | ||
description = msg, | ||
type = type, | ||
position = 'center-right', | ||
}) | ||
end, | ||
EngineSounds = { | ||
-- Engine Sound Name/Label --> Hash of engine audio (what you'd normally put in vehicles.meta) | ||
['BMW S63 4.4L V8'] = 's63b44', | ||
}, | ||
} |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,31 +1,38 @@ | ||
local function HasPermission(src) | ||
-- your permission function here - you can integrate your framework for jobs/perms etc | ||
return IsPlayerAceAllowed(src, 'enginesoundmenu') | ||
end | ||
|
||
local function Notify(src, msg, type) | ||
-- you can edit this to whatever you want, by default it uses ox_lib notifications | ||
TriggerClientEvent("ox_lib:notify", src, { | ||
description = msg, | ||
title = 'chroma-enginesoundmenu', | ||
type = type, | ||
position = 'center-right', | ||
}) | ||
end | ||
|
||
RegisterCommand("enginesound", function(source, args, rawCommand) | ||
if HasPermission(source) then | ||
if Config.HasPermission(source) then | ||
TriggerClientEvent("Chroma:EngineSounds:OpenMenu", source) | ||
else | ||
Notify(source, 'You do not have permission to use this command!', 'error') | ||
Config.Notify(source, 'You do not have permission to use this command!', 'error') | ||
end | ||
end, false) | ||
|
||
RegisterServerEvent("Chroma:EngineSounds:ChangeEngineSound", function(data) | ||
|
||
local entity = NetworkGetEntityFromNetworkId(data.net) | ||
if not DoesEntityExist(entity) then return end | ||
|
||
Entity(entity).state['vehdata:sound'] = data.sound | ||
|
||
end) | ||
|
||
CreateThread(function() | ||
|
||
if Config.CheckForUpdates then | ||
|
||
-- https://github.com/Blumlaut/FiveM-Resource-Version-Check-Thing/ | ||
updatePath = "/Gravxd/fivem-enginesound-menu" -- your git user/repo path | ||
resourceName = "^6chroma-enginesoundmenu" -- the resource name | ||
|
||
local function checkVersion(err,responseText, headers) | ||
curVersion = LoadResourceFile(GetCurrentResourceName(), "version.txt") -- make sure the "version" file actually exists in your resource root! | ||
if curVersion ~= responseText and tonumber(curVersion) < tonumber(responseText) then | ||
print("\n"..resourceName.." ^1is outdated, please update it from:\n^3https://github.com/Gravxd/fivem-enginesound-menu/releases/latest\n^1For support or issues, please visit ^3https://discord.gg/chromalabs^7") | ||
else | ||
print("\n"..resourceName.." ^2is up to date, and has been loaded - enjoy!\nFor support or issues, please visit ^3https://discord.gg/chromalabs^7") | ||
end | ||
end | ||
|
||
PerformHttpRequest("https://raw.githubusercontent.com"..updatePath.."/main/chroma-enginesoundmenu/version.txt", checkVersion, "GET") | ||
|
||
else | ||
print("\n^6chroma-enginesoundmenu ^2has been loaded - enjoy! ^1[VERSION CHECK DISABLED]\n^2For support or issues, please visit ^3https://discord.gg/chromalabs^7") | ||
end | ||
|
||
end) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
Config = { | ||
CheckForUpdates = true, -- will check github for updates (recommended) | ||
HasPermission = function(src) | ||
-- your permission function here - you can integrate your framework for jobs/perms etc | ||
return IsPlayerAceAllowed(src, 'enginesoundmenu') | ||
end, | ||
Notify = function(src, msg, type) | ||
-- you can edit this to whatever you want, by default it uses ox_lib notifications | ||
TriggerClientEvent("ox_lib:notify", src, { | ||
description = msg, | ||
title = 'chroma-enginesoundmenu', | ||
type = type, | ||
position = 'center-right', | ||
}) | ||
end, | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
1.1 | ||
1.2 |