blob: edb8d79d56738ee3914df5606cde16632f55ec1a (
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
|
global function MenuCallbacks_Init
void function MenuCallbacks_Init()
{
AddClientCommandCallback( "LeaveMatch", ClientCommandCallback_LeaveMatch )
}
bool function ClientCommandCallback_LeaveMatch( entity player, array<string> args )
{
thread WritePersistenceAndLeave( player )
return true
}
void function WritePersistenceAndLeave( entity player )
{
// write player persistence before we leave, since leaving player might load local lobby before server writes persistence, so they won't get newest
// not super essential, but a nice qol thing
NSEarlyWritePlayerIndexPersistenceForLeave( player.GetPlayerIndex() )
while ( NSIsWritingPlayerPersistence() )
WaitFrame()
// this is a custom concommand which can be called on clients, it causes them to leave and doesn't have issues if they're host
ClientCommand( player, "ns_start_reauth_and_leave_to_lobby" )
}
|