Skip to content

Instantly share code, notes, and snippets.

@CansecoDev
Created July 29, 2015 14:13
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save CansecoDev/69c53e28b208645fd0aa to your computer and use it in GitHub Desktop.
Save CansecoDev/69c53e28b208645fd0aa to your computer and use it in GitHub Desktop.
TShock JIST script made to work in combination with STime to set real time.
function setSTime(t) {
tshock_exec(tshock_server(), "/stime " + t);
}
function addZero(i) {
if (i < 10) {
i = "0" + i;
}
return i;
}
function getRealtime() {
var d = new Date();
var h = addZero(d.getHours());
var m = addZero(d.getMinutes());
var t = h + ":" + m;
return t;
}
jist_task_queue(0, 0, 1, function() {
var xt = getRealtime();
setSTime(xt);
}
);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment