summaryrefslogtreecommitdiff
path: root/npc/commands/resync.txt
blob: a535a34330ce1e94f0ed8298d73824e73733d479 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
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;
}