1 |
pippijn |
1.1 |
#! perl |
2 |
|
|
cf::register_command tell => 0, sub |
3 |
|
|
{ |
4 |
|
|
my ($who, $args) = @_; |
5 |
|
|
my ($target, $msg) = split /\s+/, $args, 2; |
6 |
|
|
|
7 |
|
|
my $name = $who->name; |
8 |
|
|
|
9 |
|
|
if (my $other = cf::player::find $target) |
10 |
|
|
{ |
11 |
|
|
if ($other->ob->{ext_ignore_tell}{$name} < time) { |
12 |
|
|
delete $other->ob->{ext_ignore_tell}{$name}; |
13 |
|
|
} |
14 |
|
|
if ($target ne $name and !$other->ob->{ext_ignore_tell}{$name}) { |
15 |
|
|
$who->message ("You tell $target: $msg"); |
16 |
|
|
$other->ob->message ("$name tells you: $msg"); |
17 |
pippijn |
1.2 |
$other->ob->{ext_last_tell} = $name; |
18 |
pippijn |
1.1 |
} elsif ($target eq $name) { |
19 |
|
|
$who->message ("You are talking to yourself, you freak!", cf::NDI_UNIQUE); |
20 |
|
|
} else { |
21 |
|
|
$who->message ($other->ob->name." ignores what you say. Give up on it.", cf::NDI_UNIQUE); |
22 |
|
|
} |
23 |
|
|
} |
24 |
|
|
else |
25 |
|
|
{ |
26 |
pippijn |
1.2 |
$who->message ("No such player or ambiguous name. Your message: ".$msg, |
27 |
pippijn |
1.1 |
cf::NDI_UNIQUE); |
28 |
|
|
} |
29 |
pippijn |
1.2 |
}; |
30 |
|
|
|
31 |
|
|
cf::register_command reply => 0, sub |
32 |
|
|
{ |
33 |
pippijn |
1.3 |
my ($who, $args) = @_; |
34 |
pippijn |
1.2 |
my $name = $who->name; |
35 |
|
|
|
36 |
|
|
if (my $other = cf::player::find $who->{ext_last_tell}) |
37 |
|
|
{ |
38 |
|
|
if ($other->ob->{ext_ignore_tell}{$name} < time) { |
39 |
|
|
delete $other->ob->{ext_ignore_tell}{$name}; |
40 |
|
|
} |
41 |
|
|
if (!$other->ob->{ext_ignore_tell}{$name}) { |
42 |
pippijn |
1.3 |
$who->message ("You tell ".$other->ob->name.": $args"); |
43 |
|
|
$other->ob->message ("$name tells you: $args"); |
44 |
pippijn |
1.2 |
$who->{ext_last_tell} = $other->ob->name; |
45 |
|
|
} else { |
46 |
|
|
$who->message ($other->ob->name." ignores what you say. Give up on it.", cf::NDI_UNIQUE); |
47 |
|
|
} |
48 |
|
|
} |
49 |
|
|
else |
50 |
|
|
{ |
51 |
pippijn |
1.3 |
$who->message ("Can't reply, player left. Your message: ".$args, |
52 |
pippijn |
1.2 |
cf::NDI_UNIQUE); |
53 |
|
|
} |
54 |
|
|
}; |