aboutsummaryrefslogtreecommitdiff
path: root/Northstar.CustomServers/mod/scripts
diff options
context:
space:
mode:
Diffstat (limited to 'Northstar.CustomServers/mod/scripts')
-rw-r--r--Northstar.CustomServers/mod/scripts/vscripts/_menu_callbacks.gnut6
-rw-r--r--Northstar.CustomServers/mod/scripts/vscripts/lobby/_private_lobby.gnut36
2 files changed, 21 insertions, 21 deletions
diff --git a/Northstar.CustomServers/mod/scripts/vscripts/_menu_callbacks.gnut b/Northstar.CustomServers/mod/scripts/vscripts/_menu_callbacks.gnut
index 02be47a4..1092bf2d 100644
--- a/Northstar.CustomServers/mod/scripts/vscripts/_menu_callbacks.gnut
+++ b/Northstar.CustomServers/mod/scripts/vscripts/_menu_callbacks.gnut
@@ -9,7 +9,7 @@ void function MenuCallbacks_Init()
bool function ClientCommandCallback_LeaveMatch( entity player, array<string> args )
{
// note: this is imperfect if we have multiple people of the same uid on a server, but that's only a thing in testing
- if ( NSIsPlayerIndexLocalPlayer( player.GetPlayerIndex() ) )
+ if ( NSIsPlayerLocalPlayer( player ) )
{
if ( GetConVarBool( "ns_should_return_to_lobby" ) && GetMapName() != "mp_lobby" )
{
@@ -41,9 +41,11 @@ void function WritePersistenceAndLeaveForLocalPlayerOnly( entity player )
void function WritePersistenceAndLeave( entity player )
{
+ player.EndSignal( "OnDestroy" )
+
// 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() )
+ NSEarlyWritePlayerPersistenceForLeave( player )
while ( NSIsWritingPlayerPersistence() )
WaitFrame()
diff --git a/Northstar.CustomServers/mod/scripts/vscripts/lobby/_private_lobby.gnut b/Northstar.CustomServers/mod/scripts/vscripts/lobby/_private_lobby.gnut
index c410869e..0a28031a 100644
--- a/Northstar.CustomServers/mod/scripts/vscripts/lobby/_private_lobby.gnut
+++ b/Northstar.CustomServers/mod/scripts/vscripts/lobby/_private_lobby.gnut
@@ -38,14 +38,14 @@ void function SetupPrivateMatchUIVarsWhenReady()
bool function ClientCommandCallback_PrivateMatchLaunch( entity player, array<string> args )
{
if ( GetConVarBool( "ns_private_match_only_host_can_start" ) )
- if ( !NSIsPlayerIndexLocalPlayer( player.GetPlayerIndex() ) )
+ if ( !NSIsPlayerLocalPlayer( player ) )
return true
- PlayerChangedTheGame( player , " changed the game state." , args )
+ LogPrivateMatchChange( player , " changed the game state." , args )
if ( file.startState == ePrivateMatchStartState.STARTING )
{
- PlayerChangedTheGame( player , " canceled the game countdown." , args )
+ LogPrivateMatchChange( player , " canceled the game countdown." , args )
// cancel start if we're already mid-countdown
file.startState = ePrivateMatchStartState.READY
@@ -54,7 +54,7 @@ bool function ClientCommandCallback_PrivateMatchLaunch( entity player, array<str
}
else
{
- PlayerChangedTheGame( player , " started the game countdown." , args )
+ LogPrivateMatchChange( player , " started the game countdown." , args )
// start match
file.startState = ePrivateMatchStartState.STARTING
@@ -73,10 +73,10 @@ bool function ClientCommandCallback_PrivateMatchSetMode( entity player, array<st
return true
if ( GetConVarInt( "ns_private_match_only_host_can_change_settings" ) == 2 )
- if ( !NSIsPlayerIndexLocalPlayer( player.GetPlayerIndex() ) )
+ if ( !NSIsPlayerLocalPlayer( player ) )
return true
- PlayerChangedTheGame( player , " changed the mode to " , args )
+ LogPrivateMatchChange( player , " changed the mode to " , args )
// todo: need to verify this value
file.mode = args[0]
@@ -97,10 +97,10 @@ bool function ClientCommandCallback_SetCustomMap( entity player, array<string> a
return true
if ( GetConVarInt( "ns_private_match_only_host_can_change_settings" ) == 2 )
- if ( !NSIsPlayerIndexLocalPlayer( player.GetPlayerIndex() ) )
+ if ( !NSIsPlayerLocalPlayer( player ) )
return true
- PlayerChangedTheGame( player , " changed the map to " , args )
+ LogPrivateMatchChange( player , " changed the map to " , args )
// todo: need to verify this value
file.map = args[0]
@@ -217,10 +217,10 @@ bool function ClientCommandCallback_PrivateMatchSetPlaylistVarOverride( entity p
return true
if ( GetConVarInt( "ns_private_match_only_host_can_change_settings" ) >= 1 )
- if ( !NSIsPlayerIndexLocalPlayer( player.GetPlayerIndex() ) )
+ if ( !NSIsPlayerLocalPlayer( player ) )
return true
- PlayerChangedTheGame( player , " override the setting " , args )
+ LogPrivateMatchChange( player , " override the setting " , args )
bool found = false
foreach ( string category in GetPrivateMatchSettingCategories() )
@@ -244,23 +244,21 @@ bool function ClientCommandCallback_PrivateMatchSetPlaylistVarOverride( entity p
bool function ClientCommandCallback_ResetMatchSettingsToDefault( entity player, array<string> args )
{
if ( GetConVarInt( "ns_private_match_only_host_can_change_settings" ) >= 1 )
- if ( !NSIsPlayerIndexLocalPlayer( player.GetPlayerIndex() ) )
+ if ( !NSIsPlayerLocalPlayer( player ) )
return true
- PlayerChangedTheGame( player , " reset to default" , args )
+ LogPrivateMatchChange( player , " reset to default" , args )
ClearPlaylistVarOverrides()
return true
}
-void function PlayerChangedTheGame( entity player , string step , array<string> args ){
- if( step.find( "mode" ) || step.find( "map" )){
+void function LogPrivateMatchChange( entity player , string step , array<string> args )
+{
+ if( step.find( "mode" ) || step.find( "map" ) )
print( player.GetPlayerName() + step + args[ 0 ] + ".---" + "UID:" +player.GetUID() )
- }
- else if(step.find("setting")){
+ else if ( step.find( "setting" ) )
print( player.GetPlayerName() + step + args[ 0 ] + " to "+ args[ 1 ] + ".---" + "UID:" +player.GetUID() )
- }
- else{
+ else
print( player.GetPlayerName() + step + ".---" + "UID:" + player.GetUID())
- }
} \ No newline at end of file