blob: 8b65ec9355ea438032969a5f1fdaa53e1b3487f5 (
plain)
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
|
untyped
global function Lobby_Init
global function Lobby_OnClientConnectionStarted
global function Lobby_OnClientConnectionCompleted
void function Lobby_Init()
{
// need to prevent a crash
Music_Init()
if ( IsPrivateMatch() || GetCurrentPlaylistName() == "private_match" ) // IsPrivateMatch() doesn't seem to be reliable on local server start
PrivateLobby_Init()
else
{
// non-private lobby clientcommands
AddClientCommandCallback( "StartPrivateMatchSearch", ClientCommandCallback_StartPrivateMatchSearch )
AddClientCommandCallback( "SetAnnouncementVersionSeen", ClientCommandCallback_SetAnnouncementVersionSeen )
}
}
void function Lobby_OnClientConnectionStarted( entity player )
{
if ( !( IsPrivateMatch() || GetCurrentPlaylistName() == "private_match" ) || !GetConVarBool( "ns_allow_spectators" ) )
player.SetPersistentVar( "privateMatchState", 0 ) // disable spectator
}
void function Lobby_OnClientConnectionCompleted( entity player )
{
player.hasConnected = true
FinishClientScriptInitialization( player )
}
bool function ClientCommandCallback_StartPrivateMatchSearch( entity player, array<string> args )
{
// open lobby in private match mode
SetCurrentPlaylist( "private_match" ) // required for private match lobby to start properly
GameRules_ChangeMap( "mp_lobby", GAMETYPE )
return true
}
bool function ClientCommandCallback_SetAnnouncementVersionSeen( entity player, array<string> args )
{
if ( args.len() < 1 )
return false
int version = int( args[0] )
player.SetPersistentVar( "announcementVersionSeen", version )
return true
}
|