This repository has been archived by the owner on Mar 27, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 13
/
Copy pathlobby_seek.lua
129 lines (114 loc) · 3.49 KB
/
lobby_seek.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
-- MannUp
-- Competitive6v6
-- SpecialEvent
-- Casual
-- BootCamp
local queueable_match_group, members, join_pendings, leader, groupid = {}
local function autoqueue()
end
local function party_say( text )
end
local command = {
-- queue all
-- queue autoqueue [mode]
-- queue casual, competitive
['queue'] = {
all = function()
for name, matchgroup in pairs( queueable_match_group ) do
party.QueueUp( matchgroup )
end
end,
autoqueue = autoqueue
},
-- info leader
-- info groupid
-- info leave
-- info join
-- info pending
['info'] = {
leader = function()
party_say( 'current leader: ' .. steam.GetPlayerName( leader ) )
end,
groupid = function()
party_say( 'current groupid: ' .. groupid )
end,
leave = function()
party_say( 'last 5 entries (members left):' )
end,
join = function()
party_say( 'last 5 entries (members joined):' )
end,
pending = function()
party_say( 'last 5 entries (members in waiting room):' )
end
},
--- whitelisting needed!
-- user connect <community ip> <opt password>
-- user disconnect
-- user lua <filename>
-- user leader <steamid>
-- user kick <steamid> | offline | banned
-- user leave
-- user standby <join/leave/get>
-- user priority index | userid | steamid <get, set, color> <opt val>
-- user map <mapbitgetto>
['user'] = function( args )
end
}
local function parse( text )
local args = {}
for w in text:gmatch( "%S+" ) do
args[#args + 1] = w:lower()
end
command[table.remove( args, 1 )]( args )
end
local event = {
['party_chat'] = function( e )
local steamid64, text, type
steamid64 = e:GetInt( 'steamid' )
text = e:GetString( 'text' )
type = e:GetInt( 'type' )
parse( text )
end,
['party_updated'] = function()
members = party.GetMembers()
leader = party.GetLeader()
groupid = party.GetGroupID()
local gamemodes = party.GetAllMatchGroups()
for name, MatchGroup in pairs( gamemodes ) do
local reasons = party.CanQueueForMatchGroup( MatchGroup )
-- reasons[2]: player is already queueing for ... (maybe we should replace with GetQueuedMatchGroups() instead)
if reasons == true then
queueable_match_group[name] = MatchGroup
else
printLuaTable(reasons)
end
end
end
}
callbacks.Register( 'FireGameEvent', function( e )
local f = event[e:GetName()]
if f then
f( e )
end
end )
callbacks.Register( 'SendStringCmd', function( cmd )
--parse( cmd:Get() )
--UnloadScript( GetScriptName() )
--LoadScript( GetScriptName() )
end )
event.party_updated()
local gamemodes = party.GetAllMatchGroups()
for name, MatchGroup in pairs( gamemodes ) do
local reasons = party.CanQueueForMatchGroup( MatchGroup )
-- reasons[2]: player is already queueing for ... (maybe we should replace with GetQueuedMatchGroups() instead)
if reasons == true then
queueable_match_group[name] = MatchGroup
party.QueueUp( MatchGroup )
else
--printLuaTable(reasons)
end
end
-- cannot join a lobby if another player is requesting to join ur lobby.
-- to enable party bypass, set 'share my lobby' or 'auto accept invites' to true
-- tf_party_debug <- useful cvar use it.