forked from SadraKhorami/esx_identity
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathidentity.lua
136 lines (124 loc) · 3.46 KB
/
identity.lua
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
135
136
local guiEnabled = false
local myIdentity = {}
local needRegister = false
ESX = nil
Citizen.CreateThread(function ()
EnableGui(false)
while ESX == nil do
TriggerEvent('esx:getSharedObject', function(obj) ESX = obj end)
Citizen.Wait(0)
end
end)
function EnableGui(enable)
SetNuiFocus(enable, enable)
guiEnabled = enable
SendNUIMessage({
type = "enableui",
enable = enable
})
end
function ToggleSound(state)
if state then
StartAudioScene("MP_LEADERBOARD_SCENE");
else
StopAudioScene("MP_LEADERBOARD_SCENE");
end
end
function showLoadingPromt(label, time)
Citizen.CreateThread(function()
BeginTextCommandBusyString(tostring(label))
EndTextCommandBusyString(3)
Citizen.Wait(time)
RemoveLoadingPrompt()
end)
end
function loadToGround()
-- TriggerServerEvent('spawn:playerLoaded')
-- TriggerEvent('spawn:playerLoaded')
TriggerServerEvent('getSkin')
SwitchInPlayer(PlayerPedId())
SetEntityVisible(PlayerPedId(), true, 0)
local timer = GetGameTimer()
while not HasCollisionLoadedAroundEntity(PlayerPedId()) do
Wait(1000)
end
TriggerEvent('es_admin:freezePlayer', false)
TriggerEvent('esx:restoreLoadout')
TriggerEvent('streetlabel:changeLoadStatus', true)
TriggerEvent('esx_voice:changeLoadStatus', true)
TriggerEvent('esx_status:setLastStats')
TriggerServerEvent('esx_rack:loaded')
ESX.TriggerServerCallback('HR_Comserv:IsInComServ', function(IsJailed)
if IsJailed == false then
Wait(100)
else
TriggerEvent('HR_Comserv:TimeToFingerYourSelf', tonumber(IsJailed))
ESX.ShowNotification("~y~~h~Hengami Ke Dar Server Naboodid Jail Shodid Ya Dar Zendan DC Dadid")
ESX.ShowNotification("~y~~h~BenaBarin Be Zendan Barmigardid!")
end
end)
end
RegisterNetEvent('registerForm')
AddEventHandler('registerForm', function(bool)
needRegister = bool
end)
RegisterNetEvent("showRegisterForm")
AddEventHandler("showRegisterForm", function()
EnableGui(true)
end)
RegisterNUICallback('register', function(data)
local player = {}
player.playerName = data.name ..'_'.. data.family
player.dateofbirth = data.dateofbirth
player.gender = data.gender
ESX.TriggerServerCallback('nameAvalibity' , function(avalible)
if avalible then
TriggerServerEvent('db:updateamersiaUser', player)
TriggerServerEvent('es:newName', player.playerName)
TriggerEvent('nameUpdate', player.playerName)
EnableGui(false)
Wait (500)
loadToGround()
else
SendNUIMessage({
action = 'notification',
message= 'In moshakhasat qablan sabt shode, lotfan dobare emtehan konid!'
})
end
end ,player.playerName)
end)
Citizen.CreateThread(function()
-- ToggleSound(true)
SetManualShutdownLoadingScreenNui(true)
if not IsPlayerSwitchInProgress() then
SetEntityVisible(PlayerPedId(), false, 0)
SwitchOutPlayer(PlayerPedId(), 32, 1)
end
while GetPlayerSwitchState() ~= 5 do
Citizen.Wait(0)
end
ShutdownLoadingScreen()
ShutdownLoadingScreenNui()
showLoadingPromt("PCARD_JOIN_GAME", 500000)
while needRegister == nil do
Wait(5000)
end
if needRegister then
Wait(10000)
showLoadingPromt("PCARD_JOIN_GAME", 0)
EnableGui(true)
else
Wait(10000)
showLoadingPromt("PCARD_JOIN_GAME", 0)
loadToGround()
end
end)
Citizen.CreateThread(function()
while true do
if guiEnabled then
DisableControlAction(0, 18, guiEnabled) -- Enter
DisableControlAction(0, 322, guiEnabled) -- ESC
end
Citizen.Wait(0)
end
end)