snafu has asked for the wisdom of the Perl Monks concerning the following question:
my $funcName = (caller(0))[3]; my $player_name = shift; my $mapname = shift; (my $gamedir = &send(1,"sv_gamedir")) =~ s/.*: (.*)\n+/$1/; my $full_path = "$HOME/$gamedir/maps/$mapname.bsp"; # chdir("$HOME/$gamedir") or # die("Cannot chdir to $HOME/$gamedir: $!\n"); # chdir("maps") or # die("Cannot chdir to maps: $!\n"); # print "Current working directory: " . getcwd . "\n"; if ( -f $full_path ) { print STDERR "Map exists! -> $HOME/$gamedir/maps/$mapname.bsp\ +n"; &send(0,"say Player name: $player_name map: $mapname"); } else { print STDERR "Map does not exist! -> $HOME/$gamedir/maps/$mapn +ame.bsp\n"; &send(0,"say Requested vote for map $mapname denied: map does +not exist on this server"); }
----------
- Jim
|
|---|