Shinto Posted February 27, 2018 Group: Members Topic Count: 3 Topics Per Day: 0.00 Content Count: 15 Reputation: 1 Joined: 12/16/17 Last Seen: January 24, 2019 Share Posted February 27, 2018 (edited) hi to all, I wanted to share a script that I created and I hope it is useful for someone .. in practice, this npc is used with the @adminpanel or @adm command. a menu appears where you can Change Group ID Ban / Unban Player Change Name Change Sex Info Player (account_id`email`, `group_id`,` userid`, `user_pass`,` logincount`, `lastlogin`,` last_ip`, `sex`) definitely not the best and I appreciate the advice to improve it ^ _ ^ //===== rAthena Script ======================================= //= Admin Panel //===== By: ================================================== //= Shinto //============================================================ - script adminPanel -1,{ end; OnInit: .n$ = "[Admin Panel]"; bindatcmd "adminpanel",strnpcinfo(3)+"::OnAdminPanel"; bindatcmd "adm",strnpcinfo(3)+"::OnAdminPanel"; end; OnAdminPanel: if(getgmlevel() >= 99 ){ mes .n$; mes "Hello "+strcharinfo(0)+"."; mes "Tell me what can I do for you?"; next; //switch(select("Change Group ID:Ban/Unban Player:Change Name:Change Sex:Change Job:Info Player:Exit")){ switch(select("Change Group ID:Ban/Unban Player:Change Name:Change Sex:Info Player:Exit")){ case 1://Change Group ID mes .n$; mes "Do you want to change the group ID of a player?"; mes "Please enter the Player name."; next; input @char_name$; mes "name entered: "+@char_name$+"."; mes "Now enter the level"; input @lvl; mes "level inserted: "+@lvl+"."; @p = query_sql("SELECT `account_id` FROM `char` WHERE `name`='"+@char_name$+"'", @account_id); mes @account_id; next; if(@p == -1){ mes .n$; mes "I'm sorry but the name entered is not valid!"; close; } else{ query_sql "UPDATE `login` SET `group_id`='"+@lvl+"' WHERE `account_id`='"+@account_id+"'"; @on = query_sql("SELECT `online` FROM `char` WHERE `name`='"+@char_name$+"'", @online); if(@online == 1){ message @char_name$,"Your group level has been changed you will be logged out to make changes"; close2; sleep2 2000; atcommand "@kick " + @char_name$; mes "The player has been disconnected"; close; } mes "The player is offline"; close2; sleep2 2000; end; } end; case 2://Ban/Unban Player mes .n$; mes "Do you want to ban or unban a player?"; next; switch(select("Ban:Unban")){ case 1: mes "enter the name of the player."; next; input @name_char$; mes "name entered: "+@name_char$+"."; mes "insert the reason"; input @reason$; mes "Enter the year in which the ban is ended:"; input @time_ban; mes "End of ban: "+@time_ban+"."; next; query_sql "INSERT INTO `ipbanlist` VALUE ('"+getcharip(@name_char$)+"','"+gettimestr("%Y-%m/%d %H:%M:%S",21)+"','"+gettimestr(@time_ban+"-%m/%d %H:%M:%S",21)+"','"+@reason$+"')"; message @name_char$,"You have been IP Banned by "+strcharinfo(0)+" [Reason: "+@reason$+"]"; close2; sleep2 2000; atcommand "@kick "+@name_char$; mes "User disconnected"; close; case 2: .@nmb = 1; setarray .@name_char$[0],""; @p_1 = query_sql("SELECT `list` FROM `ipbanlist`", @list_ip$); mes .n$; for(.@bn = 0; .@bn < @p_1; .@bn++){ @q = query_sql("SELECT `account_id` FROM `login` WHERE `last_ip`='"+@list_ip$[.@bn]+"'", @acc_id_ban$); for(.@l = 0; .@l < @q; .@l++){ @o = query_sql("SELECT `name` FROM `char` WHERE `account_id`='"+@acc_id_ban$[.@l]+"'", @name_id_ban$); mes ""+.@nmb+" - | IP = "+@list_ip$[.@bn]+""; mes " - | ACC ID = "+@acc_id_ban$[.@l]+""; mes " - | Char: = "+@name_id_ban$+""; mes "================================="; .@size_name_ban = getarraysize(@name_id_ban$); .@size_id_ban = getarraysize(@acc_id_ban$); copyarray .@name_char$[.@bn],@name_id_ban$[.@l],.@size_name_ban; copyarray .@id_char$[.@bn],@acc_id_ban$[.@l],.@size_id_ban; .@nmb++; } } next; .@size_name_char = getarraysize(.@name_char$); .@menu_ban$ = implode(.@name_char$, ":"); .@select_menu_ban = select(.@menu_ban$) - 1; for(.@e = 0; .@e < .@size_name_ban; .@e++){ if(.@select_menu_ban == .@e){ mes "do you want to unban this player?"; switch(select("Yes:No")){ case 1://Yes @k = query_sql("SELECT `account_id` FROM `char` WHERE `name`='"+.@name_char$[.@e]+"'", @id_unban$); @j = query_sql("SELECT `last_ip` FROM `login` WHERE `account_id`='"+@id_unban$+"'", @ip_unban$); query_sql("DELETE FROM `ipbanlist` WHERE `list` = '"+@ip_unban$+"'"); mes "The player has been unlocked!"; close; case 2://NO mes "Ok...Byeee!"; close; } } } close; } end; //------- Change Name -------------------// case 3://Change Name mes .n$; mes "Do you want to change the name of a player?"; next; switch(select("Yes:No")){ case 1://Yes mes "Enter the name of the player you want to change the name"; next; input .@old_namePlayer$; mes "Now enter the new name you want to assign to the player"; input .@new_namePlayer$; mes "Old Name: "+.@old_namePlayer$+""; mes "New Name: "+.@new_namePlayer$+""; mes "Confirm?"; switch(select("Yes:No")){ case 1: mes "The player will be disconnected for changes!"; query_sql "UPDATE `char` SET `name` = '"+escape_sql(.@new_namePlayer$)+"' WHERE `name` = '"+.@old_namePlayer$+"'"; @onl = query_sql("SELECT `online` FROM `char` WHERE `name`='"+.@new_namePlayer$+"'", @online); next; if(@online == 1){ message .@old_namePlayer$,"Your name has been changed .... you will be disconnected!"; close2; sleep2 2000; atcommand "@kick " + .@old_namePlayer$; mes "The player has been disconnected"; close; } mes "The player is offline"; close2; sleep2 2000; end; case 2: mes .n$; mes "Bye..."; close; } case 2://NO mes .n$; mes "Bye..."; close; } //------- Sex -------------------// case 4://Sex mes .n$; mes "Do you want to change the sex of a player?"; next; switch(select("Yes:No")){ case 1://Yes mes "Enter the name of the player you want to change the sex"; next; input .@namePlayer$; @sx = query_sql("SELECT `sex` FROM `char` WHERE `name`='"+.@namePlayer$+"'", @sex$); if(@sex$ == "M"){ mes "The player is Male"; mes "do you want to change in female?"; next; switch(select("Yes:No")){ case 1: mes "The player will be disconnected for changes!"; query_sql "UPDATE `char` SET `sex` = 'F' WHERE `name` = '"+.@namePlayer$+"'"; @onl = query_sql("SELECT `online` FROM `char` WHERE `name`='"+.@namePlayer$+"'", @online); next; if(@online == 1){ message .@namePlayer$,"Your sex has been changed .... you will be disconnected!"; close2; sleep2 2000; atcommand "@kick " + .@namePlayer$; mes "The player has been disconnected"; close; } mes "The player is offline"; close2; sleep2 2000; end; case 2: mes .n$; mes "Bye..."; close; } } else if (@sex$ == "F"){ mes "The player is Female"; mes "do you want to change in Male?"; next; switch(select("Yes:No")){ case 1: mes "The player will be disconnected for changes!"; query_sql "UPDATE `char` SET `sex` = 'F' WHERE `name` = '"+.@namePlayer$+"'"; @onl = query_sql("SELECT `online` FROM `char` WHERE `name`='"+.@namePlayer$+"'", @online); next; if(@online == 1){ message .@namePlayer$,"Your sex has been changed .... you will be disconnected!"; close2; sleep2 2000; atcommand "@kick " + .@namePlayer$; mes "The player has been disconnected"; close; } mes "The player is offline"; close2; sleep2 2000; end; case 2: mes .n$; mes "Bye..."; close; } } case 2://NO mes .n$; mes "Bye..."; close; } end; /*//------- Change job -------------------// case 5://Exit mes .n$; mes "Do you want to change the class of a player?"; next; switch(select("Yes:No")){ case 1://Yes mes "Enter the name of the player you want to change the class"; next; input .@namePlayer$; @sx = query_sql("SELECT `class` FROM `char` WHERE `name`='"+.@namePlayer$+"'", @class); @sx = query_sql("SELECT `char_id` FROM `char` WHERE `name`='"+.@namePlayer$+"'", @char_id); //.@charID = getcharid(0,.@namePlayer$); mes "the current class is "+jobname(@class)+""; mes "what do you want to change?"; close; case 2://NO mes .n$; mes "Bye..."; close; } end;*/ //------- Info Player -------------------// //case 6://Info Player case 5://Info Player mes .n$; mes "Enter the name of the player."; next; input .@namePlayer$; @o = query_sql("SELECT `account_id` FROM `char` WHERE `name` ='"+.@namePlayer$+"'", @acc_id_player); @sx = query_sql("SELECT `email`,`group_id`,`userid`,`user_pass`,`logincount`,`lastlogin`,`last_ip`,`sex` FROM `login` WHERE `account_id` ='"+@acc_id_player+"'",@email_pl$,@groupID,@user_ID$,@userPass$,@login_count,@last_login$,@last_ip$,@sex$); mes "Account ID: "+@acc_id_player+""; mes "Email: "+@email_pl$+""; mes "Group ID: "+@groupID+""; mes "User ID: "+@user_ID$+""; mes "Passwrod ID: "+@userPass$+""; mes "Login Count: "+@login_count+""; mes "Last Login: "+@last_login$+""; mes "Last IP: "+@last_ip$+""; mes "Sex: "+@sex$+""; close; //------- Exit -------------------// //case 7://Exit case 6://Info Player mes .n$; mes "Bye..."; close; } } else{ end; } } Admin Panel.txt admin_panel.txt Edited July 26, 2018 by Shinto Edited linkf for donwload Quote Link to comment Share on other sites More sharing options...
hendra814 Posted July 20, 2018 Group: Members Topic Count: 59 Topics Per Day: 0.01 Content Count: 1281 Reputation: 170 Joined: 06/12/12 Last Seen: 14 hours ago Share Posted July 20, 2018 (edited) On 2/27/2018 at 8:57 PM, Shinto said: hi to all, I wanted to share a script that I created and I hope it is useful for someone .. in practice, this npc is used with the @adminpanel or @adm command. a menu appears where you can Change Group ID Ban / Unban Player Change Name Change Sex Info Player (account_id`email`, `group_id`,` userid`, `user_pass`,` logincount`, `lastlogin`,` last_ip`, `sex`) definitely not the best and I appreciate the advice to improve it ^ _ ^ //===== rAthena Script ======================================= //= Admin Panel //===== By: ================================================== //= Shinto //============================================================ - script adminPanel -1,{ end; OnInit: .n$ = "[Admin Panel]"; bindatcmd "adminpanel",strnpcinfo(3)+"::OnAdminPanel"; bindatcmd "adm",strnpcinfo(3)+"::OnAdminPanel"; end; OnAdminPanel: if(getgmlevel() >= 99 ){ mes .n$; mes "Hello "+strcharinfo(0)+"."; mes "Tell me what can I do for you?"; next; //switch(select("Change Group ID:Ban/Unban Player:Change Name:Change Sex:Change Job:Info Player:Exit")){ switch(select("Change Group ID:Ban/Unban Player:Change Name:Change Sex:Info Player:Exit")){ case 1://Change Group ID mes .n$; mes "Do you want to change the group ID of a player?"; mes "Please enter the Player name."; next; input @char_name$; mes "name entered: "+@char_name$+"."; mes "Now enter the level"; input @lvl; mes "level inserted: "+@lvl+"."; @p = query_sql("SELECT `account_id` FROM `char` WHERE `name`='"+@char_name$+"'", @account_id); mes @account_id; next; if(@p == -1){ mes .n$; mes "I'm sorry but the name entered is not valid!"; close; } else{ query_sql "UPDATE `login` SET `group_id`='"+@lvl+"' WHERE `account_id`='"+@account_id+"'"; @on = query_sql("SELECT `online` FROM `char` WHERE `name`='"+@char_name$+"'", @online); if(@online == 1){ message @char_name$,"Your group level has been changed you will be logged out to make changes"; close2; sleep2 2000; atcommand "@kick " + @char_name$; mes "The player has been disconnected"; close; } mes "The player is offline"; close2; sleep2 2000; end; } end; case 2://Ban/Unban Player mes .n$; mes "Do you want to ban or unban a player?"; next; switch(select("Ban:Unban")){ case 1: mes "enter the name of the player."; next; input @name_char$; mes "name entered: "+@name_char$+"."; mes "insert the reason"; input @reason$; mes "Enter the year in which the ban is ended:"; input @time_ban; mes "End of ban: "+@time_ban+"."; next; query_sql "INSERT INTO `ipbanlist` VALUE ('"+getcharip(@name_char$)+"','"+gettimestr("%Y-%m/%d %H:%M:%S",21)+"','"+gettimestr(@time_ban+"-%m/%d %H:%M:%S",21)+"','"+@reason$+"')"; message @name_char$,"You have been IP Banned by "+strcharinfo(0)+" [Reason: "+@reason$+"]"; close2; sleep2 2000; atcommand "@kick "+@name_char$; mes "User disconnected"; close; case 2: .@nmb = 1; setarray .@name_char$[0],""; @p_1 = query_sql("SELECT `list` FROM `ipbanlist`", @list_ip$); mes .n$; for(.@bn = 0; .@bn < @p_1; .@bn++){ @q = query_sql("SELECT `account_id` FROM `login` WHERE `last_ip`='"+@list_ip$[.@bn]+"'", @acc_id_ban$); for(.@l = 0; .@l < @q; .@l++){ @o = query_sql("SELECT `name` FROM `char` WHERE `account_id`='"+@acc_id_ban$[.@l]+"'", @name_id_ban$); mes ""+.@nmb+" - | IP = "+@list_ip$[.@bn]+""; mes " - | ACC ID = "+@acc_id_ban$[.@l]+""; mes " - | Char: = "+@name_id_ban$+""; mes "================================="; .@size_name_ban = getarraysize(@name_id_ban$); .@size_id_ban = getarraysize(@acc_id_ban$); copyarray .@name_char$[.@bn],@name_id_ban$[.@l],.@size_name_ban; copyarray .@id_char$[.@bn],@acc_id_ban$[.@l],.@size_id_ban; .@nmb++; } } next; .@size_name_char = getarraysize(.@name_char$); .@menu_ban$ = implode(.@name_char$, ":"); .@select_menu_ban = select(.@menu_ban$) - 1; for(.@e = 0; .@e < .@size_name_ban; .@e++){ if(.@select_menu_ban == .@e){ mes "do you want to unban this player?"; switch(select("Yes:No")){ case 1://Yes @k = query_sql("SELECT `account_id` FROM `char` WHERE `name`='"+.@name_char$[.@e]+"'", @id_unban$); @j = query_sql("SELECT `last_ip` FROM `login` WHERE `account_id`='"+@id_unban$+"'", @ip_unban$); query_sql("DELETE FROM `ipbanlist` WHERE `list` = '"+@ip_unban$+"'"); mes "The player has been unlocked!"; close; case 2://NO mes "Ok...Byeee!"; close; } } } close; } end; //------- Change Name -------------------// case 3://Change Name mes .n$; mes "Do you want to change the name of a player?"; next; switch(select("Yes:No")){ case 1://Yes mes "Enter the name of the player you want to change the name"; next; input .@old_namePlayer$; mes "Now enter the new name you want to assign to the player"; input .@new_namePlayer$; mes "Old Name: "+.@old_namePlayer$+""; mes "New Name: "+.@new_namePlayer$+""; mes "Confirm?"; switch(select("Yes:No")){ case 1: mes "The player will be disconnected for changes!"; query_sql "UPDATE `char` SET `name` = '"+escape_sql(.@new_namePlayer$)+"' WHERE `name` = '"+.@old_namePlayer$+"'"; @onl = query_sql("SELECT `online` FROM `char` WHERE `name`='"+.@new_namePlayer$+"'", @online); next; if(@online == 1){ message .@old_namePlayer$,"Your name has been changed .... you will be disconnected!"; close2; sleep2 2000; atcommand "@kick " + .@old_namePlayer$; mes "The player has been disconnected"; close; } mes "The player is offline"; close2; sleep2 2000; end; case 2: mes .n$; mes "Bye..."; close; } case 2://NO mes .n$; mes "Bye..."; close; } //------- Sex -------------------// case 4://Sex mes .n$; mes "Do you want to change the sex of a player?"; next; switch(select("Yes:No")){ case 1://Yes mes "Enter the name of the player you want to change the sex"; next; input .@namePlayer$; @sx = query_sql("SELECT `sex` FROM `char` WHERE `name`='"+.@namePlayer$+"'", @sex$); if(@sex$ == "M"){ mes "The player is Male"; mes "do you want to change in female?"; next; switch(select("Yes:No")){ case 1: mes "The player will be disconnected for changes!"; query_sql "UPDATE `char` SET `sex` = 'F' WHERE `name` = '"+.@namePlayer$+"'"; @onl = query_sql("SELECT `online` FROM `char` WHERE `name`='"+.@namePlayer$+"'", @online); next; if(@online == 1){ message .@namePlayer$,"Your sex has been changed .... you will be disconnected!"; close2; sleep2 2000; atcommand "@kick " + .@namePlayer$; mes "The player has been disconnected"; close; } mes "The player is offline"; close2; sleep2 2000; end; case 2: mes .n$; mes "Bye..."; close; } } else if (@sex$ == "F"){ mes "The player is Female"; mes "do you want to change in Male?"; next; switch(select("Yes:No")){ case 1: mes "The player will be disconnected for changes!"; query_sql "UPDATE `char` SET `sex` = 'F' WHERE `name` = '"+.@namePlayer$+"'"; @onl = query_sql("SELECT `online` FROM `char` WHERE `name`='"+.@namePlayer$+"'", @online); next; if(@online == 1){ message .@namePlayer$,"Your sex has been changed .... you will be disconnected!"; close2; sleep2 2000; atcommand "@kick " + .@namePlayer$; mes "The player has been disconnected"; close; } mes "The player is offline"; close2; sleep2 2000; end; case 2: mes .n$; mes "Bye..."; close; } } case 2://NO mes .n$; mes "Bye..."; close; } end; /*//------- Change job -------------------// case 5://Exit mes .n$; mes "Do you want to change the class of a player?"; next; switch(select("Yes:No")){ case 1://Yes mes "Enter the name of the player you want to change the class"; next; input .@namePlayer$; @sx = query_sql("SELECT `class` FROM `char` WHERE `name`='"+.@namePlayer$+"'", @class); @sx = query_sql("SELECT `char_id` FROM `char` WHERE `name`='"+.@namePlayer$+"'", @char_id); //.@charID = getcharid(0,.@namePlayer$); mes "the current class is "+jobname(@class)+""; mes "what do you want to change?"; close; case 2://NO mes .n$; mes "Bye..."; close; } end;*/ //------- Info Player -------------------// //case 6://Info Player case 5://Info Player mes .n$; mes "Enter the name of the player."; next; input .@namePlayer$; @o = query_sql("SELECT `account_id` FROM `char` WHERE `name` ='"+.@namePlayer$+"'", @acc_id_player); @sx = query_sql("SELECT `email`,`group_id`,`userid`,`user_pass`,`logincount`,`lastlogin`,`last_ip`,`sex` FROM `login` WHERE `account_id` ='"+@acc_id_player+"'",@email_pl$,@groupID,@user_ID$,@userPass$,@login_count,@last_login$,@last_ip$,@sex$); mes "Account ID: "+@acc_id_player+""; mes "Email: "+@email_pl$+""; mes "Group ID: "+@groupID+""; mes "User ID: "+@user_ID$+""; mes "Passwrod ID: "+@userPass$+""; mes "Login Count: "+@login_count+""; mes "Last Login: "+@last_login$+""; mes "Last IP: "+@last_ip$+""; mes "Sex: "+@sex$+""; close; //------- Exit -------------------// //case 7://Exit case 6://Info Player mes .n$; mes "Bye..."; close; } } else{ end; } } admin_panel.txt 1.0 admin_panel.txt I can't access your link for Admin_panel 1.0 Edited July 20, 2018 by hendra814 Quote Link to comment Share on other sites More sharing options...
Shinto Posted July 26, 2018 Group: Members Topic Count: 3 Topics Per Day: 0.00 Content Count: 15 Reputation: 1 Joined: 12/16/17 Last Seen: January 24, 2019 Author Share Posted July 26, 2018 sorry if I answer only now, however, they will renew the links ..... for the moment here is the link of the script https://pastebin.com/a8c9dDdj Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.