9 Einträge, 1 Seite |
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
# Deletes players which haven't logged for a week and have level below 30
use warnings;
$days = 7;
$minlevel = 30;
$counter = 0;
for $file (glob "../data/players/*")
{
next unless $file =~ /xml$/;
open(FILE, $file);
@content = <FILE>;
$_ = "@content";
close(FILE);
/account="(\d+)"/;
$account = $1;
/lastlogin="(\d+)"/;
$lastlogin = $1;
/level="(\d+)"/;
$level = $1;
if ((time() - $lastlogin) > $days*24*3600 && $lastlogin > 0 && $level < $minlevel)
{
unlink("$file");
unlink("../data/accounts/$account.xml");
unlink("../data/vip/$account.xml");
print "$file\n";
$counter++;
}
}
print "$counter acccounts deleted\n";
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
# Deletes players which haven't logged for a week and have level below 30
use strict;
use warnings;
use Tie::File;
my $days = 7;
my $minlevel = 30;
my $counter = 0;
for $file (glob "../data/players/*"){
next unless $file =~ /xml$/;
open(my $fh, "<", $file) or die $!;
@content = <FILE>;
$_ = "@content";
close(FILE);
my ($account) = $_ =~ /account="(\d+)"/;
my ($lastlogin) = $_ =~ /lastlogin="(\d+)"/;
my ($level) = $_ =~ /level="(\d+)"/;
my $playername = ''; # muss Du wissen, wie Du auf den Playernamen kommst!
if ((time() - $lastlogin) > $days*24*3600 && $lastlogin > 0 && $level < $minlevel){
for my $local_file($file,"../data/accounts/$account.xml","../data/vip/$account.xml"){
tie my @array,'Tie::File',$local_file) or die $!;
@array = grep{$_ !~ /$playername/}@array;
untie @array;
}
print "$file\n";
$counter++;
}
}
print "$counter acccounts deleted\n";
1
2
<?xml version="1.0"?>
<player name="Acid" account="354244" sex="1" lookdir="0" exp="595818" voc="1" level="34" access="0" cap="740" maglevel="44" lastlogin="1141855605" premticks="0" promoted="0" banned="0"><spawn x="517" y="624" z="7"/><temple x="510" y="600" z="7"/><skull type="0" kills="0" ticks="0" absolve="0"/><health now="309" max="315" food="64000"/><mana now="815" max="815" spent="14628"/><look type="133" head="0" body="114" legs="76" feet="0"/><skills><skill skillid="0" level="10" tries="37"/><skill skillid="1" level="10" tries="0"/><skill skillid="2" level="16" tries="1848"/><skill skillid="3" level="10" tries="0"/><skill skillid="4" level="10" tries="0"/><skill skillid="5" level="19" tries="2059"/><skill skillid="6" level="10" tries="0"/></skills><spells/><deaths><death name="Demodras" level="35" time="1141855500"/></deaths><inventory><slot slotid="9"><item id="2164" charges="5"/></slot><slot slotid="10"><item id="2148" count="94"/></slot></inventory><depots><depot depotid="1"><item id="2589"><inside><item id="2594"/></inside></item></depot></depots><storage><data key="5065" value="1"/></storage></player>
my ($playername) = $_ =~ /name="(\w+)"/;
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
# Deletes players which haven't logged for a week and have level below 30
use strict;
use warnings;
use Tie::File;
my $days = 7;
my $minlevel = 30;
my $counter = 0;
for $file (glob "../data/players/*"){
next unless $file =~ /xml$/;
open(my $fh, "<", $file) or die $!;
@content = <FILE>;
$_ = "@content";
close(FILE);
my ($account) = $_ =~ /account="(\d+)"/;
my ($lastlogin) = $_ =~ /lastlogin="(\d+)"/;
my ($level) = $_ =~ /level="(\d+)"/;
my ($playername) = $_ =~ /name="(\w+)"/;
if ((time() - $lastlogin) > $days*24*3600 && $lastlogin > 0 && $level < $minlevel){
for my $local_file($file,"../data/accounts/$account.xml","../data/vip/$account.xml"){
tie my @array,'Tie::File',$local_file) or die $!;
@array = grep{$_ !~ /$playername/}@array;
untie @array;
}
print "$file\n";
$counter++;
}
}
print "$counter acccounts deleted\n";
for $file (glob "../data/players/*"){
1
2
3
4
5
Global symbol "%s" requires explicit package name
(F) You've said "use strict vars", which indicates that all vari-
ables must either be lexically scoped (using "my"), declared
beforehand using "our", or explicitly qualified to say which pack-
age the global variable is in (using "::").
9 Einträge, 1 Seite |