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