-
Notifications
You must be signed in to change notification settings - Fork 37
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
36 changed files
with
1,603 additions
and
1,499 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,13 @@ | ||
const fs = require('fs'); | ||
const fs = require("fs"); | ||
|
||
const version = process.env.TGT_RELEASE_VERSION; | ||
const newVersion = version.replace('v', ''); | ||
const newVersion = version.replace("v", ""); | ||
|
||
const manifestFile = fs.readFileSync('fxmanifest.lua', { encoding: 'utf8' }); | ||
const manifestFile = fs.readFileSync("fxmanifest.lua", { encoding: "utf8" }); | ||
|
||
const newFileContent = manifestFile.replace(/\bversion\s+(.*)$/gm, `version '${newVersion}'`); | ||
const newFileContent = manifestFile.replace( | ||
/\bversion\s+(.*)$/gm, | ||
`version '${newVersion}'`, | ||
); | ||
|
||
fs.writeFileSync('fxmanifest.lua', newFileContent); | ||
fs.writeFileSync("fxmanifest.lua", newFileContent); |
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,40 +1,50 @@ | ||
HUD.Data.hudHidden = false | ||
RegisterCommand('hud', function() | ||
HUD:Toggle(HUD.Data.hudHidden) | ||
HUD.Data.hudHidden = not HUD.Data.hudHidden | ||
end, false) | ||
|
||
RegisterCommand('togglehud', function() | ||
HUD:Toggle(HUD.Data.hudHidden) | ||
HUD.Data.hudHidden = not HUD.Data.hudHidden | ||
end, false) | ||
|
||
RegisterCommand('hudsettings', function () | ||
SendNUIMessage({ type = 'OPEN_SETTINGS'}) | ||
SetNuiFocus(true, true) | ||
end, false) | ||
|
||
if not Config.Disable.VehicleHandlers and not Config.Disable.Vehicle then | ||
local leftSignal, rightSignal = false, false | ||
|
||
ESX.RegisterInput('esx_hud:indicator:left', Translate('indicatorLeft'), "keyboard", "NUMPAD4", function() | ||
if not HUD.Data.Vehicle then return end | ||
if HUD.Data.VehicleType == 'AIR' then return end | ||
leftSignal = not leftSignal | ||
SetVehicleIndicatorLights(HUD.Data.Vehicle, 1, leftSignal) | ||
end) | ||
|
||
ESX.RegisterInput('esx_hud:indicator:right', Translate('indicatorRight'), "keyboard", "NUMPAD6", function() | ||
if not HUD.Data.Vehicle then return end | ||
if HUD.Data.VehicleType == 'AIR' then return end | ||
rightSignal = not rightSignal | ||
SetVehicleIndicatorLights(HUD.Data.Vehicle, 0, rightSignal) | ||
end) | ||
|
||
ESX.RegisterInput('esx_hud:toggleEngine', Translate('toggleEngine'), "keyboard", "N", function() | ||
if not HUD.Data.Vehicle then return end | ||
local engineState = GetIsVehicleEngineRunning(HUD.Data.Vehicle) | ||
engineState = not engineState | ||
SetVehicleEngineOn(HUD.Data.Vehicle, engineState, true, true) | ||
end) | ||
end | ||
HUD.Data.hudHidden = false | ||
RegisterCommand("hud", function() | ||
HUD:Toggle(HUD.Data.hudHidden) | ||
HUD.Data.hudHidden = not HUD.Data.hudHidden | ||
end, false) | ||
|
||
RegisterCommand("togglehud", function() | ||
HUD:Toggle(HUD.Data.hudHidden) | ||
HUD.Data.hudHidden = not HUD.Data.hudHidden | ||
end, false) | ||
|
||
RegisterCommand("hudsettings", function() | ||
SendNUIMessage({ type = "OPEN_SETTINGS" }) | ||
SetNuiFocus(true, true) | ||
end, false) | ||
|
||
if not Config.Disable.VehicleHandlers and not Config.Disable.Vehicle then | ||
local leftSignal, rightSignal = false, false | ||
|
||
ESX.RegisterInput("esx_hud:indicator:left", Translate("indicatorLeft"), "keyboard", "NUMPAD4", function() | ||
if not HUD.Data.Vehicle then | ||
return | ||
end | ||
if HUD.Data.VehicleType == "AIR" then | ||
return | ||
end | ||
leftSignal = not leftSignal | ||
SetVehicleIndicatorLights(HUD.Data.Vehicle, 1, leftSignal) | ||
end) | ||
|
||
ESX.RegisterInput("esx_hud:indicator:right", Translate("indicatorRight"), "keyboard", "NUMPAD6", function() | ||
if not HUD.Data.Vehicle then | ||
return | ||
end | ||
if HUD.Data.VehicleType == "AIR" then | ||
return | ||
end | ||
rightSignal = not rightSignal | ||
SetVehicleIndicatorLights(HUD.Data.Vehicle, 0, rightSignal) | ||
end) | ||
|
||
ESX.RegisterInput("esx_hud:toggleEngine", Translate("toggleEngine"), "keyboard", "N", function() | ||
if not HUD.Data.Vehicle then | ||
return | ||
end | ||
local engineState = GetIsVehicleEngineRunning(HUD.Data.Vehicle) | ||
engineState = not engineState | ||
SetVehicleEngineOn(HUD.Data.Vehicle, engineState, true, true) | ||
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 |
---|---|---|
@@ -1,48 +1,52 @@ | ||
function HUD:Toggle(state) | ||
SendNUIMessage({ type = 'SHOW', value = state }) | ||
end | ||
|
||
function HUD:SetHudColor() | ||
SendNUIMessage({ type = 'SET_CONFIG_DATA', value = Config }) | ||
end | ||
|
||
function HUD:Start(xPlayer) | ||
if not xPlayer then xPlayer = ESX.GetPlayerData() end | ||
self:SetHudColor() | ||
self:SlowThick() | ||
self:FastThick() | ||
|
||
if not Config.Disable.Status then | ||
self:StatusThread() | ||
end | ||
|
||
if not Config.Disable.Info then | ||
self:UpdateAccounts(xPlayer.accounts) | ||
end | ||
|
||
if Config.Disable.MinimapOnFoot then | ||
DisplayRadar(false) | ||
end | ||
|
||
self:Toggle(true) | ||
end | ||
|
||
-- Handlers | ||
-- On script start | ||
AddEventHandler('onResourceStart', function(resource) | ||
if GetCurrentResourceName() ~= resource then return end | ||
Wait(1000) | ||
HUD:Start() | ||
end) | ||
|
||
-- On player loaded | ||
AddEventHandler('esx:playerLoaded', function(xPlayer) | ||
Wait(1000) | ||
HUD:Start(xPlayer) | ||
end) | ||
|
||
-- ForceLog or Logout | ||
AddEventHandler('esx:onPlayerLogout', function() | ||
Wait(1000) | ||
HUD:Toggle(false) | ||
end) | ||
function HUD:Toggle(state) | ||
SendNUIMessage({ type = "SHOW", value = state }) | ||
end | ||
|
||
function HUD:SetHudColor() | ||
SendNUIMessage({ type = "SET_CONFIG_DATA", value = Config }) | ||
end | ||
|
||
function HUD:Start(xPlayer) | ||
if not xPlayer then | ||
xPlayer = ESX.GetPlayerData() | ||
end | ||
self:SetHudColor() | ||
self:SlowThick() | ||
self:FastThick() | ||
|
||
if not Config.Disable.Status then | ||
self:StatusThread() | ||
end | ||
|
||
if not Config.Disable.Info then | ||
self:UpdateAccounts(xPlayer.accounts) | ||
end | ||
|
||
if Config.Disable.MinimapOnFoot then | ||
DisplayRadar(false) | ||
end | ||
|
||
self:Toggle(true) | ||
end | ||
|
||
-- Handlers | ||
-- On script start | ||
AddEventHandler("onResourceStart", function(resource) | ||
if GetCurrentResourceName() ~= resource then | ||
return | ||
end | ||
Wait(1000) | ||
HUD:Start() | ||
end) | ||
|
||
-- On player loaded | ||
AddEventHandler("esx:playerLoaded", function(xPlayer) | ||
Wait(1000) | ||
HUD:Start(xPlayer) | ||
end) | ||
|
||
-- ForceLog or Logout | ||
AddEventHandler("esx:onPlayerLogout", function() | ||
Wait(1000) | ||
HUD:Toggle(false) | ||
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,32 +1,34 @@ | ||
RegisterNUICallback('closePanel', function(data,cb) | ||
SetNuiFocus(false, false) | ||
cb('ok') | ||
end) | ||
|
||
RegisterNUICallback('unitChanged', function(state, cb) | ||
if HUD.Data.Driver then | ||
if Config.Default.Kmh ~= state.unit then | ||
TriggerEvent('esx_hud:UnitChanged', state.unit) | ||
end | ||
end | ||
Config.Default.Kmh = state.unit | ||
cb('ok') | ||
end) | ||
|
||
RegisterNUICallback('minimapSettingChanged', function (state,cb) | ||
Config.Disable.MinimapOnFoot = state.changed | ||
if IsPedOnFoot(PlayerPedId()) ~= 1 then return cb('ok') end | ||
DisplayRadar(not state.changed) | ||
cb('ok') | ||
end) | ||
|
||
RegisterNUICallback('notify', function (data,cb) | ||
local state = data.state | ||
if state.reset then | ||
ESX.ShowNotification(Translate('settingsResetSuccess', 5000, 'info')) | ||
cb('ok') | ||
return | ||
end | ||
ESX.ShowNotification(Translate('settingsSaveSuccess', 5000, 'info')) | ||
cb('ok') | ||
end) | ||
RegisterNUICallback("closePanel", function(data, cb) | ||
SetNuiFocus(false, false) | ||
cb("ok") | ||
end) | ||
|
||
RegisterNUICallback("unitChanged", function(state, cb) | ||
if HUD.Data.Driver then | ||
if Config.Default.Kmh ~= state.unit then | ||
TriggerEvent("esx_hud:UnitChanged", state.unit) | ||
end | ||
end | ||
Config.Default.Kmh = state.unit | ||
cb("ok") | ||
end) | ||
|
||
RegisterNUICallback("minimapSettingChanged", function(state, cb) | ||
Config.Disable.MinimapOnFoot = state.changed | ||
if IsPedOnFoot(PlayerPedId()) ~= 1 then | ||
return cb("ok") | ||
end | ||
DisplayRadar(not state.changed) | ||
cb("ok") | ||
end) | ||
|
||
RegisterNUICallback("notify", function(data, cb) | ||
local state = data.state | ||
if state.reset then | ||
ESX.ShowNotification(Translate("settingsResetSuccess", 5000, "info")) | ||
cb("ok") | ||
return | ||
end | ||
ESX.ShowNotification(Translate("settingsSaveSuccess", 5000, "info")) | ||
cb("ok") | ||
end) |
Oops, something went wrong.