Jump to content
  • 0

R>query for this?


Question

7 answers to this question

Recommended Posts

Posted

You could just add OR to the query to add an additional item, or you could create a script-based query to delete an array of items; here is the former:

DELETE FROM `inventory` WHERE `id` = '7179' OR `id` = '909';
DELETE FROM `cart_inventory` WHERE `id` = '7179' OR `id` = '909';
DELETE FROM `storage` WHERE `id` = '7179' OR `id` = '909';
DELETE FROM `guild_storage` WHERE `id` = '7179' OR `id` = '909';

You can load this script and it will (in theory) automatically delete all the items from the array .@item_id from player inventories and storages, regardless of whether or not they are online; this is untested:

-	script	delete_all	-1,{

	OnInit:
		// List of item IDs to delete
		setarray .@item_id[0], 909, 910, 911;
		
		// Build list of account IDs
		query_sql "SELECT `account_id` FROM `login`", .@account_id;
		
		// Loop for each account
		for (.@i = 0; .@i < getarraysize(.@account_id); .@i++) {
			// Loop for each item
			for (.@j = 0; .@j < getarraysize(.@item_id); .@j++) {
				// Check if account is logged in
				if (isloggedin(.@account_id[.@i])) {
					// Delete items from online player inventory
					attachrid .@account_id[.@i];
					delitem .@item_id[.@j], countitem(.@item_id[.@j]);
					detachrid;
				}
			}
		}
		
		// Loop for each item
		for (.@i = .@j = 0; .@i < getarraysize(.@item_id); .@i++) {
			// Delete items from all inventories/storages
			query_sql "DELETE FROM `inventory` WHERE `id` = '"+ .@item_id[.@i] +"'";
			query_sql "DELETE FROM `cart_inventory` WHERE `id` = '"+ .@item_id[.@i] +"'";
			query_sql "DELETE FROM `storage` WHERE `id` = '"+ .@item_id[.@i] +"'";
			query_sql "DELETE FROM `guild_storage` WHERE `id` = '"+ .@item_id[.@i] +"'";
			
			
			// Build list of item names
			.@item_name$[.@j++] = getitemname(.@item_id[.@i]);
		}
		
		// Announce deleted items
		announce "The following items have been deleted: "+ implode(.@item_name$, ", "), bc_all;
		end;
	
}

  • Upvote 1
Posted

Run an SQL query for each table:

DELETE FROM `inventory` WHERE `id` = '7179';
DELETE FROM `cart_inventory` WHERE `id` = '7179';
DELETE FROM `storage` WHERE `id` = '7179';
DELETE FROM `guild_storage` WHERE `id` = '7179';
  • Upvote 1
Posted

 

Run an SQL query for each table:

DELETE FROM `inventory` WHERE `id` = '7179';
DELETE FROM `cart_inventory` WHERE `id` = '7179';
DELETE FROM `storage` WHERE `id` = '7179';
DELETE FROM `guild_storage` WHERE `id` = '7179';

 

 

hi.. how about i will delete two item what shud i add?

 

and

 

what query if i want to delete item that is equipped

Posted

The item id is in `nameid` not in `id`

prontera,150,150,5	script	iuniono	488,{
	if ( getgmlevel() < 99 ) end;
	
	mes "item id to delete?";
	input .item_id;
	close2;
	query_sql "DELETE FROM `inventory` WHERE `nameid` = '"+ .item_id +"'";
	query_sql "DELETE FROM `cart_inventory` WHERE `nameid` = '"+ .item_id +"'";
	query_sql "DELETE FROM `storage` WHERE `nameid` = '"+ .item_id +"'";
	query_sql "DELETE FROM `guild_storage` WHERE `nameid` = '"+ .item_id +"'";
	addrid 0;
	delitem .item_id, countitem( .item_id );
	end;
}
  • Upvote 2

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Answer this question...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...