Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #Test.pm
- package Test;
- use POE;
- use plugin;
- our $plugin_name;
- our %config;
- our %additional_events =
- (
- "spectatespeed" => "spectatespeed",
- "sspeed" => "sspeed"
- );
- #Initialize the plugin
- sub start
- {
- my ( $session, $heap, $args ) = @_[ SESSION, HEAP, ARG0 ];
- my $kernel = $_[KERNEL];
- }
- sub stop
- {
- my ( $session, $heap, $args ) = @_[ SESSION, HEAP, ARG0 ];
- my $kernel = $_[KERNEL];
- }
- sub spectatespeed
- {
- my ( $kernel, $session, $heap, $args ) = @_[ KERNEL, SESSION, HEAP, ARG0 ];
- my %args = %{$args};
- my $commanduser = $args{'nick'};
- my $nicktype = $args{nicktype};
- if ($nicktype == 1)
- {
- plugin::ircmsg ( "This Command can only be used in game.", $args{'ircChannelCode'} );
- return;
- }
- if ( $args{arg1} && $args{arg2} )
- {
- my $sspeed = $args{arg2};
- my ( $result, %player ) = plugin::getPlayerData ( $commanduser );
- if ( $result == 1 )
- {
- plugin::RenRemCMD ("spectatespeed $player{id} $sspeed" );
- }
- }
- }
- sub sspeed
- {
- my ( $kernel, $session, $heap, $args ) = @_[ KERNEL, SESSION, HEAP, ARG0 ];
- my %args = %{$args};
- if ($args{nicktype} == 1) { plugin::ircmsg ( "This Command can only be used in game.", $args{'ircChannelCode'} ); return;}
- # !Command number
- if ( $args{arg} =~ m/^\!\S+\s(\d+)$/i )
- {
- my $speed = $1;
- my ( $result, %player ) = playerData::getPlayerData ( $args{nick} );
- if ( $result == 1 )
- {
- if ( $speed >= 101 )
- {
- sendmsg("Invalid speed use 1 - 100", $args{nicktype}, $args{'ircChannelCode'}, $args{nick} );
- return;
- }
- else
- {
- plugin::RenRemCMD ( "spectatespeed $player{id} $speed" );
- }
- }
- }
- else
- {
- my $syntaxvalue = $args{settings}->{syntax}->{value};
- sendmsg("Usage: $syntaxvalue", $args{nicktype}, $args{'ircChannelCode'}, $args{nick} );
- }
- }
- sub sendmsg
- {
- my ( $msg, $nicktype, $chantype, $username ) = @_;
- if ($nicktype == 1)
- {
- plugin::ircmsg ($msg, $chantype );
- }
- else
- {
- my ( $result, %player ) = playerData::getPlayerData( $username );
- if ( $result == 1 )
- {
- plugin::pagePlayer ( $player{'id'}, "Brenbot", "$msg." );
- }
- }
- }
- sub command
- {
- my ( $kernel, $session, $heap, $args ) = @_[ KERNEL, SESSION, HEAP, ARG0 ];
- my %args = %{$args};
- if ( $args{command} eq "spectatespeed" )
- {
- $kernel->yield( "spectatespeed" => \%args );
- }
- elsif ( $args{command} eq "sspeed" )
- {
- $kernel->yield( "sspeed" => \%args );
- }
- }
- 1;
- #Test.xml
- <?xml version="1.0" ?>
- <plugin name="Test">
- <command name="spectatespeed">
- <permission level="1"/>
- <syntax value="!spectatespeed >PlayerID< >speed<"/>
- <help value="sets the player speed while in spectae mode Only for ingame."/>
- <enabled value="1"/>
- <hideInHelp value="0"/>
- <group>irc_admin</group>
- <group>ingame</group>
- <alias>spectatespeed</alias>
- </command>
- <command name="sspeed">
- <permission level="1"/>
- <syntax value="!sspeed >speed<"/>
- <help value="sets the player speed while in spectae mode Only for ingame."/>
- <enabled value="1"/>
- <hideInHelp value="0"/>
- <group>irc_admin</group>
- <group>ingame</group>
- </command>
- <events>
- <event>command</event>
- </events>
- <config>
- </config>
- <gamelog_regex_hooks>
- </gamelog_regex_hooks>
- <renlog_regex_hooks>
- </renlog_regex_hooks>
- </plugin>
Add Comment
Please, Sign In to add comment