summaryrefslogtreecommitdiff
path: root/npc/commands/ipcheck.txt
blob: ea82bb760180fc5e8cfdd01dcf9599f86dc7a716 (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
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
// TMW2 script
// Author: Jesusalva <admin@tmw2.org>
//
// @ipcheck <player_name>
// #ipcheck <player_name>
//
// Returns user IP


-	script	@ipcheck	32767,{
    end;

OnCall:
    if (.@atcmd_numparameters == 0)
    	.@request$ = strcharinfo(0);
    else
    	.@request$ = implode(.@atcmd_parameters$, " ");
    dispbottom strip(.@request$)+": IP "+getcharip(.@request$);
    //dispbottom strcharinfo(0)+": IP "+getcharip(.@request$);
    end;

OnBan:
    if (.@atcmd_numparameters == 0) {
    	dispbottom col("Syntax: #ipban <reason>", 1);
    }
    // Do not allow banning high-level staff
    if (is_admin() || is_gm())
        end;
    .@target$=strcharinfo(0);
	.@reason$ = implode(.@atcmd_parameters$, " ");
    dispbottom col(l("You were permanently banned by the GM Team."), 1);
    sleep2(200);
    // FIXME: Maybe not until "2037", but just a month or a year?
    // IP Ban is less reliable than @block
    query_sql "INSERT INTO ipbanlist (list,btime,rtime,reason) VALUES ('"+getcharip(.@target$)+"','"+gettime(7)+"-"+gettime(6)+"-"+gettime(5)+" "+gettime(3)+":"+gettime(2)+":"+gettime(1)+"','2037-01-01 00:00:00','"+.@reason$+"')";
    logmes("was IP-Blocked, and will not connect again."), LOGMES_ATCOMMAND;
    sleep2(2000);
    charcommand("@kick "+.@target$);
    end;

OnInit:
    bindatcmd "ipcheck", "@ipcheck::OnCall", 60, 100, 0;
    bindatcmd "ipban", "@ipcheck::OnBan", 99, 99, 1;
    end;
}

// TMW2 script
// Author: Jesusalva <admin@tmw2.org>
//
// @checkidle <player_name>
// #checkidle <player_name>
//
// Returns user idle time in seconds.
// Useful when the game prohibits warping to player.


-	script	@checkidle	32767,{
    end;

OnCall:
    if (.@atcmd_numparameters == 0)
    	.@request$ = strcharinfo(0);
    else
    	.@request$ = implode(.@atcmd_parameters$, " ");
    dispbottom strip(.@request$)+" idle time: "+checkidle(.@request$);
    //dispbottom strcharinfo(0)+": IP "+getcharip(.@request$);
    end;

OnInit:
    bindatcmd "checkidle", "@checkidle::OnCall", 60, 80, 0;
    end;
}