1
- local VORPcore = {}
2
1
local VORPMenu = {}
3
- local Portal
4
- local PromptGroup = GetRandomIntInRange (0 , 0xffffff )
5
- local InMenu = false
6
-
7
- TriggerEvent (' getCore' , function (core )
8
- VORPcore = core
9
- end )
10
2
TriggerEvent (' vorp_menu:getData' , function (cb )
11
3
VORPMenu = cb
12
4
end )
13
5
6
+ local ClientRPC = exports .vorp_core :ClientRpcCall ()
7
+
8
+ local Portal
9
+ local PromptGroup = GetRandomIntInRange (0 , 0xffffff )
10
+ local InMenu = false
14
11
-- Start Portals
15
12
CreateThread (function ()
16
13
PortPrompt ()
17
14
while true do
18
15
Wait (0 )
19
- local player = PlayerPedId ()
20
- local pCoords = GetEntityCoords (player )
16
+ local playerPed = PlayerPedId ()
17
+ local pCoords = GetEntityCoords (playerPed )
21
18
local sleep = true
22
19
local hour = GetClockHours ()
23
20
24
- if not InMenu and not IsEntityDead (player ) then
21
+ if not InMenu and not IsEntityDead (playerPed ) then
25
22
for shop , shopCfg in pairs (Config .shops ) do
26
23
if shopCfg .shopHours then
27
24
-- Using Shop Hours - Shop Closed
@@ -105,13 +102,12 @@ CreateThread(function()
105
102
PromptSetEnabled (Portal , 1 )
106
103
107
104
if Citizen .InvokeNative (0xC92AC953F0A982AE , Portal ) then -- UiPromptHasStandardModeCompleted
108
- VORPcore . RpcCall ( ' CheckPlayerJob' , function ( hasJob )
109
- if hasJob then
105
+ local result = ClientRPC . Callback . TriggerAwait ( ' bcc-portals: CheckPlayerJob' , shop )
106
+ if result then
110
107
OpenMenu (pCoords , shop )
111
108
else
112
109
return
113
110
end
114
- end , shop )
115
111
end
116
112
end
117
113
end
@@ -173,13 +169,12 @@ CreateThread(function()
173
169
PromptSetEnabled (Portal , 1 )
174
170
175
171
if Citizen .InvokeNative (0xC92AC953F0A982AE , Portal ) then -- UiPromptHasStandardModeCompleted
176
- VORPcore .RpcCall (' CheckPlayerJob' , function (hasJob )
177
- if hasJob then
178
- OpenMenu (pCoords ,shop )
179
- else
180
- return
181
- end
182
- end , shop )
172
+ local result = ClientRPC .Callback .TriggerAwait (' bcc-portals:CheckPlayerJob' , shop )
173
+ if result then
174
+ OpenMenu (pCoords ,shop )
175
+ else
176
+ return
177
+ end
183
178
end
184
179
end
185
180
end
195
190
-- Portal Menu to Choose Destination
196
191
function OpenMenu (pCoords , shop )
197
192
VORPMenu .CloseAll ()
198
- local player = PlayerPedId ()
193
+ local playerPed = PlayerPedId ()
199
194
local shopCfg = Config .shops [shop ]
200
- TaskStandStill (player , - 1 )
195
+ TaskStandStill (playerPed , - 1 )
201
196
DisplayRadar (false )
202
197
InMenu = true
203
198
local MenuElements = {}
@@ -224,25 +219,24 @@ function OpenMenu(pCoords, shop)
224
219
end
225
220
if data .current .value then
226
221
local travelInfo = {location = data .current .value , coords = pCoords }
227
- VORPcore .RpcCall (" GetTravelData" , function (travelData )
228
- if travelData then
229
- DestinationMenu (travelData , shop , pCoords )
230
- end
231
- end , travelInfo )
222
+ local travelData = ClientRPC .Callback .TriggerAwait (' bcc-portals:GetTravelData' , travelInfo )
223
+ if travelData then
224
+ DestinationMenu (travelData , shop , pCoords )
225
+ end
232
226
end
233
227
end ,
234
228
function (data , menu )
235
229
menu .close ()
236
230
InMenu = false
237
- ClearPedTasks (player )
231
+ ClearPedTasks (playerPed )
238
232
DisplayRadar (true )
239
233
end )
240
234
end
241
235
242
236
function DestinationMenu (travelData , shop , pCoords )
243
237
VORPMenu .CloseAll ()
244
238
InMenu = true
245
- local player = PlayerPedId ()
239
+ local playerPed = PlayerPedId ()
246
240
local MenuElements = {}
247
241
local travelLoc = travelData .location
248
242
local cashPrice = travelData .cash
@@ -318,21 +312,19 @@ function DestinationMenu(travelData, shop, pCoords)
318
312
end
319
313
320
314
local canTravelInfo = {currency = data .current .value , price = data .current .info }
321
- VORPcore .RpcCall (" GetPlayerCanTravel" , function (canTravel )
322
- if canTravel then
323
- SendPlayer (travelLoc , travelData .travelTime )
324
- end
325
- end , canTravelInfo )
326
-
327
- menu .close ()
328
- InMenu = false
329
- ClearPedTasks (player )
330
- DisplayRadar (true )
315
+ local canTravel = ClientRPC .Callback .TriggerAwait (' bcc-portals:GetPlayerCanTravel' , canTravelInfo )
316
+ if canTravel then
317
+ menu .close ()
318
+ SendPlayer (travelLoc , travelData .travelTime )
319
+ InMenu = false
320
+ ClearPedTasks (playerPed )
321
+ DisplayRadar (true )
322
+ end
331
323
end ,
332
324
function (data , menu )
333
325
menu .close ()
334
326
InMenu = false
335
- ClearPedTasks (player )
327
+ ClearPedTasks (playerPed )
336
328
DisplayRadar (true )
337
329
end )
338
330
end
0 commit comments