Jump to content
  • 0

Help> Fix the autostorage timer_func


nasagnilac

Question


  • Group:  Members
  • Topic Count:  89
  • Topics Per Day:  0.02
  • Content Count:  232
  • Reputation:   15
  • Joined:  11/02/13
  • Last Seen:  

I am creating a autostorage timer but it dont store the item. Can you please help me check the script. Thanks you.

 

TIMER_FUNC(unit_autostorage){
	struct block_list *bl;
	struct unit_data *ud;

	bl = map_id2bl(id);

	if (!bl)
		return 0;

	ud = unit_bl2ud(bl);

	if (!ud)
		return 0;

	struct map_session_data *sd = (struct map_session_data*)bl;
	int i, a;

	// Store item when weight become 90%
	if(pc_is90overweight(sd) && sd->state.afk_storeItem == 1){

		if (sd->state.storage_flag != 1)
		{	//Open storage.
			if( storage_storageopen(sd) == 1 ) {
				return 0;
			}
		}

		for (i = 0; i < MAX_INVENTORY; i++) {
			ARR_FIND(0, AFKSTOREITEM_LIST, a, sd->state.afk_storeItemlist[a] == sd->inventory.u.items_inventory[i].nameid);
			if (a != AFKSTOREITEM_LIST) {
				if (sd->inventory.u.items_inventory[i].amount && sd->inventory.u.items_inventory[i].equip == 0) {
					storage_storageadd(sd, &sd->storage, i, sd->inventory.u.items_inventory[i].amount);
				}
			}
		}

		storage_storageclose(sd);
	}

	return 0;
}

 

Link to comment
Share on other sites

0 answers to this question

Recommended Posts

There have been no answers to this question yet

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