Jump to content
  • 0

Need Help with this Script.


Yami

Question


  • Group:  Members
  • Topic Count:  35
  • Topics Per Day:  0.01
  • Content Count:  111
  • Reputation:   2
  • Joined:  01/02/14
  • Last Seen:  

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;
}
Link to comment
Share on other sites

6 answers to this question

Recommended Posts


  • Group:  Forum Moderator
  • Topic Count:  93
  • Topics Per Day:  0.02
  • Content Count:  10013
  • Reputation:   2346
  • Joined:  10/28/11
  • Last Seen:  


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;

}

Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  9
  • Topics Per Day:  0.00
  • Content Count:  114
  • Reputation:   8
  • Joined:  09/16/14
  • Last Seen:  

add:

  if( CheckVending() ){
   DetachRID();
   continue;
   }
Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  35
  • Topics Per Day:  0.01
  • Content Count:  111
  • Reputation:   2
  • Joined:  01/02/14
  • Last Seen:  

where to add that @sasuke?


anyone know where i put this code on the script?? :((

Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  81
  • Topics Per Day:  0.02
  • Content Count:  1654
  • Reputation:   583
  • Joined:  08/09/12
  • Last Seen:  

After

attachrid getd("$online_aid"+ .@i );
Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  35
  • Topics Per Day:  0.01
  • Content Count:  111
  • Reputation:   2
  • Joined:  01/02/14
  • Last Seen:  

@nanakiwurtz script didnt work sir. had an error: infinity loop

Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  35
  • Topics Per Day:  0.01
  • Content Count:  111
  • Reputation:   2
  • Joined:  01/02/14
  • Last Seen:  

Its working now! Thanks guys, thanks @emistry =))

Link to comment
Share on other sites

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.

×
×
  • Create New...