View Single Post
  #7  
Old 04-08-2018, 10:44 PM
Kingly_Krab
Administrator
 
Join Date: May 2013
Location: United States
Posts: 1,589
Default

Not sure if this will fix the issue, but the EVENT_POPUPRESPONSE was using $client->GetItemIDAt(30) to get the cursor item id instead of just using $client->GetItemAt(30) to see if there was no item. The change I made was to the $empty variable the conditional used for $empty.
Code:
sub EVENT_POPUPRESPONSE {
	if($popupid == 10002) {
		ITEMLIST(); #Load itemlist
		my $empty = $client->GetItemAt(30);
		my $total = $client->GetAAPoints();	
		my $BUY = $client->GetEntityVariable("BUYID");		
		if(!$IL{$BUY}[0]) {
			$client->Message(13, "Invalid buy request!");
			return;
		}
		my $cost = int($IL{$BUY}[1]);
		my $createitem = $IL{$BUY}[0];
		my $itemlink = quest::varlink($IL{$BUY}[0]);
		my $stack = int($IL{$BUY}[4]);
		if(!$empty) {
			if($total >= $cost) {
				$total = int($total-$cost);     
				$client->SetAAPoints($total); 
				quest::summonitem($createitem,$stack);  
				$client->Message(315, "You now have $total AA points to spend.");
			} else {
				plugin::Whisper("You need more AA points for $itemlink.");  #Player did not have enough AA
			}
		} else {
			plugin::Whisper("You are holding an item please put it in your bags before you buy something."); #Player is holding an item already
		}
	}
}
Reply With Quote