-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathclient.lua
More file actions
56 lines (50 loc) · 1.63 KB
/
client.lua
File metadata and controls
56 lines (50 loc) · 1.63 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
local function Lobby()
return lib.showMenu('Main')
end
lib.registerMenu({
title = 'Lobbies',
id = 'Main',
position = 'top-right',
options = {
{label = 'Create A Lobby'},
{label = 'Join A Lobby'},
{label = "Leave Your Current Lobby"}
}
}, function(selected)
if selected == 1 then
local input = lib.inputDialog('Lobby Creation', {
'Lobby Name',
'Password (Leave Blank If None)',
})
if input[2] and input[2]:len() > 3 then
TriggerServerEvent('Lobbies', {type = 'New Lobby', Password = input[2], Name = input[1]})
else
TriggerServerEvent('Lobbies', {type = 'New Lobby', Name = input[1] or 'N/A'})
end
elseif selected == 2 then
local LobbyList = lib.callback.await('GetLobbyCount')
local options = {
{label = "Availible Lobbies", close = false}
}
for i = 1, #LobbyList do
options[#options+1] = {
label = LobbyList[i].Name.. 'Made By'.. LobbyList[i].Creator,
description = 'Players In Lobby:' .. #LobbyList[i].Players
}
end
lib.registerMenu({
id = 'Join',
title = 'Lobbies',
position = 'top-right',
options = options,
}, function(selected)
if selected > 1 then
TriggerServerEvent('Lobbies', {type = 'Join Lobby', Lobby = selected})
end
end)
lib.showMenu('Join')
else
TriggerServerEvent('Lobbies', {type = 'Leave'})
end
end)
RegisterCommand('lobbies', Lobby)