aboutsummaryrefslogtreecommitdiff
path: root/Northstar.Custom/mod/scripts/vscripts/gamemodes
diff options
context:
space:
mode:
authorInteresting#4036 <52731127+Interesting-exe@users.noreply.github.com>2022-06-22 15:01:52 +0300
committerGitHub <noreply@github.com>2022-06-22 13:01:52 +0100
commit8c0ef3516f23a296c71cc4d61ec2b09746db9ca2 (patch)
treeb747e8d2859f30b48136ee54c7813318b56d6056 /Northstar.Custom/mod/scripts/vscripts/gamemodes
parent043e5696b73ca44eac69bc8d8bc8962c50fc5b79 (diff)
downloadNorthstarMods-8c0ef3516f23a296c71cc4d61ec2b09746db9ca2.tar.gz
NorthstarMods-8c0ef3516f23a296c71cc4d61ec2b09746db9ca2.zip
Gun Game: Fix potentially transferring score from leaving player to new joining player (#290)
* fixed a bug fixed a bug in which a player that just joined the server might have someone who's left the server's score (this fix should be applied to all ffa gamemodes) * made it more efficient * Use neutral pronoun in comment Co-authored-by: lnteresting-png <52731127+lnteresting-png@users.noreply.github.com> Co-authored-by: GeckoEidechse <40122905+GeckoEidechse@users.noreply.github.com> merging this for now as it's been open for ages while working, will add ffa support myself soon
Diffstat (limited to 'Northstar.Custom/mod/scripts/vscripts/gamemodes')
-rw-r--r--Northstar.Custom/mod/scripts/vscripts/gamemodes/_gamemode_gg.gnut7
1 files changed, 7 insertions, 0 deletions
diff --git a/Northstar.Custom/mod/scripts/vscripts/gamemodes/_gamemode_gg.gnut b/Northstar.Custom/mod/scripts/vscripts/gamemodes/_gamemode_gg.gnut
index b27892f7..8f34541b 100644
--- a/Northstar.Custom/mod/scripts/vscripts/gamemodes/_gamemode_gg.gnut
+++ b/Northstar.Custom/mod/scripts/vscripts/gamemodes/_gamemode_gg.gnut
@@ -13,6 +13,7 @@ void function GamemodeGG_Init()
AddCallback_OnPlayerRespawned( OnPlayerRespawned )
AddCallback_OnPlayerKilled( OnPlayerKilled )
+ AddCallback_OnClientDisconnected( OnPlayerDisconnected )
AddCallback_GameStateEnter( eGameState.WinnerDetermined, OnWinnerDetermined )
@@ -27,6 +28,12 @@ void function GamemodeGG_Init()
catch ( ex ) {}
}
+void function OnPlayerDisconnected(entity player)
+{
+ // resetting a player's score when they leave prevents a new player to join the leaver's team and having the previous player's points
+ AddTeamScore( player.GetTeam(), -GameRules_GetTeamScore( player.GetTeam() ) )
+}
+
void function OnPlayerRespawned( entity player )
{
UpdateLoadout( player )