Jump to content
  • 0

Can someone add @flooritem command from eAmod to rAthena ?


Question

Posted (edited)

This command from eAmod

/*==========================================
 * Creaci?e items en el suelo, en un Area.
 *------------------------------------------*/
ACMD_FUNC(flooritem)
{
	char item_name[100];
	int number = 0, count;
	struct item_data *item_data;
	nullpo_retr(-1, sd);

	memset(item_name, '\0', sizeof(item_name));

	if( !message || !*message || (
		sscanf(message, "\"%99[^\"]\" %d", item_name, &number) < 1 &&
		sscanf(message, "%99s %d", item_name, &number) < 1
	)) {
		clif_displaymessage(fd, "Usage: @flooritem <itemname/itemid> [quantity]");
		return -1;
	}

	if( number <= 0 )
		number = 1;

	if ((item_data = itemdb_searchname(item_name)) == NULL &&
	    (item_data = itemdb_exists(atoi(item_name))) == NULL)
	{
		clif_displaymessage(fd, msg_txt(sd,19)); // Invalid item ID or name.
		return -1;
	}

	count = map_addflooritem_area(&sd->bl, 0, 0, 0, item_data->nameid, number);

	if( count != 0 )
		if( number == count )
			clif_displaymessage(fd, "All items created.");
		else
		{
			sprintf(atcmd_output, "%d item(s) created.", count);
			clif_displaymessage(fd, atcmd_output);
		}
	else {
		clif_displaymessage(fd, "No items created!!.");
		return -1;
	}

	return 0;
}

can add to rathena ?

Edited by mharkeke

5 answers to this question

Recommended Posts

  • 0
Posted

Try this...

-	script	flooritem	FAKE_NPC,{
end;
OnInit:
	bindatcmd "flooritem", strnpcinfo(0)+"::OnFI", 60,90;
	end;
OnFI:
	.@hditemid = atoi(.@atcmd_parameters$[0]);
	.@damount = atoi(.@atcmd_parameters$[1]);

if ( !.@damount ) {
	message strcharinfo(0), "@flooritem <Itemid or itemname> <amount>";
	end;
	}
if ( .@damount < 0 ) {
	message strcharinfo(0), "@flooritem -> Invalid amount";
	end;
	}
if ( getitemname(.@hditemid) == "null" && !searchitem(.@temp[0],.@atcmd_parameters$[0]) ) {
	message strcharinfo(0), "@flooritem -> Invalid Item ID";
	end;
	}
if(.@temp[0])		.@dropitemid = .@temp[0];
	else
.@dropitemid = .@hditemid;	.@r = (sqrt(.@damount) > 16 ? 16 :sqrt(.@damount));

	getmapxy(.@m$,.@px,.@py,0);
	.@min_x =((.@px-.@r) < 1?1:(.@px-.@r));
	.@max_x =((.@px+.@r) > 512 ? 512:(.@px+.@r));
	.@min_y =((.@py-.@r) < 1?1:(.@py-.@r));
	.@max_y =((.@py+.@r) > 512 ? 512:(.@py+.@r));
	freeloop(1);
	for(.@j=0;.@j< .@damount;.@j++) {
	while (checkcell(.@m$[.@i],.@px=rand(.@min_x, .@max_x),.@py=rand(.@min_y , .@max_y), cell_chknopass));
	makeitem .@dropitemid,1,.@m$,.@px,.@py;
	}
	freeloop(0);
	end;

}

 

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