Advertisement
Guest User

Untitled

a guest
Sep 13th, 2012
92
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.93 KB | None | 0 0
  1. ACMD_FUNC(storage)
  2. {
  3.     int item_id_req = 501;  // item id
  4.     int item_qty_req = 5;   // item quantity
  5.     int i, found = 0;
  6.     nullpo_retr(-1, sd);
  7.    
  8.     if (sd->npc_id || sd->state.vending || sd->state.buyingstore || sd->state.trading || sd->state.storage_flag)
  9.         return -1;
  10.  
  11.     for (i = 0; i < MAX_INVENTORY; i++)
  12.     {
  13.         if (sd->status.inventory[i].nameid == item_id_req &&
  14.             sd->status.inventory[i].amount >= item_qty_req &&
  15.             !sd->status.inventory[i].equip &&
  16.             sd->status.inventory[i].identify)
  17.         {
  18.             found = 1;
  19.         }
  20.         else
  21.             continue;
  22.     }
  23.    
  24.     if (!found)
  25.     {
  26.         sprintf(atcmd_output, "You need %dx %s in order to use this command", item_qty_req, itemdb_jname(item_id_req));
  27.         clif_displaymessage(sd->fd, atcmd_output);
  28.         return -1;
  29.     }
  30.        
  31.     if (storage_storageopen(sd) == 1)
  32.     {   //Already open.
  33.         clif_displaymessage(fd, msg_txt(250));
  34.         return -1;
  35.     }
  36.    
  37.     clif_displaymessage(fd, msg_txt(919)); // Storage opened.
  38.    
  39.     return 0;
  40. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement