-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcl_halatha_pausemenu.lua
More file actions
134 lines (123 loc) · 4.98 KB
/
cl_halatha_pausemenu.lua
File metadata and controls
134 lines (123 loc) · 4.98 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
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
--[[
Copyright (c) Ha'la'tha Discord Server / @josephleelandadama - All Rights Reserved
Unauthorized redistributing of this file, via any medium is strictly prohibited.
Please join our Discord to support us. We're french but accept english talking too https://discord.gg/upc6DnnmeR
]]--
-- Nécessaire
ESX = exports["es_extended"]:getSharedObject()
local halathaName = GetPlayerName(PlayerId())
local halathaId = GetPlayerServerId(PlayerId())
local halathaMoney = 0
-- Configuration de base
local halathaTitle = '~o~Votre titre'
local halathaSubtitle = "~o~Votre sous-titre"
-- Configuration/application des entrées de textes pour les boutons du menu pause
CreateThread(function()
Citizen.InvokeNative(GetHashKey("ADD_TEXT_ENTRY"),'PM_SCR_MAP', '~o~GPS')
Citizen.InvokeNative(GetHashKey("ADD_TEXT_ENTRY"),'PM_SCR_GAM', '~o~Partir')
Citizen.InvokeNative(GetHashKey("ADD_TEXT_ENTRY"),'PM_PANE_LEAVE', '~o~Déconnexion du serveur')
Citizen.InvokeNative(GetHashKey("ADD_TEXT_ENTRY"),'PM_PANE_QUIT', '~r~Quitter FiveM')
Citizen.InvokeNative(GetHashKey("ADD_TEXT_ENTRY"),'PM_SCR_INF', '~o~Informations')
Citizen.InvokeNative(GetHashKey("ADD_TEXT_ENTRY"),'PM_SCR_STA', '~o~Statistiques')
Citizen.InvokeNative(GetHashKey("ADD_TEXT_ENTRY"),'PM_SCR_SET', '~o~Paramètres')
Citizen.InvokeNative(GetHashKey("ADD_TEXT_ENTRY"),'PM_SCR_GAL', '~o~Galerie')
Citizen.InvokeNative(GetHashKey("ADD_TEXT_ENTRY"),'PM_SCR_RPL', '~o~Rockstar Editor')
while true do
BeginScaleformMovieMethodOnFrontendHeader('SET_HEADING_DETAILS')
ScaleformMovieMethodAddParamTextureNameString('~o~'..halathaName)
ScaleformMovieMethodAddParamTextureNameString('~t~ID '..halathaId)
ScaleformMovieMethodAddParamTextureNameString('~g~'..formatMoney(halathaMoney))
ScaleformMovieMethodAddParamBool(false)
EndScaleformMovieMethod()
Wait(6)
end
end)
-- Appliquer le titre et le sous-titre via Scaleforms
CreateThread(function()
while true do
Wait(6) -- Au delà de 6, risque de "blinking"
N_0xb9449845f73f5e9c("SHIFT_CORONA_DESC")
PushScaleformMovieFunctionParameterBool(true)
PopScaleformMovieFunction()
N_0xb9449845f73f5e9c("SET_HEADER_TITLE")
PushScaleformMovieFunctionParameterString(halathaTitle)
PushScaleformMovieFunctionParameterBool(true)
PushScaleformMovieFunctionParameterString(halathaSubtitle)
PushScaleformMovieFunctionParameterBool(true)
PopScaleformMovieFunctionVoid()
end
end)
-- Récupération des données ESX
CreateThread(function()
while not ESX.IsPlayerLoaded() do Wait(200) end
local function refreshData()
local halathaData = ESX.GetPlayerData()
local halathaCash = halathaData.money or 0
local halathaBank = 0
halathaName = (halathaData.name and halathaData.name ~= '' and halathaData.name) or halathaName
for _, acc in ipairs(halathaData.accounts or {}) do
if acc.name == 'bank' then
halathaBank = acc.money or 0
break
end
end
halathaMoney = halathaCash + halathaBank
end
RegisterNetEvent('esx:playerLoaded', refreshData)
RegisterNetEvent('esx:setAccountMoney', refreshData)
refreshData()
end)
-- Formatage du nombre total d'argent (cash + banque)
-- Exemple : 1074893$ = 1 074 893$
local function formatMoney(n)
n = tonumber(n) or 0
local s = tostring(math.floor(n))
local out, c = {}, 0
for i = #s, 1, -1 do
c = c + 1
out[#out+1] = s:sub(i,i)
if c % 3 == 0 and i > 1 then out[#out+1] = " " end
end
local r = table.concat(out):reverse()
return r .. "$"
end
-- Désarmer le joueur si le menu pause est ouvert
local halathaWasMenuOpen = false
local halathaStartedTabletEmote = false
local function halathaDisarmOx(noAnim)
TriggerEvent('ox_inventory:disarm', false)
end
-- Désarmer le joueur, prendre une tablette (ou un téléphone, modifiable)
local function halathaStartTablet()
if halathaStartedTabletEmote then return end
halathaDisarmOx(true)
-- Nécessité d'un script d'émotes
-- https://github.com/alberttheprince/rpemotes-reborn
ExecuteCommand('e tablet2')
-- Nécessité d'un script de /me
-- https://github.com/leelandjosephadama/halatha_me
ExecuteCommand('me consulte sa tablette')
halathaStartedTabletEmote = true
end
local function halathaStopTablet()
if not halathaStartedTabletEmote then return end
-- Nécessité d'un script d'émotes
-- https://github.com/alberttheprince/rpemotes-reborn
ExecuteCommand('e c')
halathaStartedTabletEmote = false
end
-- Détection du menu pause
CreateThread(function()
while true do
Wait(0)
if IsPauseMenuActive() and not halathaWasMenuOpen then
halathaStartTablet()
halathaWasMenuOpen = true
end
if not IsPauseMenuActive() and halathaWasMenuOpen then
Wait(2000)
halathaStopTablet()
halathaWasMenuOpen = false
end
end
end)