Skip to content

Commit

Permalink
Hot fix, idcard
Browse files Browse the repository at this point in the history
[+] jsfour-idcard
[/] Hotifx
  • Loading branch information
zRxnx committed Mar 18, 2023
1 parent 44ec66e commit 8a094da
Show file tree
Hide file tree
Showing 5 changed files with 186 additions and 29 deletions.
33 changes: 31 additions & 2 deletions client/client.lua
Original file line number Diff line number Diff line change
@@ -1,4 +1,32 @@
ESX, COOLDOWN = Config.esxImport(), nil
local GetEntityCoords = GetEntityCoords
local DisableOcclusionThisFrame = DisableOcclusionThisFrame
local SetDisableDecalRenderingThisFrame = SetDisableDecalRenderingThisFrame
local RemoveParticleFxInRange = RemoveParticleFxInRange
local OverrideLodscaleThisFrame = OverrideLodscaleThisFrame
local SetArtificialLightsState = SetArtificialLightsState
local ClearAllBrokenGlass = ClearAllBrokenGlass
local LeaderboardsReadClearAll = LeaderboardsReadClearAll
local ClearBrief = ClearBrief
local ClearGpsFlags = ClearGpsFlags
local ClearPrints = ClearPrints
local ClearSmallPrints = ClearSmallPrints
local ClearReplayStats = ClearReplayStats
local LeaderboardsClearCacheData = LeaderboardsClearCacheData
local ClearFocus = ClearFocus
local ClearHdArea = ClearHdArea
local ClearPedBloodDamage = ClearPedBloodDamage
local ClearPedWetness = ClearPedWetness
local ClearPedEnvDirt = ClearPedEnvDirt
local ResetPedVisibleDamage = ResetPedVisibleDamage
local ClearPedLastWeaponDamage = ClearPedLastWeaponDamage
local ClearExtraTimecycleModifier = ClearExtraTimecycleModifier
local ClearTimecycleModifier = ClearTimecycleModifier
local ClearOverrideWeather = ClearOverrideWeather
local DisableVehicleDistantlights = DisableVehicleDistantlights
local DisableScreenblurFade = DisableScreenblurFade
local SetRainLevel = SetRainLevel
local SetWindSpeed = SetWindSpeed

RegisterNetEvent('esx:playerLoaded',function(xPlayer)
ESX.PlayerData = xPlayer
Expand Down Expand Up @@ -48,9 +76,10 @@ CreateThread(function()
DisableScreenblurFade()
SetRainLevel(0.0)
SetWindSpeed(0.0)
Wait()
else
Wait(2000)
end

Wait(2000)
goto loop
end)

Expand Down
97 changes: 97 additions & 0 deletions client/functions.lua
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,17 @@ OpenMainMenu = function()
}
end

if Config.Menu.idcard then
MENU[#MENU + 1] = {
title = Strings.idcard_title,
description = Strings.idcard_desc,
arrow = true,
onSelect = function()
OpenIDcardMenu()
end
}
end

