Jump to content
  • 0

SQL commands for wiping account


Dori

Question


  • Group:  Members
  • Topic Count:  105
  • Topics Per Day:  0.02
  • Content Count:  332
  • Reputation:   15
  • Joined:  12/11/11
  • Last Seen:  

I want to know how to completely clear everything related to a certain account (char, storage, inventory, pets..etc) with SQL.

Thank you.

 

 

Link to comment
Share on other sites

1 answer to this question

Recommended Posts


  • Group:  Members
  • Topic Count:  31
  • Topics Per Day:  0.01
  • Content Count:  283
  • Reputation:   31
  • Joined:  07/08/14
  • Last Seen:  

-	script	DeleteAccount	-1,{
OnInit:
	bindatcmd "delaccount",strnpcinfo(0)+"::OnDelete",99,99;
	// @delaccount <account_id>
	end;
	
OnDelete:
	.@account_id = atoi(.@atcmd_parameters$);
	setarray .@log$ , "atcommandlog","branchlog","cashlog","chatlog","loginlog","mvplog","npclog","picklog","zenylog";
	setarray .@ragnarok$ , "auction","bonus_script","buyingstore_items","buyingstores","cart_inventory","char","charlog","elemental",
						   "friends","global_reg_value","guild","guild_alliance","guild_castle","guild_expulsion","guild_member",
						   "guild_position","guild_skill","guild_storage","homunculus","hotkey","interlog","interreg","inventory",
						   "ipbanlist","login","mail","mapreg","memo","mercenary","mercenary_owner","party","pet","quest","ragsrvinfo",
						   "sc_data","skill","skill_homunculus","skillcooldown","sstatus","storage","vendig_items","vendings";
	for (.@i = 0 ; .@i < getarraysize(.@log$) ; .@i++) query_sql("DELETE FROM `log`.`"+.@log$[.@i]+"` WHERE `` = '"+account_id+"'");
	for (.@i = 0 ; .@i < getarraysize(.@ragnarok$) ; .@i++) query_sql("DELETE FROM `ragnarok`.`"+.@ragnarok$[.@i]+"` WHERE `` = '"+account_id+"'");
	dispbottom "all SQL data has been erased on account_id "+.@account_id;
}

There must be another simplier way to do it but I don't know it ^^

 

Make sure that all those tables are in your sql workbench and add those which are missing (I didn't put my custom tables and my vote table but I still have the auction tables)

 

I din't test it but it's pretty simple so there should be no problem.

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...