diff options
author | Jesusaves <cpntb1@ymail.com> | 2021-04-09 11:00:49 -0300 |
---|---|---|
committer | Jesusaves <cpntb1@ymail.com> | 2021-04-09 11:00:49 -0300 |
commit | 8a4bf716002a017de77fe7df301ef8e4aaf00a2e (patch) | |
tree | 4947d0b015baad639fa07133369e9a09c8a468bc /npc/commands/resync.txt | |
download | serverdata-8a4bf716002a017de77fe7df301ef8e4aaf00a2e.tar.gz serverdata-8a4bf716002a017de77fe7df301ef8e4aaf00a2e.tar.bz2 serverdata-8a4bf716002a017de77fe7df301ef8e4aaf00a2e.tar.xz serverdata-8a4bf716002a017de77fe7df301ef8e4aaf00a2e.zip |
Initial commit
Diffstat (limited to 'npc/commands/resync.txt')
-rw-r--r-- | npc/commands/resync.txt | 40 |
1 files changed, 40 insertions, 0 deletions
diff --git a/npc/commands/resync.txt b/npc/commands/resync.txt new file mode 100644 index 00000000..a535a343 --- /dev/null +++ b/npc/commands/resync.txt @@ -0,0 +1,40 @@ +// Evol 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 + +- script @resync 32767,{ + end; + +// Soft Resync +OnCall: + // Sliding a dead player have undesired side effects + if (ispcdead()) { + dispbottom l("Impossible to resync: You are dead."); + end; + } + // I add a small delay in case slide() trigger some invincibility timer or something + if (@rsync_delay > gettimetick(2)) { + dispbottom l("Not resync'ing to prevent flood."); + end; + } + + // This is a hack + getmapxy(.@m$, .@x, .@y, 0); + slide .@x, .@y; + @rsync_delay=gettimetick(2)+rand(4,6); + + // Uncomment this line to cause server to resend every packet to ManaPlus + // and get rid of latency effect (like dead mobs still being shown) + //atcommand("@refresh"); + end; + +// Anyone can call @resync, but only support and upwards for other players. +// ie. GMs can try to fix lag for other people. +OnInit: + bindatcmd "resync", "@resync::OnCall", 0, 20, 0; + end; +} |