playerRecorder plugin
Moderator: Moderators
-
- Plain Yogurt
- Posts: 52
- Joined: 16 Jan 2011, 03:06
- Noob?: Yes
Re: playerRecorder plugin
thanks a lot sir KeplerBR
-
- Plain Yogurt
- Posts: 52
- Joined: 16 Jan 2011, 03:06
- Noob?: Yes
Re: playerRecorder plugin
Code: Select all
return if ((time - $nickListTime{$targetName}) < 1);
$nickListTime{$targetName} = time;
Re: playerRecorder plugin
Fixed
I also added the command inform, that displays the list of players and how long were seen
I also added the command inform, that displays the list of players and how long were seen
Code: Select all
package ExamplePlugin;
use strict;
use warnings;
use Plugins;
use Log qw(message);
use Globals;
use Settings;
use Actor;
Plugins::register('example', 'Example Plugin ', \&Unload, \&Reload);
Plugins::addHook('player_exist', \&Called, undef);
my $commandHangmanGame = Commands::register(
["inform", "Inform player list view", \&commandInform]
);
my %nickListTime;
sub Unload {
Plugins::addHook('charNameUpdate', \&Called);
}
sub Reload {
Plugins::addHook('charNameUpdate', \&Called);
}
sub Called {
my (undef, $args) = @_;
my $targetName = $args->{player}{name};
return if ($nickListTime{$targetName} && (time - $nickListTime{$targetName}) < 180);
$nickListTime{$targetName} = time;
Commands::run("p Player Seen: $targetName");
}
sub commandInform {
my $message;
for ( sort {$nickListTime{$b} <=> $nickListTime{$a}} keys %nickListTime) {
$message .= "* $_ - " . (time - $nickListTime{$_}) . "\n";
}
message $message;
}
return 1;
-
- Plain Yogurt
- Posts: 52
- Joined: 16 Jan 2011, 03:06
- Noob?: Yes
Re: playerRecorder plugin
Code: Select all
return if ($nickListTime{$targetName} && (time - $nickListTime{$targetName}) < 5);
i tried to adjust the time to see if its recording in every 5 seconds but still it records only for once and doe's not repeat it's process
Code: Select all
Plugins::addHook('player_exist', \&Called, undef);
It did only print for once just only when a newly logged bot and didn't record the players passing-by
Code: Select all
sub commandInform {
my $message;
for ( sort {$nickListTime{$b} <=> $nickListTime{$a}} keys %nickListTime) {
$message .= "* $_ - " . (time - $nickListTime{$_}) . "\n";
}
message $message;
}
The difference in these codes
Code: Select all
Plugins::addHook('player_exist', \&Called, undef);
Code: Select all
Plugins::addHook('charNameUpdate', \&Called, undef);
Re: playerRecorder plugin
Change
to
Regarding the hook, do not know what would be the ideal use.
Code: Select all
return if ($nickListTime{$targetName} && (time - $nickListTime{$targetName}) < 180)
Code: Select all
return if ((time - $nickListTime{$targetName}) < 180);
Enter the command inform in the consolegenuineopenkore wrote:how thus this code triggered sir?Code: Select all
sub commandInform { my $message; for ( sort {$nickListTime{$b} <=> $nickListTime{$a}} keys %nickListTime) { $message .= "* $_ - " . (time - $nickListTime{$_}) . "\n"; } message $message; }
-
- Plain Yogurt
- Posts: 52
- Joined: 16 Jan 2011, 03:06
- Noob?: Yes
Re: playerRecorder plugin
still works the same sirreturn if ((time - $nickListTime{$targetName}) < 180);
This is what it printed when i type "inform" in the console. but when i'm not visible on the bot and when i type again the inform it still print the same* PLAYERTEST - 34
-
- Plain Yogurt
- Posts: 52
- Joined: 16 Jan 2011, 03:06
- Noob?: Yes
Re: playerRecorder plugin
Code: Select all
return if ((time - $nickListTime{$targetName}) < 180);