if Config.Menu.settings then
MENU[#MENU + 1] = {
title = Strings.setting_title,
Expand Down Expand Up @@ -213,6 +224,92 @@ OpenInfoLicenseMenu = function()
lib.showContext('zrx_personalmenu:personal_menu:info:licenses')
end

OpenIDcardMenu = function()
local MENU = {}
local playerClos, playerDis = ESX.Game.GetClosestPlayer()
local ME = GetPlayerServerId(PlayerId())
local NEARBY

if playerClos ~= -1 and playerDis <= 5 then
NEARBY = GetPlayerServerId(playerClos)
end

MENU[#MENU + 1] = {
title = Strings.back,
onSelect = function()
OpenMainMenu()
end
}

MENU[#MENU + 1] = {
title = Strings.idcard_view_title,
description = Strings.idcard_view_desc,
arrow = false,
onSelect = function()
TriggerServerEvent('jsfour-idcard:open', ME, ME)
end
}

if playerClos ~= -1 and playerDis <= 5 then
MENU[#MENU + 1] = {
title = Strings.idcard_show_title,
description = Strings.idcard_show_desc,
arrow = false,
onSelect = function()
TriggerServerEvent('jsfour-idcard:open', ME, NEARBY)
end
}
end

MENU[#MENU + 1] = {
title = Strings.driver_view_title,
description = Strings.driver_view_desc,
arrow = false,
onSelect = function()
TriggerServerEvent('jsfour-idcard:open', ME, ME, 'driver')
end
}

if playerClos ~= -1 and playerDis <= 5 then
MENU[#MENU + 1] = {
title = Strings.driver_show_title,
description = Strings.driver_show_desc,
arrow = false,
onSelect = function()
TriggerServerEvent('jsfour-idcard:open', ME, NEARBY, 'driver')
end
}
end

MENU[#MENU + 1] = {
title = Strings.weapon_view_title,
description = Strings.weapon_view_desc,
arrow = false,
onSelect = function()
TriggerServerEvent('jsfour-idcard:open', ME, ME, 'weapon')
end
}

if playerClos ~= -1 and playerDis <= 5 then
MENU[#MENU + 1] = {
title = Strings.weapon_show_title,
description = Strings.weapon_show_desc,
arrow = false,
onSelect = function()
TriggerServerEvent('jsfour-idcard:open', ME, NEARBY, 'weapon')
end
}
end

lib.registerContext({
id = 'zrx_personalmenu:personal_menu:idcard',
title = Strings.menu_idcard,
options = MENU,
})

lib.showContext('zrx_personalmenu:personal_menu:idcard')
end

DATA_ENGINE = true
OpenVehicleMenu = function()
if GetVehiclePedIsIn(cache.ped, false) == 0 then
Expand Down
1 change: 1 addition & 0 deletions configuration/config.lua
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ Config.Key = 'F5' --| Note: its a keyMapping
Config.Cooldown = 3 * seconds --| Note: Only for client > server or server > client | To disable set to 0
Config.Menu = {
informations = true,
idcard = true, --| Default: JSfour IDcard
settings = true,
vehicle = true,
bills = true,
Expand Down
22 changes: 22 additions & 0 deletions configuration/strings.lua
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ Strings = {
menu_main = 'Personal menu',
menu_info = 'Personal menu - Info',
menu_info_lice = 'Personal menu - Informations licenses',
menu_idcard = 'Personal menu - IDCard',
menu_veh = 'Personal menu - Vehicle',
menu_veh_extra = 'Personal menu - Vehicle extras',
menu_veh_livery = 'Personal menu - Vehicle liverys',
Expand All @@ -25,6 +26,9 @@ Strings = {
info_title = 'Informations',
info_desc = 'Show your character informations',

idcard_title = 'IDCard',
idcard_desc = 'View/Show your IDCards',

setting_title = 'Settings',
setting_desc = 'Edit some settings for you',

Expand Down Expand Up @@ -76,6 +80,24 @@ Strings = {
lice_title = 'Licenses',
lice_desc = 'See your licenses',

idcard_view_title = 'IDCARD',
idcard_view_desc = 'View your IDcard',

idcard_show_title = 'IDCARD',
idcard_show_desc = 'Show your IDcard',

driver_view_title = 'Driver',
driver_view_desc = 'View your driver license',

driver_show_title = 'DRIVER',
driver_show_desc = 'Show your driver license',

weapon_view_title = 'WEAPON',
weapon_view_desc = 'View your weapon license',

weapon_show_title = 'WEAPON',
weapon_show_desc = 'Show your weapon license',

eng_title = 'Toggle Engine',
eng_desc = 'Disable/Enable the engine',

Expand Down
62 changes: 35 additions & 27 deletions shared.lua/functions.lua → shared/functions.lua
Original file line number Diff line number Diff line change
@@ -1,28 +1,36 @@
Protect = function(tbl)
return setmetatable({}, {
__index = tbl,
__newindex = function(t, key, value)
error("attempting to change constant " ..
tostring(key) .. " to " .. tostring(value), 2)
end
})
end

StringSplit = function(str, sep)
if not sep then
sep = '%s'
end

local t, i = {}, 1

for str in string.gmatch(str, '([^'..sep..']+)') do
t[i] = str
i += 1
end

return t
end

StartsWith = function(str, find)
return str:sub(1, #find) == find
CreateThread(function()
if Config.Menu.idcard then
if GetResourceState('jsfour-idcard'):find('missing') then
print('^0[^1ERROR^0] You enabled "Config.Menu.idcard" but "jsfour-idcard" is not on the server!')
end
end
end)

Protect = function(tbl)
return setmetatable({}, {
__index = tbl,
__newindex = function(t, key, value)
error("attempting to change constant " ..
tostring(key) .. " to " .. tostring(value), 2)
end
})
end

StringSplit = function(str, sep)
if not sep then
sep = '%s'
end

local t, i = {}, 1

for str in string.gmatch(str, '([^'..sep..']+)') do
t[i] = str
i += 1
end

return t
end

StartsWith = function(str, find)
return str:sub(1, #find) == find
end

0 comments on commit 8a094da

Please sign in to comment.