Skip to content

Commit

Permalink
0.1.9
Browse files Browse the repository at this point in the history
  • Loading branch information
YetNT committed Apr 21, 2024
1 parent 35bc5f0 commit 98eac06
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 14 deletions.
2 changes: 1 addition & 1 deletion BP/manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
"version": [
0,
1,
8
9
]
},
"modules": [
Expand Down
31 changes: 18 additions & 13 deletions BP/scripts/funcs.ts
Original file line number Diff line number Diff line change
Expand Up @@ -78,19 +78,21 @@ function doevery(p: Player, msg: string) {

// Rest of doevery code, finally.

ints[name].num = system.runInterval(() => {
let count: number = 0;
try {
p.runCommand(executable)
} catch (err) {
count++
if (count > 5) {
delete ints[name]
error(p, `Task with the name (${name}) has failed more than 5 times. Execution has automatically been stopped and task has been cleared.`)
ints[name] = {
num: system.runInterval(() => {
let count: number = 0;
try {
p.runCommand(executable)
} catch (err) {
count++
if (count > 5) {
delete ints[name]
error(p, `Task with the name (${name}) has failed more than 5 times. Execution has automatically been stopped and task has been cleared.`)
}
}
}
}, secondsToTicks(time))
ints[name].exec = executable
}, secondsToTicks(time)),
exec: executable
}

r.c();

Expand All @@ -101,7 +103,10 @@ function doevery(p: Player, msg: string) {

function stopevery(p: Player, msg: string) {
const [, name] = msg.split(" ");
if (!(name in ints)) error(p, `Task with the name (${name}) does not exist.`);
if (!(name in ints)) {
error(p, `Task with the name (${name}) does not exist.`);
return;
}

delete ints[name];
p.sendMessage("Task has successfully been cleared!")
Expand Down

0 comments on commit 98eac06

Please sign in to comment.