aboutsummaryrefslogtreecommitdiff
path: root/Northstar.Custom
diff options
context:
space:
mode:
authorCoopyy <pat.pvp.unturned@gmail.com>2022-02-11 17:41:54 -0600
committerBarichello <artur@barichello.me>2022-02-14 22:11:37 -0300
commit66a75f222d7137026315dd74d3378445ab5a2329 (patch)
tree65eac3ebdd663a063810a78ca3e01d2c252e0923 /Northstar.Custom
parentc09d11e0689618ab35ef50a90e86202a89bf26b6 (diff)
downloadNorthstarMods-66a75f222d7137026315dd74d3378445ab5a2329.tar.gz
NorthstarMods-66a75f222d7137026315dd74d3378445ab5a2329.zip
Sticks & Stones: fix highlight on disconnect
part 2
Diffstat (limited to 'Northstar.Custom')
-rw-r--r--Northstar.Custom/mod/scripts/vscripts/gamemodes/_gamemode_sns.gnut19
1 files changed, 18 insertions, 1 deletions
diff --git a/Northstar.Custom/mod/scripts/vscripts/gamemodes/_gamemode_sns.gnut b/Northstar.Custom/mod/scripts/vscripts/gamemodes/_gamemode_sns.gnut
index 7ac728de5..812c21ee6 100644
--- a/Northstar.Custom/mod/scripts/vscripts/gamemodes/_gamemode_sns.gnut
+++ b/Northstar.Custom/mod/scripts/vscripts/gamemodes/_gamemode_sns.gnut
@@ -27,6 +27,7 @@ void function SNS_Init()
AddCallback_OnPlayerKilled( OnPlayerKilled )
AddCallback_OnPlayerRespawned( OnPlayerRespawned )
+ AddCallback_OnClientDisconnected(OnPlayerDisconnected)
AddCallback_GameStateEnter( eGameState.WinnerDetermined, OnWinnerDetermined )
file.reset_pulse_blade_cooldown_on_pulse_blade_kill = GetCurrentPlaylistVarInt( "sns_reset_pulse_blade_cooldown_on_pulse_blade_kill", 1 ) == 1
@@ -38,6 +39,22 @@ void function SNS_Init()
file.melee_kill_value = GetCurrentPlaylistVarInt( "sns_melee_kill_value", 5 )
}
+void function OnPlayerDisconnected(entity player)
+{
+ if (GetWinningPlayer() == player)
+ thread CheckNewHighlight(player)
+}
+
+void function CheckNewHighlight(entity player)
+{
+ while (IsValid(player)) //wait till disconnected player not exist
+ wait 0.25
+
+ entity winner = GetWinningPlayer()
+ if (IsValid(winner))
+ SetHighlight(winner)
+}
+
void function OnPlayerKilled( entity victim, entity attacker, var damageInfo )
{
if ( victim != attacker && victim.IsPlayer() && attacker.IsPlayer() && GetGameState() == eGameState.Playing )
@@ -161,4 +178,4 @@ void function SetHighlight(entity player) {
foreach ( entity player in GetPlayerArray() )
Highlight_ClearEnemyHighlight(player)
Highlight_SetEnemyHighlight( player, file.score_leader_highlight )
-} \ No newline at end of file
+}