I made a Gamemode called Endurance, from idea by ThaumicTom. The mode ends therace in the middle of the normal race, when the race timer is on "0:00". The map record is saved by 2 functions: ScoreMgr.Map_SetNewRecord() and Solo_SetNewRecord().When I put wait command, it waits forever, without any error. No wait condiction really worked, I used wait(GhostP!=Null); , but it didn't work.
The code for saving the ghost: (info: ScoreMgr.Map_SetNewRecord() is skipped in all cases, cos GhostP is equal Null)
Code: Select all
declare CGhost GhostP;
declare persistent Integer EnduraceRecord for Map;
if(Players[0].CurRace.Score > EnduraceRecord) {
GhostP = ScoreMgr.Playground_GetPlayerGhost(Players[0]);
Players[0].Score.BestRace.Score = Players[0].CurRace.Score;
Players[0].Score.BestRace = Players[0].CurRace;
EnduraceRecord = Players[0].Score.BestRace.Score;
}
if (Players[0].RaceStartTime != 0) {
//continue;
UIManager.UIAll.UISequence = CUIConfig::EUISequence::None;
sleep(1000);
TM::Players_UnspawnAll();
}
if (GhostP != Null) {
ScoreMgr.Map_SetNewRecord(Players[0].Id, Map.MapInfo.MapUid, _ScContext, GhostP);
}
else
log("ghost is null");
Solo_SetNewRecord(Players[0].Score, RaceLib::CalcRecordEndurance(Players[0].Score.BestRace.Score));
Code: Select all
declare CTaskResult_Ghost Ghost0;
Ghost0 = ScoreMgr.Map_GetRecordGhost(Players[0].Id, Map.MapInfo.MapUid, ScContext);
wait(!Ghost0.IsProcessing);
if (Ghost0.Ghost != Null) {
Players[0].Score.BestRace = Ghost0.Ghost.Result;
RaceGhost_Add(Ghost0.Ghost, True);
}
Thanks for your help
