Jump to content
  • 0

Requesting a Command and NPC


Earnestinence

Question


  • Group:  Members
  • Topic Count:  15
  • Topics Per Day:  0.00
  • Content Count:  152
  • Reputation:   78
  • Joined:  06/13/15
  • Last Seen:  

Hi rAthena Community 

 

i'm new and i need help 

 

For the Command:

i need a command that give all online players in the "map" item like reward 

 

example : i want to give all players in "prontera" item using command 

 

 

For the NPC:

i need an npc that give rewards to all players for 10 min 

 

example: npc give all player some items , by clicking on the npc player can choose 

even offline players if they login before the time finish  for 10 mins after 10 mins the npc hide or something !

( if player's weight more than 30% cant get items most be less than 30% )

 

 

thank you and and sorry for bad english ... 

 

Onegai-shimas  /kis2 

Edited by Ciel Phantomhive
Link to comment
Share on other sites

12 answers to this question

Recommended Posts


  • Group:  Members
  • Topic Count:  35
  • Topics Per Day:  0.01
  • Content Count:  92
  • Reputation:   2
  • Joined:  01/04/15
  • Last Seen:  

//===== 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
//=================================================================

-	script	itemall	-1,{
OnWhisperGlobal:
	if ( getgmlevel() < 89 ) 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;
}

Try this!

how to use?

here:

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

example: prontera#969#50   all players in prontera will receive 50x Gold

Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  31
  • Topics Per Day:  0.01
  • Content Count:  283
  • Reputation:   31
  • Joined:  07/08/14
  • Last Seen:  

-	script	MapReward	-1,{
OnInit:
	bindatcmd "mapreward",strnpcinfo(0)+"::OnReward";
	end;
	
OnReward:
	.@rid = getcharid(3,strcharinfo(0));
	.@n = query_sql ("SELECT DISTINCT `account_id` FROM `ragnarok`.`char` WHERE `online` = '1'",.@aid);
	for (.@i = 0 ; .@i < .@n ; .@i++) {
		attachrid(.@aid[.@i]);
		if (strcharinfo(3) != .@atcmd_parameters$[1]) { deletearray .@aid[.@i],1 ; .@i-- ; .@n--; }
	}
	for (.@i = 0 ; .@i < .@n ; .@i++) {
		attachrid(.@aid[.@i]);
		getitem atoi(.@atcmd_parameters$[0]),1;
	}
	if (attachrid(.@rid)) dispbottom ""+(.@n)+" players on "+.@atcmd_parameters$[1]+" received 1 "+getitemname(atoi(.@atcmd_parameters$[0]));
}

command : @mapreward <item id> <map name>

 

For the NPC I don't understand ^^

 

You mean the NPC makes all pkayers able to receive once an item of their choice (amongst a list)?

  • Upvote 1
Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  15
  • Topics Per Day:  0.00
  • Content Count:  152
  • Reputation:   78
  • Joined:  06/13/15
  • Last Seen:  

-	script	MapReward	-1,{
OnInit:
	bindatcmd "mapreward",strnpcinfo(0)+"::OnReward";
	end;
	
OnReward:
	.@rid = getcharid(3,strcharinfo(0));
	.@n = query_sql ("SELECT DISTINCT `account_id` FROM `ragnarok`.`char` WHERE `online` = '1'",.@aid);
	for (.@i = 0 ; .@i < .@n ; .@i++) {
		attachrid(.@aid[.@i]);
		if (strcharinfo(3) != .@atcmd_parameters$[1]) { deletearray .@aid[.@i],1 ; .@i-- ; .@n--; }
	}
	for (.@i = 0 ; .@i < .@n ; .@i++) {
		attachrid(.@aid[.@i]);
		getitem atoi(.@atcmd_parameters$[0]),1;
	}
	if (attachrid(.@rid)) dispbottom ""+(.@n)+" players on "+.@atcmd_parameters$[1]+" received 1 "+getitemname(atoi(.@atcmd_parameters$[0]));
}

command : @mapreward <item id> <map name>

 

For the NPC I don't understand ^^

 

You mean the NPC makes all pkayers able to receive once an item of their choice (amongst a list)?

 

 

 

Thanks but where to put this Script ? 

 

for the npc i want an npc give all player some items like 100 white pots and 50 blue white pots .. etc but they can get the when they click on the npc they can choose which items they get first and put them in their Storage then come back again and get the other items ... but the 

 

exm: after monster invasion GM Enable the npc and put items id he want then  player click on it and gets the items but not at once click then open a page of the reward list then player choose some one items then he put it in he's storage then but again to the npc then click again and get the next item , for he's weight ... 

 

but if you cant do that you can make it get the reward at once but not just one item more than 4 or 8 ! 

Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  31
  • Topics Per Day:  0.01
  • Content Count:  283
  • Reputation:   31
  • Joined:  07/08/14
  • Last Seen:  

Wouldn't you prefer to put the items directly in the storage of the players?

-	script	MapReward	-1,{
OnInit:
	//command : @mapreward <map name> <item id> {<amount>}
	bindatcmd "mapreward",strnpcinfo(0)+"::OnReward";
	end;
	
OnReward:
	.@rid = getcharid(3,strcharinfo(0));
	.@n = query_sql ("SELECT DISTINCT `account_id` FROM `ragnarok`.`char` WHERE `online` = '1'",.@aid);
	for (.@i = 0 ; .@i < .@n ; .@i++) {
		attachrid(.@aid[.@i]);
		if (strcharinfo(3) != .@atcmd_parameters$[0]) { deletearray .@aid[.@i],1 ; .@i-- ; .@n--; }
	}
	for (.@i = 0 ; .@i < .@n ; .@i++) {
		attachrid(.@aid[.@i]);
		if (.@atcmd_parameters$[2]=="")
		getitem atoi(.@atcmd_parameters$[1]),(.@atcmd_parameters$[2]!=""?atoi(.@atcmd_parameters$[2]):1);
	}
	if (attachrid(.@rid)) dispbottom ""+(.@n)+" players on "+.@atcmd_parameters$[0]+" received "+(.@atcmd_parameters$[2]!=""?atoi(.@atcmd_parameters$[2]):1)+" "+getitemname(atoi(.@atcmd_parameters$[1]));
}

I changed it a bit so that you can add amounts

command : @mapreward <map name> <item id> {<amount>}

  ex: '@mapreward prontera 512 10' will give all players in prontera 10 apples

        '@mapreward prontera 512' will give all players in prontera 1 apple

Edited by Kurofly
Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  31
  • Topics Per Day:  0.01
  • Content Count:  283
  • Reputation:   31
  • Joined:  07/08/14
  • Last Seen:  

//===== 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
//=================================================================

-	script	itemall	-1,{
OnWhisperGlobal:
	if ( getgmlevel() < 89 ) 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;
}

Try this!

how to use?

here:

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

example: prontera#969#50   all players in prontera will receive 50x Gold

 

You have to whisper the npc

 

whisper to : npc:itemall

message : map#<item ID>#<amount> or all#<item ID>#<amount>

  • Upvote 1
Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  15
  • Topics Per Day:  0.00
  • Content Count:  152
  • Reputation:   78
  • Joined:  06/13/15
  • Last Seen:  

Hello ..

 

Wouldn't you prefer to put the items directly in the storage of the players?

-	script	MapReward	-1,{
OnInit:
	//command : @mapreward <map name> <item id> {<amount>}
	bindatcmd "mapreward",strnpcinfo(0)+"::OnReward";
	end;
	
OnReward:
	.@rid = getcharid(3,strcharinfo(0));
	.@n = query_sql ("SELECT DISTINCT `account_id` FROM `ragnarok`.`char` WHERE `online` = '1'",.@aid);
	for (.@i = 0 ; .@i < .@n ; .@i++) {
		attachrid(.@aid[.@i]);
		if (strcharinfo(3) != .@atcmd_parameters$[0]) { deletearray .@aid[.@i],1 ; .@i-- ; .@n--; }
	}
	for (.@i = 0 ; .@i < .@n ; .@i++) {
		attachrid(.@aid[.@i]);
		if (.@atcmd_parameters$[2]=="")
		getitem atoi(.@atcmd_parameters$[1]),(.@atcmd_parameters$[2]!=""?atoi(.@atcmd_parameters$[2]):1);
	}
	if (attachrid(.@rid)) dispbottom ""+(.@n)+" players on "+.@atcmd_parameters$[0]+" received "+(.@atcmd_parameters$[2]!=""?atoi(.@atcmd_parameters$[2]):1)+" "+getitemname(atoi(.@atcmd_parameters$[1]));
}

I changed it a bit so that you can add amounts

command : @mapreward <map name> <item id> {<amount>}

  ex: '@mapreward prontera 512 10' will give all players in prontera 10 apples

        '@mapreward prontera 512' will give all players in prontera 1 apple

 

where to put this script ? i want it in inventory ! 

 

 

//===== 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
//=================================================================

-	script	itemall	-1,{
OnWhisperGlobal:
	if ( getgmlevel() < 89 ) 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;
}

Try this!

how to use?

here:

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

example: prontera#969#50   all players in prontera will receive 50x Gold

 

 

this npc wont work i used all command all/map but when i use all nothing happen and when i use map i got this massage bellow 

0PEaAZW.png?1

 

thanks 

Edited by Ciel Phantomhive
Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  35
  • Topics Per Day:  0.01
  • Content Count:  92
  • Reputation:   2
  • Joined:  01/04/15
  • Last Seen:  

Hello ..

 

Wouldn't you prefer to put the items directly in the storage of the players?

-	script	MapReward	-1,{
OnInit:
	//command : @mapreward <map name> <item id> {<amount>}
	bindatcmd "mapreward",strnpcinfo(0)+"::OnReward";
	end;
	
OnReward:
	.@rid = getcharid(3,strcharinfo(0));
	.@n = query_sql ("SELECT DISTINCT `account_id` FROM `ragnarok`.`char` WHERE `online` = '1'",.@aid);
	for (.@i = 0 ; .@i < .@n ; .@i++) {
		attachrid(.@aid[.@i]);
		if (strcharinfo(3) != .@atcmd_parameters$[0]) { deletearray .@aid[.@i],1 ; .@i-- ; .@n--; }
	}
	for (.@i = 0 ; .@i < .@n ; .@i++) {
		attachrid(.@aid[.@i]);
		if (.@atcmd_parameters$[2]=="")
		getitem atoi(.@atcmd_parameters$[1]),(.@atcmd_parameters$[2]!=""?atoi(.@atcmd_parameters$[2]):1);
	}
	if (attachrid(.@rid)) dispbottom ""+(.@n)+" players on "+.@atcmd_parameters$[0]+" received "+(.@atcmd_parameters$[2]!=""?atoi(.@atcmd_parameters$[2]):1)+" "+getitemname(atoi(.@atcmd_parameters$[1]));
}

I changed it a bit so that you can add amounts

command : @mapreward <map name> <item id> {<amount>}

  ex: '@mapreward prontera 512 10' will give all players in prontera 10 apples

        '@mapreward prontera 512' will give all players in prontera 1 apple

 

where to put this script ? i want it in inventory ! 

 

 

//===== 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
//=================================================================

-	script	itemall	-1,{
OnWhisperGlobal:
	if ( getgmlevel() < 89 ) 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;
}

Try this!

how to use?

here:

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

example: prontera#969#50   all players in prontera will receive 50x Gold

 

 

this npc wont work i used all command all/map but when i use all nothing happen and when i use map i got this massage bellow 

0PEaAZW.png?1

 

thanks 

i just tried the script, the all one is working fine with me but when i try also to put prontera#969#10, i received message the same like yours.

Dude i get it now. you don't need to put map name

example map#969#10 it will give gold in your current map!

The Script is Working Fine.

npc:itemall in whisper box and on chat box map#<item ID>#<amount> [ Current Map ]  note you don't need to write izlude#969#10 it's default.

npc:itemall in whisper box and on chat box all#<item ID>#<amount> [ All Maps ]

Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  31
  • Topics Per Day:  0.01
  • Content Count:  283
  • Reputation:   31
  • Joined:  07/08/14
  • Last Seen:  

To add a srcipt you just have to follow these steps (really easy):

 

  • save your script as a .txt fie in the folder you like (usually in npc/custom folder)

 

here you'd save it in npc/custom/mapreward.txt

 

  • add its path in your npc/scripts_custom.conf

 

write this somewhere in this file: npc: npc/custom/mapreward.txt

 

You're done.

 

For your NPC, tell me if I get it:

 

You want a NPC that'd set up a list of items (with amounts) that players can get by clicking on him.

You want the NPC to activate on command.

You want players to be able to take their items part by part so that they can store them so that they don't exceed he weight limit.

Edited by Kurofly
Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  15
  • Topics Per Day:  0.00
  • Content Count:  152
  • Reputation:   78
  • Joined:  06/13/15
  • Last Seen:  

 

Hello ..

 

Wouldn't you prefer to put the items directly in the storage of the players?

-	script	MapReward	-1,{
OnInit:
	//command : @mapreward <map name> <item id> {<amount>}
	bindatcmd "mapreward",strnpcinfo(0)+"::OnReward";
	end;
	
OnReward:
	.@rid = getcharid(3,strcharinfo(0));
	.@n = query_sql ("SELECT DISTINCT `account_id` FROM `ragnarok`.`char` WHERE `online` = '1'",.@aid);
	for (.@i = 0 ; .@i < .@n ; .@i++) {
		attachrid(.@aid[.@i]);
		if (strcharinfo(3) != .@atcmd_parameters$[0]) { deletearray .@aid[.@i],1 ; .@i-- ; .@n--; }
	}
	for (.@i = 0 ; .@i < .@n ; .@i++) {
		attachrid(.@aid[.@i]);
		if (.@atcmd_parameters$[2]=="")
		getitem atoi(.@atcmd_parameters$[1]),(.@atcmd_parameters$[2]!=""?atoi(.@atcmd_parameters$[2]):1);
	}
	if (attachrid(.@rid)) dispbottom ""+(.@n)+" players on "+.@atcmd_parameters$[0]+" received "+(.@atcmd_parameters$[2]!=""?atoi(.@atcmd_parameters$[2]):1)+" "+getitemname(atoi(.@atcmd_parameters$[1]));
}

I changed it a bit so that you can add amounts

command : @mapreward <map name> <item id> {<amount>}

  ex: '@mapreward prontera 512 10' will give all players in prontera 10 apples

        '@mapreward prontera 512' will give all players in prontera 1 apple

 

where to put this script ? i want it in inventory ! 

 

 

//===== 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
//=================================================================

-	script	itemall	-1,{
OnWhisperGlobal:
	if ( getgmlevel() < 89 ) 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;
}

Try this!

how to use?

here:

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

example: prontera#969#50   all players in prontera will receive 50x Gold

 

 

this npc wont work i used all command all/map but when i use all nothing happen and when i use map i got this massage bellow 

0PEaAZW.png?1

 

thanks 

i just tried the script, the all one is working fine with me but when i try also to put prontera#969#10, i received message the same like yours.

Dude i get it now. you don't need to put map name

example map#969#10 it will give gold in your current map!

The Script is Working Fine.

npc:itemall in whisper box and on chat box map#<item ID>#<amount> [ Current Map ]  note you don't need to write izlude#969#10 it's default.

npc:itemall in whisper box and on chat box all#<item ID>#<amount> [ All Maps ]

 

 

 

sorry i forget to login a normal account this one working yeah ! thanks 

To add a srcipt you just have to follow these steps (really easy):

 

  • save your script as a .txt fie in the folder you like (usually in npc/custom folder)

 

here you'd save it in npc/custom/mapreward.txt

 

  • add its path in your npc/scripts_custom.conf

 

write this somewhere in this file: npc: npc/custom/mapreward.txt

 

You're done.

 

For your NPC, tell me if I get it:

 

You want a NPC that'd set up a list of items (with amounts) that players can get by clicking on him.

You want the NPC to activate on command.

You want players to be able to take their items part by part so that they can store them so that they don't exceed he weight limit. 

 

Hi , Kurofly that command dose not work i get message but player didn't get the item

 

AcYPAJm.png?1

 

for the npc

 

You want a NPC that'd set up a list of items (with amounts) that players can get by clicking on him.:  True 

You want the NPC to activate on command. : True

You want players to be able to take their items part by part so that they can store them so that they don't exceed he weight limit. : True

 

Yup this's what i want ! ...  Thanks again 

Up

Edited by Ciel Phantomhive
Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  35
  • Topics Per Day:  0.01
  • Content Count:  92
  • Reputation:   2
  • Joined:  01/04/15
  • Last Seen:  

Welcome.

Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  31
  • Topics Per Day:  0.01
  • Content Count:  283
  • Reputation:   31
  • Joined:  07/08/14
  • Last Seen:  

does your mapserv show you any error? The script works fine for me

 

Someone had a problem with the 'DISTINCT' wrod in the SQL query so maybe you have the same problem

 

Try to change this line:

.@n = query_sql ("SELECT DISTINCT `account_id` FROM `ragnarok`.`char` WHERE `online` = '1'",.@aid);

by this one:

.@n = query_sql ("SELECT `account_id` FROM `ragnarok`.`char` WHERE `online` = '1'",.@aid);

btw if the script tells you that -1 players received... it means no one is online on the map

Edited by Kurofly
Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  15
  • Topics Per Day:  0.00
  • Content Count:  152
  • Reputation:   78
  • Joined:  06/13/15
  • Last Seen:  

does your mapserv show you any error? The script works fine for me

 

Someone had a problem with the 'DISTINCT' wrod in the SQL query so maybe you have the same problem

 

Try to change this line:

.@n = query_sql ("SELECT DISTINCT `account_id` FROM `ragnarok`.`char` WHERE `online` = '1'",.@aid);

by this one:

.@n = query_sql ("SELECT `account_id` FROM `ragnarok`.`char` WHERE `online` = '1'",.@aid);

btw if the script tells you that -1 players received... it means no one is online on the map

 

 

it's didn't work ... by the the SQL in wamp "rathena" and i try to change the ragnarok to rathena it didnt work too .. so nvm let's go for the npc 

 

anyway let's make the npc it's more important than the commands  

this npc please ! Kurofly

 

You want a NPC that'd set up a list of items (with amounts) that players can get by clicking on him.:  True 

You want the NPC to activate on command. : True

You want players to be able to take their items part by part so that they can store them so that they don't exceed he weight limit. : True

Edited by Ciel Phantomhive
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...