I wanted to add a timer to know how long it took the player to take the round
-
high_round_tracker() { // marca que está rodando (debug opcional) // iprintlnbold("^2HighRound Tracker ON"); // thread que informa recordes periodicamente thread high_round_info_giver(); // Descobre mapa/modo gamemode = gamemodeName(getDvar("ui_gametype")); map = mapName(level.script); if (level.script == "zm_transit" && getDvar("ui_gametype") == "zsurvival") { map = startLocationName(getDvar("ui_zm_mapstartlocation")); } // Garante pasta de logs if (!directoryExists("logs")) { createDirectory("logs"); } filename = "logs/" + map + gamemode + "HighRound.txt"; // Inicializa arquivo se não existir if (!fileExists(filename)) { writeFile(filename, "0;-", false); // false = sobrescreve } // Carrega estado text = readFile(filename); if (!isDefined(text) || text == "") { text = "0;-"; } info = strTok(text, ";"); level.HighRound = int(info[0]); level.HighRoundPlayers = isDefined(info[1]) ? info[1] : "-"; // Espera fim da partida para checar recorde for (;;) { level waittill("end_game"); if (level.round_number > level.HighRound) { // monta lista de jogadores level.HighRoundPlayers = ""; players = get_players(); for (i = 0; i < players.size; i++) { if (level.HighRoundPlayers == "") level.HighRoundPlayers = players[i].name; else level.HighRoundPlayers = level.HighRoundPlayers + "," + players[i].name; } // feedback foreach (player in level.players) { player tell("Record: ^1" + level.round_number); player tell("Por: ^1" + level.HighRoundPlayers); } // persiste no disco e atualiza variáveis log_highround_record(level.round_number + ";" + level.HighRoundPlayers); } } } log_highround_record(newRecord) { gamemode = gamemodeName(getDvar("ui_gametype")); map = mapName(level.script); if (level.script == "zm_transit" && getDvar("ui_gametype") == "zsurvival") { map = startLocationName(getDvar("ui_zm_mapstartlocation")); } filename = "logs/" + map + gamemode + "HighRound.txt"; writeFile(filename, newRecord, false); // sobrescreve com o novo recorde // Atualiza na memória info = strTok(newRecord, ";"); level.HighRound = int(info[0]); level.HighRoundPlayers = isDefined(info[1]) ? info[1] : "-"; }
Hello! It looks like you're interested in this conversation, but you don't have an account yet.
Getting fed up of having to scroll through the same posts each visit? When you register for an account, you'll always come back to exactly where you were before, and choose to be notified of new replies (either via email, or push notification). You'll also be able to save bookmarks and upvote posts to show your appreciation to other community members.
With your input, this post could be even better 💗
Register Login