Jump to content
  • 0

Need Help with this Script.


Question

Posted

Hi there, Can someone help me with this script. Its used to give items to online players, on the map you're on or everyone in the server.

But the thing is, I dont want @autotrade characters to get the items aswell. Some are using this style so they get more items even if they're not online. And I don't want that. Can someone please help? Thanks alot.

 

I tried adding checkvending() == 0 on some parts of the script, experimented on the codes but it doesn't work, it still gives vending characters the items

//===== eAthena Script ============================================
//= #itemall
//===== By: =======================================================
//= Originally by goddameit
//= redo by ~AnnieRuru~
//===== Current Version: ==========================================
//= 1.0
//===== Compatible With: ==========================================
//= eAthena 14910 Trunk TXT/SQL
//===== Description: ==============================================
//= give items to all players in the map, or on the server
//===== Topic =====================================================
//= http://www.eathena.ws/board/index.php?showtopic=276326
//===== Additional Comments: ======================================
//= topic splitted
//=================================================================
// npc:itemall
//map#<item ID>#<amount> if you want to give prices on your current map
//all#<item ID>#<amount> if you want to give prices on all of your players

-	script	itemall	-1,{
OnWhisperGlobal:
	if ( getgmlevel() < 99 ) end; // configure minimum GM level here
	if ( compare( @whispervar0$, "map" ) )
		set .@map$, strcharinfo(3);
	else if ( compare( @whispervar0$, "all" ) == 0 ) {
		dispbottom "[itemall] Please enter \"map#<item id>#<item amount>\" or \"all#<item id>#<item amount>\"";
		end;
	}
	set .@itemid, atoi( @whispervar1$ );
	set .@amount, atoi( @whispervar2$ );
	if ( getiteminfo( .@itemid, 0 ) == -1 ) {
		dispbottom "[itemall] Invalid item ID";
		end;
	}
	if ( .@amount == 0 )
		set .@amount, 1;
	set .@origin$, strcharinfo(0);
	while ( .@i < $online_count ) {
		attachrid getd("$online_aid"+ .@i );
		if ( .@map$ == "" || strcharinfo(3) == .@map$ ) {
			message strcharinfo(0), .@origin$ +" gives all players online in this map "+ .@amount +" "+ getitemname(.@itemid);
			getitem .@itemid, .@amount;
		}
		set .@i, .@i +1;
	}
	end;

OnPCLoginEvent:
	setd "$online_aid"+ $online_count, getcharid(3);
	set $online_count, $online_count +1;
	end;
OnPCLogoutEvent:
	while ( .@i < $online_count && getd("$online_aid"+ .@i ) != getcharid(3) )
		set .@i, .@i +1;
	if ( $online_count == .@i ) end; // prevent @loadnpc/@reloadscript bug becos not in the array
	while ( .@i < $online_count ) {
		setd "$online_aid"+ .@i, getd("$online_aid"+ ( .@i +1 ) );
		set .@i, .@i +1;
	}
	set $online_count, $online_count -1;
	end;
OnInit:
	if ( getusers(1) ) end;
	while ( .@i < $online_count ) {
		setd "$online_aid"+ .@i, 0;
		set .@i, .@i +1;
	}
	set $online_count, 0;
	end;
}

6 answers to this question

Recommended Posts

Posted


attachrid getd("$online_aid"+ .@i );

if ( ( .@map$ == "" || strcharinfo(3) == .@map$ ) && !checkvending() ) {

message strcharinfo(0), .@origin$ +" gives all players online in this map "+ .@amount +" "+ getitemname(.@itemid);

getitem .@itemid, .@amount;

}

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Answer this question...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...