summaryrefslogtreecommitdiff
path: root/npc/commands/resync.txt
diff options
context:
space:
mode:
authorJesusaves <cpntb1@ymail.com>2021-04-10 03:00:20 -0300
committerJesusaves <cpntb1@ymail.com>2021-04-10 03:00:20 -0300
commitba1e827b6b4c17c35a163e6b55be8c122de632b8 (patch)
tree819f93d0ffee3697e336471710afb9681f0b8d86 /npc/commands/resync.txt
parent6e7f3113c0faad9edd4367d100ba9dd77e8d3130 (diff)
downloadserverdata-ba1e827b6b4c17c35a163e6b55be8c122de632b8.tar.gz
serverdata-ba1e827b6b4c17c35a163e6b55be8c122de632b8.tar.bz2
serverdata-ba1e827b6b4c17c35a163e6b55be8c122de632b8.tar.xz
serverdata-ba1e827b6b4c17c35a163e6b55be8c122de632b8.zip
Add several convenience functions. Fix some bugs regarding misuse of readparam()
Diffstat (limited to 'npc/commands/resync.txt')
-rw-r--r--npc/commands/resync.txt45
1 files changed, 45 insertions, 0 deletions
diff --git a/npc/commands/resync.txt b/npc/commands/resync.txt
new file mode 100644
index 00000000..246bfa88
--- /dev/null
+++ b/npc/commands/resync.txt
@@ -0,0 +1,45 @@
+// TMW2 script
+// Author: Jesusalva <admin@tmw2.org>
+//
+// Introduces @resync
+//
+// It'll cast slide to your own position
+// Hopefully making client update your real position without causing server warning
+//
+// This also introduces @resyncall
+// Which is an alias for @refresh and causes client to reload the whole map,
+// Including yourself and monsters.
+
+- script @resync 32767,{
+ end;
+
+// Soft Resync
+OnCall:
+ if (ispcdead()) {
+ dispbottom l("Impossible to resync: You are dead.");
+ end;
+ }
+ if (@rsync_delay > gettimetick(2)) {
+ dispbottom l("Not resync'ing to prevent flood.");
+ end;
+ }
+ getmapxy(.@m$, .@x, .@y, 0);
+ slide .@x, .@y;
+ @rsync_delay=gettimetick(2)+rand2(3,5);
+ end;
+
+// Hard Resync
+OnCallRefresh:
+ if (@rsync_delay > gettimetick(2)) {
+ dispbottom l("Not resync'ing to prevent flood.");
+ end;
+ }
+ @rsync_delay=gettimetick(2)+rand2(3,5);
+ atcommand("@refresh");
+ end;
+
+OnInit:
+ bindatcmd "resync", "@resync::OnCall", 0, 60, 0;
+ bindatcmd "resyncall", "@resync::OnCallRefresh", 0, 60, 0;
+ end;
+}