summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJesusaves <cpntb1@ymail.com>2023-12-14 19:51:25 -0300
committerJesusaves <cpntb1@ymail.com>2023-12-14 19:51:25 -0300
commit2f60556bc30b6e56c678fe4d2f07a136e83167a2 (patch)
tree3878c4975caf991c84b32d61925abad552866631
parent06efab83869493d555a70297bacb275c83608603 (diff)
downloadserverdata-2f60556bc30b6e56c678fe4d2f07a136e83167a2.tar.gz
serverdata-2f60556bc30b6e56c678fe4d2f07a136e83167a2.tar.bz2
serverdata-2f60556bc30b6e56c678fe4d2f07a136e83167a2.tar.xz
serverdata-2f60556bc30b6e56c678fe4d2f07a136e83167a2.zip
legendaryTimeCheck -> Change scope from local to global function.
It might be useful later.
-rw-r--r--npc/commands/grantpower.txt18
-rw-r--r--npc/functions/time.txt18
2 files changed, 18 insertions, 18 deletions
diff --git a/npc/commands/grantpower.txt b/npc/commands/grantpower.txt
index 1762bdd5d..88541d21f 100644
--- a/npc/commands/grantpower.txt
+++ b/npc/commands/grantpower.txt
@@ -97,24 +97,6 @@ function legendaryRodexWarning {
return;
}
-function legendaryTimeCheck {
- .@min = getarg(1)-86400;
- .@max = getarg(1)+86400;
- // getarg(0) is last_login, and getarg(1) the tolerance
- // if last_login < tolerance (older), then ban
- // But we don't want this to repeat.
- // Tolerance: day 10 -> min = 10-1=9; max=10+1=11
- // Day 8: (8 < 11? yes; 8 > 9? no)
- // Day 9: (9 < 11? yes; 9 > 9? no)
- // Day 10: (10 < 11? yes; 10 > 9? yes) -> Message sent
- // Day 11: (11 < 11? no; 11 > 9? yes)
- // Day 12: (12 < 11? no; 12 > 9? yes)
- if (getarg(0) < .@max && getarg(0) > .@min)
- return true;
- else
- return false;
-}
-
OnClock0238:
.@date=gettimetick(2);
.@warn=.@date-(86400*2);
diff --git a/npc/functions/time.txt b/npc/functions/time.txt
index e6e4c70a7..192c6c9ab 100644
--- a/npc/functions/time.txt
+++ b/npc/functions/time.txt
@@ -31,6 +31,24 @@ function script time_from_days {
return now() + (getarg(0) * 86400);
}
+// legendaryTimeCheck(current_date, target_date)
+function script legendaryTimeCheck {
+ .@min = getarg(1)-86400;
+ .@max = getarg(1)+86400;
+ // getarg(0) is last_login, and getarg(1) the tolerance
+ // if last_login < tolerance (older), then ban
+ // But we don't want this to repeat.
+ // Tolerance: day 10 -> min = 10-1=9; max=10+1=11
+ // Day 8: (8 < 11? yes; 8 > 9? no)
+ // Day 9: (9 < 11? yes; 9 > 9? no)
+ // Day 10: (10 < 11? yes; 10 > 9? yes) -> Message sent
+ // Day 11: (11 < 11? no; 11 > 9? yes)
+ // Day 12: (12 < 11? no; 12 > 9? yes)
+ if (getarg(0) < .@max && getarg(0) > .@min)
+ return true;
+ else
+ return false;
+}
// FuzzyTime(<unix timestamp>{, <options>{, <precision>}})
// gives time in a human-readable format