From 287635fa368f61063959c866ebc31711f2c0a461 Mon Sep 17 00:00:00 2001 From: RaidMax Date: Sat, 12 Mar 2022 13:41:10 -0600 Subject: [PATCH] update integration gsc --- .../IW4x/userraw/scripts/_integration.gsc | 57 +++++++++++++++++++ 1 file changed, 57 insertions(+) diff --git a/GameFiles/IW4x/userraw/scripts/_integration.gsc b/GameFiles/IW4x/userraw/scripts/_integration.gsc index 8d55bbb0a..1b8a50984 100644 --- a/GameFiles/IW4x/userraw/scripts/_integration.gsc +++ b/GameFiles/IW4x/userraw/scripts/_integration.gsc @@ -65,6 +65,8 @@ OnPlayerConnect() } player thread OnPlayerSpawned(); + player thread OnPlayerJoinedTeam(); + player thread OnPlayerJoinedSpectators(); player thread PlayerTrackingOnInterval(); // only toggle if it's enabled @@ -97,6 +99,30 @@ OnPlayerDisconnect() } } +OnPlayerJoinedTeam() +{ + self endon( "disconnect" ); + + for( ;; ) + { + self waittill( "joined_team" ); + // join spec and join team occur at the same moment - out of order logging would be problematic + wait( 0.25 ); + LogPrint( GenerateJoinTeamString( false ) ); + } +} + +OnPlayerJoinedSpectators() +{ + self endon( "disconnect" ); + + for( ;; ) + { + self waittill( "joined_spectators" ); + LogPrint( GenerateJoinTeamString( true ) ); + } +} + OnGameEnded() { level endon ( "disconnect" ); @@ -215,6 +241,37 @@ DecrementClientMeta( metaKey, decrementValue, clientId ) SetClientMeta( metaKey, decrementValue, clientId, "decrement" ); } +GenerateJoinTeamString( isSpectator ) +{ + team = self.team; + + if ( IsDefined( self.joining_team ) ) + { + team = self.joining_team; + } + else + { + if ( isSpectator || !IsDefined( team ) ) + { + team = "spectator"; + } + } + + guid = self GetXuid(); + + if ( guid == "0" ) + { + guid = self.guid; + } + + if ( !IsDefined( guid ) || guid == "0" ) + { + guid = "undefined"; + } + + return "JT;" + guid + ";" + self getEntityNumber() + ";" + team + ";" + self.name + "\n"; +} + SetClientMeta( metaKey, metaValue, clientId, direction ) { data = "key=" + metaKey + "|value=" + metaValue;