View Single Post
  #6  
Old 06-15-2013, 12:52 AM
NatedogEZ's Avatar
NatedogEZ
Developer
 
Join Date: Dec 2012
Posts: 515
Default

Fixed heh
Code:
sub EVENT_ENTERZONE {
	quest::setglobal("PvPState",$client->GetPVP(),5,"F");  #Adds their PVPstate to gloabl
	$client->SetPVP(1);
}

sub EVENT_ZONE {
	if(defined $qglobals{"PvPState"} && $qglobals{"PvPState"}==1)   
	{
		$client->SetPVP(1);   #Player was already PVP before entering zone will remain PVP on zone out
	}
	else
	{
		$client->SetPVP(0);  #This player was not PVP flagged when zoning in
	}

}


Here is the code I use for a PVP zone...

Limits the zone to a single character in the zone per IP

Requires that the zone is STATIC though

Code:
sub EVENT_ENTERZONE {
	my $playerip = $client->GetIP();
	@pvplist;
	if ( grep { $_ eq $playerip } @pvplist )
	{
		
		$client->Message(315,"YOU MAY ONLY HAVE ONE CHARACTER IN THIS ZONE!");
		push(@pvplist, "$playerip");
		$client->MovePC(348, 1.8, 1.6, -22.8, 187);
		return;
	}
	push(@pvplist, "$playerip");
	$client->SetPVP(1);
}

sub EVENT_ZONE {
	my $playerip = $client->GetIP();
	my $count = 0;
	foreach $pvp_player (@pvplist) 
	{
	next unless $pvp_player = $playerip;
	$count++;
	}

	if ($count >= 2)
	{
		@pvplist = grep {$_ ne $playerip} @pvplist;
		push(@pvplist, "$playerip");  #Add the IP back to list since there are 2 of the same IP
	}
	else
	{
		@pvplist = grep {$_ ne $playerip} @pvplist;
	}
	$client->SetPVP(0);
}

sub EVENT_DISCONNECT {
	my $playerip = $client->GetIP();
	my $count = 0;
	foreach $pvp_player (@pvplist) 
	{
	next unless $pvp_player = $playerip;
	$count++;
	}

	if ($count >= 2)
	{
		@pvplist = grep {$_ ne $playerip} @pvplist;
		push(@pvplist, "$playerip");  #Add the IP back to list since there are 2 of the same IP
	}
	else
	{
		@pvplist = grep {$_ ne $playerip} @pvplist;
	}
}
Reply With Quote