Jump to content
  • 0

R>query for this?


CursorX

Question


  • Group:  Members
  • Topic Count:  66
  • Topics Per Day:  0.02
  • Content Count:  168
  • Reputation:   0
  • Joined:  11/20/13
  • Last Seen:  

may i request a query to delete  the item 7179 from their inventory,cart,storage and guild storage

 

thank you...

Link to comment
Share on other sites

7 answers to this question

Recommended Posts


  • Group:  Members
  • Topic Count:  7
  • Topics Per Day:  0.00
  • Content Count:  135
  • Reputation:   41
  • Joined:  02/05/14
  • Last Seen:  

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
Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  7
  • Topics Per Day:  0.00
  • Content Count:  135
  • Reputation:   41
  • Joined:  02/05/14
  • Last Seen:  

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
Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  66
  • Topics Per Day:  0.02
  • Content Count:  168
  • Reputation:   0
  • Joined:  11/20/13
  • Last Seen:  

 

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

Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  66
  • Topics Per Day:  0.02
  • Content Count:  168
  • Reputation:   0
  • Joined:  11/20/13
  • Last Seen:  

what if the player equipped that item?

Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  7
  • Topics Per Day:  0.00
  • Content Count:  135
  • Reputation:   41
  • Joined:  02/05/14
  • Last Seen:  

what if the player equipped that item?

 

It's still in their inventory even when equipped, so it would similarly get deleted.

Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  66
  • Topics Per Day:  0.02
  • Content Count:  168
  • Reputation:   0
  • Joined:  11/20/13
  • Last Seen:  

oh ok thank you...

Link to comment
Share on other sites


  • Group:  Developer
  • Topic Count:  10
  • Topics Per Day:  0.00
  • Content Count:  2407
  • Reputation:   613
  • Joined:  07/05/12
  • Last Seen:  

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
Link to comment
Share on other sites

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.

×
×
  • Create New...