Hey there! I have another question to you pros Well, i want to fill chests... I have 100 Chests on a Map. I need to clear them and put an iron sword in each. How do i do that? Thanks!
No. I have to use it so it will be done every 20 minutes or so. I know how to do this. Can you please help with the question above?
I know how to do that. Thats what i'm currently doing. But i want the Iron swords to be other items. So it will be dynamic...
Here's a script that accomplish the job: PHP: $cheststemplate = array( 1 => array( 'x' => 10, 'y' => 10, 'z' => 10, 'items' => array( 0 => array( 'id' => 1, 'meta' => 0, 'count' => 64 ), 1 => array( 'id' => 264, 'meta' => 0, 'count' => 1 ), ), ), 2 => array( 'x' => 20, 'y' => 20, 'z' => 20, 'items' => array( 0 => array( 'id' => 3, 'meta' => 0, 'count' => 1 ), ), ),);foreach($cheststemplate as $chestnumber => $chestinfo){ $position = new Position($chestinfo['x'], $chestinfo['y'], $chestinfo['z']); $chest = $this->api->tile->get($position); foreach($val['items'] as $slot => $iteminfo){ $item = BlockAPI::getItem($iteminfo['id'], $iteminfo['meta'], $iteminfo['count']); $chest->setSlot($slot, $item); }}console('chests refilled!'); You can change an add as many chests and items to the $cheststemplate edit: Or do you mean to get all the chests on your server (not by position )and fill them with a iron sword? If so, than you can use this: PHP: $ironsword = BlockAPI::getItem(267, 0, 1);$tiles = $this->api->tile->getAll();foreach($tiles as $tile){ if($tile->class === TILE_CHEST){ $tile->setSlot(0, $ironsword); }}
I just thought I'd say this helps me a lot with one of my plugin ideas! Thanks @wies! Hopefully I'll find enough time to make it for the plugin contest though
I'm 70% noob in php, even don't know new api on 100%... Can you help me with plugin? I need chest refill plugin, working on 100% (Folk's plugin crashes my server) For more details contact me in skype - wtf_one P.S: I can paid $ for good work...