Compare commits

..

2 Commits

Author SHA1 Message Date
Beu
1e017b925d allow to update teams when playing 2023-12-02 18:13:23 +01:00
Beu
dac6f3916f prevent DNF 2023-12-02 18:13:11 +01:00

View File

@ -47,10 +47,12 @@ foreach (Player in AllPlayers) {
} }
declare Text[] Map_LoginsToRespawn; declare Text[] Map_LoginsToRespawn;
declare Text Map_TeamsConfig;
*** ***
***Match_StartMap*** ***Match_StartMap***
*** ***
Map_TeamsConfig = S_TeamsConfig;
if (S_TeamsConfig != "") { if (S_TeamsConfig != "") {
declare Integer[Text] TeamsConfig ; declare Integer[Text] TeamsConfig ;
TeamsConfig.fromjson(S_TeamsConfig); TeamsConfig.fromjson(S_TeamsConfig);
@ -67,6 +69,8 @@ if (S_TeamsConfig != "") {
UI.SendChat("$ff3You play for the team $fff"^ ClanId); UI.SendChat("$ff3You play for the team $fff"^ ClanId);
} }
} }
Race::SetRespawnBehaviour(Race::C_RespawnBehaviour_NeverGiveUp);
*** ***
***Match_PlayLoop*** ***Match_PlayLoop***
@ -115,6 +119,33 @@ foreach (LoginToRespawn in Map_LoginsToRespawn) {
RespawnPlayer(Player); RespawnPlayer(Player);
} }
} }
if (Map_TeamsConfig != S_TeamsConfig) {
Map_TeamsConfig = S_TeamsConfig;
if (S_TeamsConfig != "") {
declare Integer[Text] TeamsConfig ;
TeamsConfig.fromjson(S_TeamsConfig);
foreach (Player in AllPlayers) {
declare Integer ClanId = TeamsConfig.get(Player.User.WebServicesUserId, 0);
Player.Score.LadderClan = ClanId;
if (Player.SpawnStatus == CSmPlayer::ESpawnStatus::NotSpawned) {
log("Attributing Player "^ Player.User.Name ^" to the clan " ^ ClanId);
SetPlayerClan(Player, ClanId);
} else {
log("Can't apply Player "^ Player.User.Name ^" to the clan " ^ ClanId ^ " because they is playing");
}
UpdateClanStates(Player.Score.LadderClan);
declare CUIConfig UI <=> UIManager.GetUI(Player);
if (UI == Null) continue;
UI.SendChat("$ff3You play for the team $fff"^ ClanId);
}
}
}
*** ***
Void ApplyModeToPlayer(CSmPlayer _Player, Boolean _Lock) { Void ApplyModeToPlayer(CSmPlayer _Player, Boolean _Lock) {