Jump to content
  • 0

Command to give everyone item?


Seiro

Question


  • Group:  Members
  • Topic Count:  20
  • Topics Per Day:  0.00
  • Content Count:  42
  • Reputation:   0
  • Joined:  10/24/12
  • Last Seen:  

What's the command to give everyone item again? :(

Link to comment
Share on other sites

9 answers to this question

Recommended Posts


  • Group:  Members
  • Topic Count:  55
  • Topics Per Day:  0.01
  • Content Count:  1191
  • Reputation:   161
  • Joined:  06/12/12
  • Last Seen:  

@item player_name[space]item[space]quantity

Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  20
  • Topics Per Day:  0.00
  • Content Count:  42
  • Reputation:   0
  • Joined:  10/24/12
  • Last Seen:  

@QQ thank you :P

@hendra thanks, but the #itemall is the one I'm looking for. heh

Link to comment
Share on other sites


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

if you want... you can try this...

http://pastebin.com/raw.php?i=SR3ucpeN

Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  26
  • Topics Per Day:  0.01
  • Content Count:  331
  • Reputation:   63
  • Joined:  11/29/11
  • Last Seen:  

@Emistry Script

I think can be exploited.

bindatcmd("itemall",strnpcinfo(0)+"::OnAtCommand");

Change it to

bindatcmd("itemall",strnpcinfo(0)+"::OnAtCommand",.GMLevel,.GMLevel);

Or

bindatcmd("itemall",strnpcinfo(0)+"::OnAtCommand",90,90);

Edited by Dastgir Pojee
Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  9
  • Topics Per Day:  0.00
  • Content Count:  379
  • Reputation:   304
  • Joined:  11/10/11
  • Last Seen:  

@Emistry

It's not a stable script.

When log in you are setting some variables to the player to find it easily.

		@ArrayIndex = .@array;
	@Slot = .@size;

Whe log out, you removed his index in the array:

deletearray getd(".PlayerArray"+@ArrayIndex+"$["+@Slot+"]"),1;

Scenario:

- 3 players are online, give an array of : [ A, B, C ] with local variable for index: (A:0, B:1, C:2).

- Player A log out, result online players: [b, C], with local variable: (B:1, C:2)

- Player B log out, result online players: .

You need to update each @ArrayIndex value when someone log out.

You need also to update .array_size to avoid useless loop sometimes.

Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  26
  • Topics Per Day:  0.01
  • Content Count:  331
  • Reputation:   63
  • Joined:  11/29/11
  • Last Seen:  

Don't know if this works or not, but try it, havent' tested it

itemall.txt

Link to comment
Share on other sites


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

@Keyworld..

Owh..thank for pointing that...

somehow i have forgotten / didnt think about this scenario...

@Dastgir

oh..no worry on this...

because i got this..

OnAtCommand:
if( getgmlevel() >= .GMLevel ){;

but yeah..your method would be better ...i forgotten the bindatcmd have Account Level Parameter..xD

and...there is 1 thing i forgot....there is SQL to do this also... hahaha ~

damn..been busy with god damn assignment for the past few day ...just manage to finished it in time..and now i still so blur with some stuff... hahaha~

guess i gonna take some time to rest awhile after my assignment.... >.<

Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  17
  • Topics Per Day:  0.00
  • Content Count:  754
  • Reputation:   186
  • Joined:  05/22/12
  • Last Seen:  

Here..

atcommand.c

add after the last command

/*==========================================
* @itemall command (usage: @itemall <name/id_of_item> <quantity>)
* Ported to a global command by clydelion
*------------------------------------------*/
ACMD_FUNC(itemall)
{
struct map_session_data *pl_sd = NULL;
struct s_mapiterator* iter;
char item_name[100];
int number = 0, item_id;
struct item item_tmp;
struct item_data *item_data;
int get_count, i, j = 0;
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, msg_txt(983)); // Please enter an item name or ID (usage: @item <item name/ID> <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(19)); // Invalid item ID or name.
	return -1;
}
item_id = item_data->nameid;
get_count = number;
//Check if it's stackable.
if (!itemdb_isstackable2(item_data))
	get_count = 1;
iter = mapit_getallusers();
for( pl_sd = (TBL_PC*)mapit_first(iter); mapit_exists(iter); pl_sd = (TBL_PC*)mapit_next(iter) ){
	int flag = 0;  
	if( pc_get_group_level(pl_sd) > pc_get_group_level(sd) )
		continue;

	if( pl_sd == sd )
		continue;

	for ( i = 0; i < number; i += get_count ) {
		// if not pet egg
		if (!pet_create_egg(pl_sd, item_id)) {
			memset(&item_tmp, 0, sizeof(item_tmp));
			item_tmp.nameid = item_id;
			item_tmp.identify = 1;
			if ((flag = pc_additem(pl_sd, &item_tmp, get_count, LOG_TYPE_COMMAND)))
				clif_additem(pl_sd, 0, 0, flag);
		}
	}
	if (flag == 0){
		sprintf(atcmd_output,"You have received %d %s %s from %s.",i,i>1?"pcs.":"pc.",item_data->name, sd->status.name);
		clif_displaymessage(pl_sd->fd,atcmd_output);
		j++;
	}
}
sprintf(atcmd_output,"You have given %d %s %s to %d %s.",i,i>1?"pcs.":"pc.",item_data->name,j,j>1?"players":"player");
clif_displaymessage(fd,atcmd_output);
return 0;
}

declare it in the command reference list..

AtCommandInfo atcommand_base[] = {
+	ACMD_DEF(itemall),
ACMD_DEF2("warp", mapmove),

I've attached a diff.

itemall_atcommand.diff

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