How to mass delete a certain item from all players inventory?

MrTitan

Elder
Customer
I want to know how to remove for example item 9414 from all players at 8pm.
Or any other better method because when they enter the zone they get a 9414 coin.
And the zone is reset at 8pm but the coin stays in the inventory and they cant join.
So I want to remove this coin when the reset time comes.
 
solved I use this if someone can suggest better method let me know.

for (Player player : GameObjectsStorage.getAllPlayers()) {
int coinCount = (int) player.getInventory().getCountOf(PENALTY_COIN_ID);
 
solved I use this if someone can suggest better method let me know.

for (Player player : GameObjectsStorage.getAllPlayers()) {
int coinCount = (int) player.getInventory().getCountOf(PENALTY_COIN_ID);
And what if the player is offline? No, you need to delete all these items from the database using the query
DELETE * FROM items WHERE item_type=9414
And do this ONLY on a switched off server.
 
@MrTitan, I have many additional GM commands, however I don't remember using this. I am mostly using the Telegram bot.
Thanks trance I really appreciate your help. I have found a way to make the code works properly. I will check your bot commands because I also love the telegram bot ( I even make a donate system with it and works flawlessly)
 
just put the item in a minute

<set name="durability" value="1"/>
The Walking Dead Easy Peasy GIF
 
I totally forgot about the durability option ... Let's see how it will works.
что то мне подсказывает, что если предмет создан до внесения изменений в предмет, то не поможет
 
I think it doesn't matter when the item is created. If you set the item to expire, it will expire without being affected by its creation time.
but then, where is the db values stored for the items created before the modification of the item to a temporal one.....?
they are not there at all....
items created and stored in db like a normal item will not be converted automatically in db to temporary items, right?
 
To mass delete a certain item from all players' inventories in a Lineage 2 server (such as Lucera2), you would typically need to execute a SQL query on the server's database. This process involves directly modifying the database, so it's crucial to back up your database before making any changes.

Here’s a general guide on how to do this:

---

### **Step 1: Identify the Item ID**
1. Open your database management tool (e.g., phpMyAdmin, MySQL Workbench, or HeidiSQL).
2. Locate the `item_template` table (or similar) to find the `item_id` of the item you want to delete. This table contains all item definitions in the game.

---

### **Step 2: Write the SQL Query**
1. Connect to your Lineage 2 database.
2. Use the following SQL query to delete the item from all players' inventories:

```sql
DELETE FROM items WHERE item_type= YOUR_ITEM_ID;
```

Replace `YOUR_ITEM_ID` with the actual ID of the item you want to delete.

---

### **Step 3: Execute the Query**
1. Run the query in your database management tool.
2. This will remove the specified item from all players' inventories.

---

### **Step 4: Verify the Changes**
1. Check the `items` table to ensure the item has been removed.
2. You can also log in to the game as a player or admin to confirm the item is no longer in any inventory.

---

### **Important Notes:**
- **Backup Your Database:** Always back up your database before running any queries that modify data.
- **Test on a Local Server:** If possible, test the query on a local or test server before applying it to the live server.
- **Permissions:** Ensure you have the necessary permissions to execute queries on the database.
- **Impact:** Deleting items from all players' inventories can have a significant impact on the game economy and player experience. Communicate with your player base if necessary.

---

If you're unsure about any part of this process, consult your server's documentation or seek assistance from someone experienced with Lineage 2 server administration.
 
Last edited:
To mass delete a certain item from all players' inventories in a Lineage 2 server (such as Lucera2), you would typically need to execute a SQL query on the server's database. This process involves directly modifying the database, so it's crucial to back up your database before making any changes.

Here’s a general guide on how to do this:

---

### **Step 1: Identify the Item ID**
1. Open your database management tool (e.g., phpMyAdmin, MySQL Workbench, or HeidiSQL).
2. Locate the `item_template` table (or similar) to find the `item_id` of the item you want to delete. This table contains all item definitions in the game.

---

### **Step 2: Write the SQL Query**
1. Connect to your Lineage 2 database.
2. Use the following SQL query to delete the item from all players' inventories:

```sql
DELETE FROM items WHERE item_id = YOUR_ITEM_ID;
```

Replace `YOUR_ITEM_ID` with the actual ID of the item you want to delete.

---

### **Step 3: Execute the Query**
1. Run the query in your database management tool.
2. This will remove the specified item from all players' inventories.

---

### **Step 4: Verify the Changes**
1. Check the `items` table to ensure the item has been removed.
2. You can also log in to the game as a player or admin to confirm the item is no longer in any inventory.

---

### **Important Notes:**
- **Backup Your Database:** Always back up your database before running any queries that modify data.
- **Test on a Local Server:** If possible, test the query on a local or test server before applying it to the live server.
- **Permissions:** Ensure you have the necessary permissions to execute queries on the database.
- **Impact:** Deleting items from all players' inventories can have a significant impact on the game economy and player experience. Communicate with your player base if necessary.

---

If you're unsure about any part of this process, consult your server's documentation or seek assistance from someone experienced with Lineage 2 server administration.
item_type, not a item_id
 
Back
Top