yuhsing

Untitled

Jan 14th, 2013
59
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.88 KB | None | 0 0
  1.  
  2. // restock Y amount of item X from storage to inventory
  3. // restock( x,y );
  4.  
  5. // but i get error for undclared sd, and i dont know how to fix this..any idea ?
  6. // i have try refer to other script command that have used the sd ..but still failed to do so.
  7.  
  8.  
  9.  
  10. BUILDIN_FUNC(restock)
  11. {
  12. int i,amount,get_itemid,get_amount;
  13.  
  14. get_itemid = script_getnum(st,2);
  15. get_amount = script_getnum(st,3);
  16.  
  17. TBL_PC *sd;
  18. sd = script_rid2sd(st);// attached player
  19. if( sd == NULL ) return 0;
  20.  
  21. struct storage_data* stor = sd->status.storage;
  22.  
  23. if( get_itemid <= 0 || get_amount <= 0 ) return 1;
  24.  
  25. if( sd == NULL ) return 0;
  26. for( i = 0; i < MAX_STORAGE; i++ )
  27. if( stor->items[i].nameid == get_itemid )
  28. if( stor->items[i].amount >= 1 ){
  29. if( stor->items[i].amount < get_amount ) get_amount = stor->items[i].amount;
  30. storage_storageget(sd, i, get_amount);
  31. }
  32.  
  33. return 1;
  34. }
Advertisement
Add Comment
Please, Sign In to add comment