Jump to content
  • 0

NPC that gives item to all the online players


caspa

Question


  • Group:  Members
  • Topic Count:  194
  • Topics Per Day:  0.04
  • Content Count:  499
  • Reputation:   3
  • Joined:  03/11/12
  • Last Seen:  

I would like to request an NPC where if you click him he would ask for an item id and if you enter 7227 he would ask next how many...... after you put the amount all the online player will recieve the item.... ( vendor and afk included )

Link to comment
Share on other sites

2 answers to this question

Recommended Posts


  • Group:  Members
  • Topic Count:  72
  • Topics Per Day:  0.02
  • Content Count:  2997
  • Reputation:   1130
  • Joined:  05/27/12
  • Last Seen:  

	mes "Input item ID:";	

input .@item;

if (getitemname(.@item) == "null") {

mes "Invalid ID "+.@item+".";

close;

}

mes "Input quantity:";

input .@count,0,30000;

if (.@count == 0) {

mes "Invalid quantity 0.";

close;

}

set .@j, query_sql("SELECT `account_id` FROM `char` WHERE `online` = 1",.@aid);

for(set .@i,0; .@i<.@j; set .@i,.@i+1)

getitem .@item,.@count,.@aid[.@i];

mes "Gave item "+getitemname(.@item)+" x"+.@count+" to "+.@j+" players.";

close;

  • Upvote 2
Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  194
  • Topics Per Day:  0.04
  • Content Count:  499
  • Reputation:   3
  • Joined:  03/11/12
  • Last Seen:  

	mes "Input item ID:";	
	input .@item;
	if (getitemname(.@item) == "null") {
		mes "Invalid ID "+.@item+".";
		close;
	}
	mes "Input quantity:";
	input .@count,0,30000;
	if (.@count == 0) {
		mes "Invalid quantity 0.";
		close;
	}
	set .@j, query_sql("SELECT `account_id` FROM `char` WHERE `online` = 1",.@aid);
	for(set .@i,0; .@i<.@j; set .@i,.@i+1)
		getitem .@item,.@count,.@aid[.@i];
	mes "Gave item "+getitemname(.@item)+" x"+.@count+" to "+.@j+" players.";
	close;

thank you sir euphy [ SOLVED ]

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...