Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- var player = GetPlayer();
- var totalMinutes = player.GetVar("SlTimer");
- var totalTimeInSeconds = totalMinutes * 60;
- if (typeof window.timerInterval === 'undefined') {
- function startCountdown() {
- window.timerInterval = setInterval(function() {
- var minutes = Math.floor(totalTimeInSeconds / 60);
- var seconds = totalTimeInSeconds % 60;
- var formattedMinutes = minutes < 10 ? "0" + minutes : minutes;
- var formattedSeconds = seconds < 10 ? "0" + seconds : seconds;
- player.SetVar("TimerCount", formattedMinutes + ":" + formattedSeconds);
- totalTimeInSeconds--;
- if (totalTimeInSeconds < 0) {
- clearInterval(window.timerInterval);
- delete window.timerInterval;
- player.SetVar("TimerEnable",false)
- }
- }, 1000);
- }
- startCountdown();
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement