Jump to content
  • 0
wingsofloveza

R> send item on mail

Question

4 answers to this question

Recommended Posts

  • 1
Spoiler
-	script	rewardcommand	HIDDEN_WARP_NPC,{
OnInit:
//==== CONF =====
	.sender$ = "GM Team";
	.title$ = "Reward";
	.body$ = "Here's something for you. Have fun!";
	.zeny = 0;	// Default zent sent
	setarray .mailitem[0], 607, 617; // Default items (Max.5)
	setarray .mailamount[0], 3, 1; // Default items quantity
//===============	
	bindatcmd "reward", strnpcinfo(3)+"::OnAtcommand", 99;
	end;

OnAtcommand:
	if ([email protected]_parameters$[0] == "all")
		[email protected] = 1;
	if ([email protected]_parameters$[0] == "map")
		[email protected] = 2;
	if ([email protected]) {
		if (getarraysize(.mailitem) != getarraysize(.mailamount)) {
			dispbottom "Error.";
			end;
		}
		if ([email protected] == 1)
			addrid(0, 0);
		else
			addrid(1, 0);
		if (checkvending(strcharinfo(0)))
			detachrid;
		if (.mailitem[0])
			mail getcharid(0), .sender$, .title$, .body$, .zeny, .mailitem, .mailamount;
		else
			mail getcharid(0), .sender$, .title$, .body$, .zeny;
		detachrid;
		end;
	}
	mes "Use [@reward all] to send rodex to everyone online.";
	mes "Use [@reward map] to send rodex to everyone on your map.";
	while (true) {
		next;
		mes "RodEx contents:";
		mes "" + callfunc("F_InsertComma",.zeny) + "z.";
		if (.mailitem[0]) {
			for ( [email protected] = 0; [email protected] < getarraysize(.mailitem); [email protected] )
				mes "" + .mailamount[[email protected]] + "x " + getitemname(.mailitem[[email protected]]) + ".";
		}
		switch(select("Close.", "Change zeny.", "Change item(s).")) {
		case 1:
			close;
		case 2:
			input .zeny;
			break;
		case 3:
			do {
				next;
				mes "[Item list]";
				if (.mailitem[0]) {
					for ( [email protected] = 0; [email protected] < getarraysize(.mailitem); [email protected] )
						mes "" + .mailamount[[email protected]] + "x " + getitemname(.mailitem[[email protected]]) + ".";
				}
				else
					mes "Empty.";
				next;
				switch(select("Return", "Add item", "Remove item", "Remove all")) {
				case 1:
					break;
				case 2:
					if (getarraysize(.mailitem) > 4) {
						mes "You cannot add more items. Max 5.";
						break;
					}
					mes "Input item ID.";
					input [email protected];
					if (getitemname([email protected]) == "null") {
						mes "Item not found.";
						break;
					}
					mes "- " + getitemname([email protected]);
					if (getiteminfo([email protected], 2) == 4 || getiteminfo([email protected], 2) == 5 || getiteminfo([email protected], 2) == 12) {
						[email protected] = 1;
					}
					else {
						mes "Input item quantity.";
						input [email protected];
						if ([email protected] < 1 || [email protected] > 1000) {
							mes "Invalid quantity.";
							break;
						}
					}
					.mailitem[getarraysize(.mailitem)] = [email protected];
					.mailamount[getarraysize(.mailamount)] = [email protected];
					next;
					break;
				case 3:
					if (.mailitem[0]) {
						mes "Input index to remove.";
						for ( [email protected] = 0; [email protected] < getarraysize(.mailitem); [email protected] )
							mes "" + [email protected] + ": " + .mailamount[[email protected]] + "x " + getitemname(.mailitem[[email protected]]) + ".";
						input [email protected];
						if (.mailitem[[email protected]] == 0 || .mailamount[[email protected]] == 0)
							mes "Invalid index.";
						else {
							deletearray .mailitem[[email protected]], 1;
							deletearray .mailamount[[email protected]], 1;
						}
					}
					else
						mes "No item to remove.";
					break;
				case 4:
					deletearray .mailitem[0], getarraysize(.mailitem);
					deletearray .mailamount[0], getarraysize(.mailamount);
					break;
				}
			} while (@menu != 1);
		}
	}
}

 

Hi. I didn't test much. The command is @reward.

  • Upvote 1
Link to comment
Share on other sites

  • 0

 

On 4/17/2020 at 1:28 PM, Racaae said:
  Hide contents

-	script	rewardcommand	HIDDEN_WARP_NPC,{
OnInit:
//==== CONF =====
	.sender$ = "GM Team";
	.title$ = "Reward";
	.body$ = "Here's something for you. Have fun!";
	.zeny = 0;	// Default zent sent
	setarray .mailitem[0], 607, 617; // Default items (Max.5)
	setarray .mailamount[0], 3, 1; // Default items quantity
//===============	
	bindatcmd "reward", strnpcinfo(3)+"::OnAtcommand", 99;
	end;

OnAtcommand:
	if ([email protected]_parameters$[0] == "all")
		[email protected] = 1;
	if ([email protected]_parameters$[0] == "map")
		[email protected] = 2;
	if ([email protected]) {
		if (getarraysize(.mailitem) != getarraysize(.mailamount)) {
			dispbottom "Error.";
			end;
		}
		if ([email protected] == 1)
			addrid(0, 0);
		else
			addrid(1, 0);
		if (checkvending(strcharinfo(0)))
			detachrid;
		if (.mailitem[0])
			mail getcharid(0), .sender$, .title$, .body$, .zeny, .mailitem, .mailamount;
		else
			mail getcharid(0), .sender$, .title$, .body$, .zeny;
		detachrid;
		end;
	}
	mes "Use [@reward all] to send rodex to everyone online.";
	mes "Use [@reward map] to send rodex to everyone on your map.";
	while (true) {
		next;
		mes "RodEx contents:";
		mes "" + callfunc("F_InsertComma",.zeny) + "z.";
		if (.mailitem[0]) {
			for ( [email protected] = 0; [email protected] < getarraysize(.mailitem); [email protected] )
				mes "" + .mailamount[[email protected]] + "x " + getitemname(.mailitem[[email protected]]) + ".";
		}
		switch(select("Close.", "Change zeny.", "Change item(s).")) {
		case 1:
			close;
		case 2:
			input .zeny;
			break;
		case 3:
			do {
				next;
				mes "[Item list]";
				if (.mailitem[0]) {
					for ( [email protected] = 0; [email protected] < getarraysize(.mailitem); [email protected] )
						mes "" + .mailamount[[email protected]] + "x " + getitemname(.mailitem[[email protected]]) + ".";
				}
				else
					mes "Empty.";
				next;
				switch(select("Return", "Add item", "Remove item", "Remove all")) {
				case 1:
					break;
				case 2:
					if (getarraysize(.mailitem) > 4) {
						mes "You cannot add more items. Max 5.";
						break;
					}
					mes "Input item ID.";
					input [email protected];
					if (getitemname([email protected]) == "null") {
						mes "Item not found.";
						break;
					}
					mes "- " + getitemname([email protected]);
					if (getiteminfo([email protected], 2) == 4 || getiteminfo([email protected], 2) == 5 || getiteminfo([email protected], 2) == 12) {
						[email protected] = 1;
					}
					else {
						mes "Input item quantity.";
						input [email protected];
						if ([email protected] < 1 || [email protected] > 1000) {
							mes "Invalid quantity.";
							break;
						}
					}
					.mailitem[getarraysize(.mailitem)] = [email protected];
					.mailamount[getarraysize(.mailamount)] = [email protected];
					next;
					break;
				case 3:
					if (.mailitem[0]) {
						mes "Input index to remove.";
						for ( [email protected] = 0; [email protected] < getarraysize(.mailitem); [email protected] )
							mes "" + [email protected] + ": " + .mailamount[[email protected]] + "x " + getitemname(.mailitem[[email protected]]) + ".";
						input [email protected];
						if (.mailitem[[email protected]] == 0 || .mailamount[[email protected]] == 0)
							mes "Invalid index.";
						else {
							deletearray .mailitem[[email protected]], 1;
							deletearray .mailamount[[email protected]], 1;
						}
					}
					else
						mes "No item to remove.";
					break;
				case 4:
					deletearray .mailitem[0], getarraysize(.mailitem);
					deletearray .mailamount[0], getarraysize(.mailamount);
					break;
				}
			} while (@menu != 1);
		}
	}
}

 

Hi. I didn't test much. The command is @reward.

Wow its good. But it wont send mails to offline players. Can we have that option? Thanks!

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

Important Information

By using this site, you agree to our Terms of Use and Privacy Policy.