aboutsummaryrefslogtreecommitdiff
path: root/Northstar.CustomServers/mod/scripts/vscripts/_menu_callbacks.gnut
diff options
context:
space:
mode:
authorBobTheBob <32057864+BobTheBob9@users.noreply.github.com>2021-10-14 21:01:40 +0100
committerBobTheBob <32057864+BobTheBob9@users.noreply.github.com>2021-10-14 21:01:40 +0100
commit9a2778eabc7ba968968e41dda9f03525d6c5383d (patch)
tree6d1c5dc64754d542d68a7f47742a701a4eec9308 /Northstar.CustomServers/mod/scripts/vscripts/_menu_callbacks.gnut
parentc0a0c7e502f2bc99185d79a485b965f63de7a203 (diff)
downloadNorthstarMods-9a2778eabc7ba968968e41dda9f03525d6c5383d.tar.gz
NorthstarMods-9a2778eabc7ba968968e41dda9f03525d6c5383d.zip
oh fuck i forgot to commit for a while
Diffstat (limited to 'Northstar.CustomServers/mod/scripts/vscripts/_menu_callbacks.gnut')
-rw-r--r--Northstar.CustomServers/mod/scripts/vscripts/_menu_callbacks.gnut17
1 files changed, 12 insertions, 5 deletions
diff --git a/Northstar.CustomServers/mod/scripts/vscripts/_menu_callbacks.gnut b/Northstar.CustomServers/mod/scripts/vscripts/_menu_callbacks.gnut
index c116ac33b..d0820dd6a 100644
--- a/Northstar.CustomServers/mod/scripts/vscripts/_menu_callbacks.gnut
+++ b/Northstar.CustomServers/mod/scripts/vscripts/_menu_callbacks.gnut
@@ -7,11 +7,18 @@ void function MenuCallbacks_Init()
bool function ClientCommandCallback_LeaveMatch( entity player, array<string> args )
{
- // todo: ideally, it'd be nice to get clients to return to lobby here, rather than just dcing them
- // kind of a pain tho, since we'd have to get it to call script code without a remote func, since that'd break compatibility
+ thread WritePersistenceAndLeave( player )
+ return true
+}
- ClientCommand( player, "disconnect" )
- //ClientCommand( player, "setplaylist tdm; map mp_lobby" )
+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
+ NSEarlyWritePlayerPersistenceForLeave( player )
+ while ( NSIsWritingPlayerPersistence() )
+ WaitFrame()
- return true
+ // 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_leave_to_lobby" )
} \ No newline at end of file