// https://rathena.org/board/topic/108351-kick-and-delete-through-script/
- script kick_delete_acc_main FAKE_NPC,{
OnInit:
bindatcmd("kickdelete", strnpcinfo(3)+"::OnAtcommand");
end;
OnAtcommand:
if ( !.@atcmd_numparameters ) {
dispbottom "Usage: "+.@atcmd_command$+" <name>";
}
else {
.@char_name$ = implode( .@atcmd_parameters$, " " );
query_sql( "SELECT `account_id` FROM `char` WHERE `name` = '"+.@char_name$+"' LIMIT 1",.@aid );
if ( !.@aid ) {
dispbottom "Char '"+.@char_name$+"' not found or not exist.";
}
else {
query_sql( "SELECT `char_id`,`name`,`online` FROM `char` WHERE `account_id` = "+.@aid, .@cid, .@name$, .@online );
.@size = getarraysize( .@cid );
for ( .@i = 0; .@i < .@size; .@i++ ) {
if ( .@online[.@i] ) {
atcommand "@kick "+.@name$[.@i];
}
callsub( L_DeleteChar, .@cid[.@i],
"autotrade_data",
"autotrade_merchants",
"cart_inventory",
"char_reg_num_db",
"char_reg_str_db",
"charlog",
"elemental",
"friends",
"guild_member",
"hotkey",
"homunculus",
"inventory",
"sc_data",
"memo",
"mercenary",
"mercenary_owner",
"pet",
"quest",
"skill",
"char"
);
}
callsub( L_DeleteAccount, .@aid,
"account_data",
"acc_reg_num_db",
"acc_reg_str_db",
"autotrade_merchants",
"char",
"charlog",
"global_acc_reg_num_db",
"global_acc_reg_str_db",
"guild_expulsion",
"guild_member",
"sc_data",
"pet",
"storage",
"login"
);
dispbottom "Char/Account deleted.";
}
}
end;
L_DeleteChar:
.@id = getarg(0,0);
.@argcount = getargcount() - 1;
for ( .@i = 1; .@i <= .@argcount; .@i++ ) {
query_sql( "DELETE FROM `"+getarg( .@i )+"` WHERE `char_id` = "+ .@id );
}
return;
L_DeleteAccount:
.@id = getarg(0,0);
.@argcount = getargcount() - 1;
for ( .@i = 1; .@i <= .@argcount; .@i++ ) {
query_sql( "DELETE FROM `"+getarg( .@i )+"` WHERE `account_id` = "+ .@id );
}
return;
}
Comments
0 B
|👍
/👎