3 #include <server/teamplay.qh>
5 void GameRules_teams(bool value)
8 serverflags |= SERVERFLAG_TEAMPLAY;
10 cvar_set("teamplay", "2"); // DP needs this for sending proper getstatus replies.
11 GameRules_spawning_teams(true);
13 serverflags &= ~SERVERFLAG_TEAMPLAY;
15 cvar_set("teamplay", "0"); // DP needs this for sending proper getstatus replies.
16 GameRules_spawning_teams(false);
20 void GameRules_spawning_teams(bool value)
22 have_team_spawns = value ? -1 : 0;
25 bool _GameRules_score_enabled = true;
26 void GameRules_score_enabled(bool value)
28 _GameRules_score_enabled = value;
31 bool GameRules_limit_score_initialized;
32 void GameRules_limit_score(int limit)
34 if (GameRules_limit_score_initialized) return;
35 if (autocvar_g_campaign) return;
36 if (limit < 0) return;
37 cvar_set("fraglimit", ftos(limit));
38 GameRules_limit_score_initialized = true;
41 bool GameRules_limit_lead_initialized;
42 void GameRules_limit_lead(int limit)
44 if (GameRules_limit_lead_initialized) return;
45 if (autocvar_g_campaign) return;
46 if (limit < 0) return;
47 cvar_set("leadlimit", ftos(limit));
48 GameRules_limit_lead_initialized = true;
51 bool GameRules_limit_time_initialized;
52 void GameRules_limit_time(int limit)
54 if (GameRules_limit_time_initialized) return;
55 if (autocvar_g_campaign) return;
56 if (limit < 0) return;
57 cvar_set("timelimit", ftos(limit));
58 GameRules_limit_time_initialized = true;
61 bool GameRules_limit_time_qualifying_initialized;
62 void GameRules_limit_time_qualifying(int limit)
64 if (GameRules_limit_time_qualifying_initialized) return;
65 if (autocvar_g_campaign) return;
66 if (limit < 0) return;
67 cvar_set("g_race_qualifying_timelimit", ftos(limit));
68 GameRules_limit_time_qualifying_initialized = true;
71 void GameRules_limit_fallbacks()
73 GameRules_limit_score(autocvar_fraglimit_override);
74 GameRules_limit_lead(autocvar_leadlimit_override);
75 GameRules_limit_time(autocvar_timelimit_override);
78 void _GameRules_scoring_begin(int teams, float spprio, float stprio)
80 ScoreRules_basics(teams, spprio, stprio, _GameRules_score_enabled);
82 void _GameRules_scoring_field(entity i, string label, int scoreflags)
84 ScoreInfo_SetLabel_PlayerScore(i, label, scoreflags);
86 void _GameRules_scoring_field_team(float i, string label, int scoreflags)
88 ScoreInfo_SetLabel_TeamScore(i, label, scoreflags);
90 void _GameRules_scoring_end()
92 ScoreRules_basics_end();
95 .bool m_GameRules_scoring_vip;
96 void GameRules_scoring_vip(entity player, bool value)
98 player.m_GameRules_scoring_vip = value;
100 bool GameRules_scoring_is_vip(entity player)
102 return player.m_GameRules_scoring_vip;
105 float _GameRules_scoring_add(entity client, entity sp, float value)
107 return PlayerScore_Add(client, sp, value);
109 float _GameRules_scoring_add_team(entity client, entity sp, int st, float value)
111 return PlayerTeamScore_Add(client, sp, st, value);