yusufemirxd

Bir Kömür Göründü Kaptanım!
Katılım
15 Nisan 2020
Mesajlar
106
En iyi cevaplar
0
Elmaslar
27
Discord
Yusuf Emir#3303
Minecraft
yusufemird
Kod:
var day = "&agün&a";
var hour = "&asaat&a";
var minute = "&adakika&a";
var second = "&asaniye&a";

function leapyear(year) {
  return year % 100 === 0 ? year % 400 === 0 : year % 4 === 0;
}

function getdays(date){
    date = new Date(date);
    var month = date.getMonth()+1;
    if(month == 1) return 31;
    if(month == 2 && leapyear(date.getYear())) return 29;
    if(month == 2 && !leapyear(date.getYear())) return 28;
    if(month == 3) return 31;
    if(month == 4) return 30;
    if(month == 5) return 31;
    if(month == 6) return 30;
    if(month == 7) return 31;
    if(month == 8) return 31;
    if(month == 9) return 30;
    if(month == 10) return 31;
    if(month == 11) return 30;
    if(month == 12) return 31;
}
function givestr(count,islv){
    if(count > 0 || true) return count+" "+islv+" ";
    else return "";
}
function kalan(ms){
    var days = Math.floor(ms / (24*60*60*1000));
    var daysms = ms % (24*60*60*1000);
    var hours = Math.floor((daysms)/(60*60*1000));
    var hoursms = ms % (60*60*1000);
    var minutes = Math.floor((hoursms)/(60*1000));
    var minutesms = ms % (60*1000);
    var seconds = Math.floor((minutesms)/(1000));
    return givestr(days,day)+givestr(hours,hour)+givestr(minutes,minute)+givestr(seconds,second);
}
function countdown() {
    var dt = new Date(Date.now());
    var edt = new Date(Date.now());
    edt.setDate(getdays(dt));
    edt.setHours(23);
    edt.setMinutes(59);
    edt.setSeconds(59);
    edt.setMilliseconds(999);
    return kalan(Date.parse(edt) - Date.parse(dt));
}
countdown();
arkadaşlar bu default hali hologram set edince 1 gün gösteriyor nasıl 90 gün yaparız
 

linelex

Fırında Isıttığım İlk Taş
Katılım
29 Aralık 2017
Mesajlar
78
En iyi cevaplar
1
Elmaslar
28
Discord
Bertan#5193
kanka bu javascript "aya"(ocak,şubat) bağlıdır, o yüzden 1 günü gösteriyor. Senin istediğin ise countdown onu da şöyle yapabilirsin;

JavaScript:
var monthSymbol = "mo";
var daySymbol = "d";
var hourSymbol = "h";
var minuteSymbol = "m";
var secondSymbol = "s";

var arg = args[0].split("_");
if (arg.length === 2) {
    var ID = arg[0];
    var cooldown = arg[1];
}

var dataLoc = "%player_name%." + ID + ".date";
var currentDate = new Date();

function Cooldown() {
    if (!Data.exists(dataLoc)) {
        return "0s";
    } else {
        var startDate = new Date(Data.get(dataLoc));
        var difference = currentDate - startDate;
        var result = Math.floor(difference / 1000);
        if (result >= cooldown) {
            return "0s";
        } else {
            startDate = new Date(startDate.getTime() + (cooldown * 1000));
            var result = startDate - currentDate;

            var months = Math.floor(result / (1000 * 60 * 60 * 24 * 31));
            var days = Math.floor(result % (1000 * 60 * 60 * 24 * 31) / (1000 * 60 * 60 * 24));
                var hours   = Math.floor(result % (1000 * 60 * 60 * 24) / (1000 * 60 * 60));
              var minutes = Math.floor(result % (1000 * 60 * 60) / (1000 * 60));
            var seconds = Math.floor(result % (1000 * 60) / (1000));

            if (months === 0 && days === 0 && hours === 0 && minutes === 0) {
                return seconds + secondSymbol;
            } else if (months === 0 && days === 0 && hours === 0) {
                return minutes + minuteSymbol + seconds + secondSymbol;
            } else if (months === 0 && days === 0) {
                return hours + hourSymbol + minutes + minuteSymbol + seconds + secondSymbol;
            } else if (months === 0) {
                return days + daySymbol + hours + hourSymbol + minutes + minuteSymbol + seconds + secondSymbol;
            } else {
                return months + monthSymbol + days + daySymbol + hours + hourSymbol + minutes + minuteSymbol + seconds + secondSymbol;
            }
        }
    }
}

function start() {
    var data = currentDate.toString();

    Data.set(dataLoc, data);
    Placeholder.saveData();
}

function resetCooldown() {
    if(Data.exists(dataLoc)){
        Data.remove(dataLoc);
    }
    Placeholder.saveData();
}

function run() {
    if (args.length !== 1 || arg.length !== 2) {
        return "&cInvalid syntax, Please use this syntax:\n&7%" + "javascript_cooldown_[ID]_[Cooldown/Start]" + "%";
    } else if (cooldown.toUpperCase() === "START") {
        return start();
    } else if (cooldown.toUpperCase() === "RESET") {
        return resetCooldown();
    } else if (isNaN(cooldown)) {
        return "&cPlease set a valid cooldown.";
    } else if (!isNaN(cooldown)) {
        return Cooldown();
    } else {
        return "&cInvalid syntax, Please use this syntax:\n&7%" + "javascript_cooldown_[ID]_[Cooldown/Start]" + "%";
    }
}
run();
Edit: Sorununun cevabı altta bulunuyor

JavaScript:
var day = "&agün&a";
var hour = "&asaat&a";
var minute = "&adakika&a";
var second = "&asaniye&a";

function leapyear(year) {
  return year % 100 === 0 ? year % 400 === 0 : year % 4 === 0;
}

function getdays(date){
    date = new Date(date);
    var month = date.getMonth()+3;
    if(month == 1) return 31;
    if(month == 2 && leapyear(date.getYear())) return 29;
    if(month == 2 && !leapyear(date.getYear())) return 28;
    if(month == 3) return 31;
    if(month == 4) return 30;
    if(month == 5) return 31;
    if(month == 6) return 30;
    if(month == 7) return 31;
    if(month == 8) return 31;
    if(month == 9) return 30;
    if(month == 10) return 31;
    if(month == 11) return 30;
    if(month == 12) return 31;
}
function givestr(count,islv){
    if(count > 0 || true) return count+" "+islv+" ";
    else return "";
}
function kalan(ms){
    var days = Math.floor(ms / (24*60*60*1000));
    var daysms = ms % (24*60*60*1000);
    var hours = Math.floor((daysms)/(60*60*1000));
    var hoursms = ms % (60*60*1000);
    var minutes = Math.floor((hoursms)/(60*1000));
    var minutesms = ms % (60*1000);
    var seconds = Math.floor((minutesms)/(1000));
    return givestr(days,day)+givestr(hours,hour)+givestr(minutes,minute)+givestr(seconds,second);
}
function countdown() {
    var dt = new Date(Date.now());
    var edt = new Date(Date.now());
    edt.setDate(getdays(dt));
    edt.setHours(23);
    edt.setMinutes(59);
    edt.setSeconds(59);
    edt.setMilliseconds(999);
    return kalan(Date.parse(edt) - Date.parse(dt));
}
countdown();
 
Son düzenleme:
Yukarı Alt