Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // restock Y amount of item X from storage to inventory
- // restock( x,y );
- // but i get error for undclared sd, and i dont know how to fix this..any idea ?
- // i have try refer to other script command that have used the sd ..but still failed to do so.
- BUILDIN_FUNC(restock)
- {
- int i,amount,get_itemid,get_amount;
- get_itemid = script_getnum(st,2);
- get_amount = script_getnum(st,3);
- TBL_PC *sd;
- sd = script_rid2sd(st);// attached player
- if( sd == NULL ) return 0;
- struct storage_data* stor = sd->status.storage;
- if( get_itemid <= 0 || get_amount <= 0 ) return 1;
- if( sd == NULL ) return 0;
- for( i = 0; i < MAX_STORAGE; i++ )
- if( stor->items[i].nameid == get_itemid )
- if( stor->items[i].amount >= 1 ){
- if( stor->items[i].amount < get_amount ) get_amount = stor->items[i].amount;
- storage_storageget(sd, i, get_amount);
- }
- return 1;
- }
Advertisement
Add Comment
Please, Sign In to add comment