[Idle/Unsolved]PKtele plugin ; syntax error

All about the macro plugin can be found in this forum. This forum is intended for the macro plugin only.

Moderator: Moderators

Message
Author
akson012
Noob
Noob
Posts: 2
Joined: 06 May 2011, 22:43
Noob?: Yes

[Idle/Unsolved]PKtele plugin ; syntax error

#1 Post by akson012 »

i used to resolved the problem by my own but i can't find any ways to resolve it.

so anyone does have new pk tele plugins?

here's my old pk tele

Code: Select all

package PKTele;
 
use strict;
 
use Time::HiRes qw(time);
use Globals;
use Plugins;
use Utils;
use Network::Send;
use Log qw(debug message warning error);
 
Plugins::register('PKTele', 'teleport from PK', \&onUnload);
 
 
my $hooks = Plugins::addHooks(
            ['is_casting', \&hookAvoidSkill, undef],
            ['packet_skilluse', \&hookAvoidSkill, undef],
            ['parseMsg/pre', \&hookAttack, undef]
);
 
sub onUnload {
	Plugins::delHooks($hooks);
}
 
sub hookAvoidSkill {
	return if ($char->{lv} < 51);
 
	my $hookName = shift;
	my $args = shift;
	my $sourceID = $args->{sourceID};
	my $targetID = $args->{targetID};
	my $skillID = $args->{skillID};
	if ($targetID eq $accountID &&
		$sourceID ne $accountID &&
		$players{$sourceID}) {
 
		my $skill = new Skills(id => $skillID);
		if (!existsInList($config{pkTele_exceptions},$skill->name)) {
			main::useTeleport(1);
		}
	}
}
 
sub hookAttack {
	return if ($char->{lv} < 51);
 
	my $hookName = shift;
	my $args = shift;
	my $switch = $args->{switch};
	my $msg = $args->{msg};
 
	if ($switch eq "008A") {
		# Attack
		my ($ID1, $ID2, $tick, $src_speed, $dst_speed, $damage, $param2, $type, $param3) = unpack("x2 a4 a4 a4 L1 L1 s1 S1 C1 S1", $msg);
 
		if ($type == 1) {
			# Take item
		} elsif ($type == 2) {
			# Sit
		} elsif ($type == 3) {
			# Stand
		} else {
			# Attack
			if ($ID2 eq $accountID &&
				!$monsters{$ID1}) {
				main::useTeleport(1);
			}
		}
	}
}
 
return 1;
Image

the syntax error! thanks for helping me :D

EternalHarvest
Developers
Developers
Posts: 1798
Joined: 05 Dec 2008, 05:42
Noob?: Yes

Re: plugins new pk tele

#2 Post by EternalHarvest »

akson012 wrote:

Code: Select all

['parseMsg/pre', \&hookAttack, undef]
...
return if ($char->{lv} < 51);
You're autovivifying $char there.
Insert "return unless $char;" before that level check.

akson012
Noob
Noob
Posts: 2
Joined: 06 May 2011, 22:43
Noob?: Yes

Re: plugins new pk tele

#3 Post by akson012 »

can you send the config? still not working. :(

Post Reply