blob: c8a8274a5886bfcd5a9edc5a9732649ac585e76b (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
|
untyped
globalize_all_functions
void function NorthstarCodeCallback_GenerateGameState() {
GameStateStruct gs
int highestScore = 0
int secondHighest = 0
foreach ( player in GetPlayerArray() )
{
if ( GameRules_GetTeamScore( player.GetTeam() ) >= highestScore )
{
highestScore = GameRules_GetTeamScore( player.GetTeam() )
}
else if ( GameRules_GetTeamScore( player.GetTeam() ) > secondHighest )
{
secondHighest = GameRules_GetTeamScore( player.GetTeam() )
}
}
gs.map = GetMapName()
gs.mapDisplayname = Localize(GetMapDisplayName(GetMapName()))
gs.playlist = GetCurrentPlaylistName()
gs.playlistDisplayname = Localize(GetCurrentPlaylistVarString("name", GetCurrentPlaylistName()))
gs.currentPlayers = GetPlayerArray().len()
gs.maxPlayers = GetCurrentPlaylistVarInt( "maxPlayers", -1 )
if ( IsValid( GetLocalClientPlayer() ) )
gs.ownScore = GameRules_GetTeamScore( GetLocalClientPlayer().GetTeam() )
gs.otherHighestScore = gs.ownScore == highestScore ? secondHighest : highestScore
gs.maxScore = IsRoundBased() ? GetCurrentPlaylistVarInt( "roundscorelimit", 0 ) : GetCurrentPlaylistVarInt( "scorelimit", 0 )
if ( GetServerVar( "roundBased" ) )
gs.timeEnd = expect float(level.nv.roundEndTime - Time())
else
gs.timeEnd = expect float(level.nv.gameEndTime - Time())
NSPushGameStateData(gs)
}
|