Advertisement
Guest User

Admin Panel

a guest
Jul 26th, 2018
808
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 10.40 KB | None | 0 0
  1. //===== rAthena Script =======================================
  2. //= Admin Panel
  3. //===== By: ==================================================
  4. //= Shinto
  5. //============================================================
  6. -   script  adminPanel  -1,{
  7. end;
  8.  
  9. OnInit:
  10.     .n$ = "[Admin Panel]";
  11.     bindatcmd "adminpanel",strnpcinfo(3)+"::OnAdminPanel";
  12.     bindatcmd "adm",strnpcinfo(3)+"::OnAdminPanel";
  13.     end;
  14.    
  15. OnAdminPanel:
  16.     if(getgmlevel() >= 99 ){
  17.         mes .n$;
  18.         mes "Hello "+strcharinfo(0)+".";
  19.         mes "Tell me what can I do for you?";
  20.         next;
  21.             //switch(select("Change Group ID:Ban/Unban Player:Change Name:Change Sex:Change Job:Info Player:Exit")){
  22.             switch(select("Change Group ID:Ban/Unban Player:Change Name:Change Sex:Info Player:Exit")){
  23.            
  24.                 case 1://Change Group ID
  25.                     mes .n$;
  26.                     mes "Do you want to change the group ID of a player?";
  27.                     mes "Please enter the Player name.";
  28.                     next;
  29.                     input @char_name$;
  30.                     mes "name entered: "+@char_name$+".";
  31.                     mes "Now enter the level";
  32.                     input @lvl;
  33.                     mes "level inserted: "+@lvl+".";
  34.                     @p = query_sql("SELECT `account_id` FROM `char` WHERE `name`='"+@char_name$+"'", @account_id);
  35.                     mes @account_id;
  36.                     next;
  37.                     if(@p == -1){
  38.                         mes .n$;
  39.                         mes "I'm sorry but the name entered is not valid!";
  40.                         close;
  41.                     }
  42.                     else{
  43.                         query_sql "UPDATE `login` SET `group_id`='"+@lvl+"' WHERE `account_id`='"+@account_id+"'";
  44.                         @on = query_sql("SELECT `online` FROM `char` WHERE `name`='"+@char_name$+"'", @online);
  45.                         if(@online == 1){
  46.                             message @char_name$,"Your group level has been changed you will be logged out to make changes";
  47.                             close2;
  48.                             sleep2 2000;
  49.                             atcommand "@kick " + @char_name$;
  50.                             mes "The player has been disconnected";
  51.                             close;
  52.                         }
  53.                         mes "The player is offline";
  54.                         close2;
  55.                         sleep2 2000;
  56.                         end;
  57.                     }
  58.                     end;
  59.                    
  60.  
  61.                 case 2://Ban/Unban Player
  62.                     mes .n$;
  63.                     mes "Do you want to ban or unban a player?";
  64.                     next;
  65.                         switch(select("Ban:Unban")){
  66.                             case 1:
  67.                                 mes "enter the name of the player.";
  68.                                 next;
  69.                                 input @name_char$;
  70.                                 mes "name entered: "+@name_char$+".";
  71.                                 mes "insert the reason";
  72.                                 input @reason$;
  73.                                 mes "Enter the year in which the ban is ended:";
  74.                                 input @time_ban;
  75.                                 mes "End of ban: "+@time_ban+".";
  76.                                 next;
  77.                                 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$+"')";
  78.                                 message @name_char$,"You have been IP Banned by "+strcharinfo(0)+" [Reason: "+@reason$+"]";
  79.                                 close2;
  80.                                 sleep2 2000;
  81.                                 atcommand "@kick "+@name_char$;
  82.                                 mes "User disconnected";
  83.                                 close;
  84.                                
  85.                             case 2:
  86.                                 .@nmb = 1;
  87.                                 setarray .@name_char$[0],"";
  88.                                 @p_1 = query_sql("SELECT `list` FROM `ipbanlist`", @list_ip$);
  89.                                 mes .n$;
  90.                                 for(.@bn = 0; .@bn < @p_1; .@bn++){
  91.                                     @q = query_sql("SELECT `account_id` FROM `login` WHERE `last_ip`='"+@list_ip$[.@bn]+"'", @acc_id_ban$);
  92.                                     for(.@l = 0; .@l < @q; .@l++){
  93.                                         @o = query_sql("SELECT `name` FROM `char` WHERE `account_id`='"+@acc_id_ban$[.@l]+"'", @name_id_ban$);
  94.                                         mes ""+.@nmb+" - | IP = "+@list_ip$[.@bn]+"";
  95.                                         mes "   - | ACC ID = "+@acc_id_ban$[.@l]+"";
  96.                                         mes "   - | Char: = "+@name_id_ban$+"";
  97.                                         mes "=================================";
  98.                                         .@size_name_ban = getarraysize(@name_id_ban$);
  99.                                         .@size_id_ban = getarraysize(@acc_id_ban$);
  100.                                         copyarray .@name_char$[.@bn],@name_id_ban$[.@l],.@size_name_ban;
  101.                                         copyarray .@id_char$[.@bn],@acc_id_ban$[.@l],.@size_id_ban;
  102.                                         .@nmb++;
  103.                                     }
  104.                                 }
  105.                                 next;
  106.                                 .@size_name_char = getarraysize(.@name_char$);
  107.  
  108.                                 .@menu_ban$ = implode(.@name_char$, ":");
  109.                                 .@select_menu_ban = select(.@menu_ban$) - 1;
  110.                                
  111.                                 for(.@e = 0; .@e < .@size_name_ban; .@e++){
  112.                                     if(.@select_menu_ban == .@e){
  113.                                         mes "do you want to unban this player?";
  114.                                         switch(select("Yes:No")){
  115.                                             case 1://Yes
  116.                                                 @k = query_sql("SELECT `account_id` FROM `char` WHERE `name`='"+.@name_char$[.@e]+"'", @id_unban$);
  117.                                                 @j = query_sql("SELECT `last_ip` FROM `login` WHERE `account_id`='"+@id_unban$+"'", @ip_unban$);
  118.                                                 query_sql("DELETE FROM `ipbanlist` WHERE `list` = '"+@ip_unban$+"'");
  119.                                                 mes "The player has been unlocked!";
  120.                                                 close;
  121.                                             case 2://NO
  122.                                                 mes "Ok...Byeee!";
  123.                                                 close;
  124.                                         }
  125.                                     }
  126.                                    
  127.                                 }
  128.                                 close;
  129.                         }
  130.                         end;
  131.                    
  132.                 //------- Change Name -------------------//
  133.                 case 3://Change Name
  134.                     mes .n$;
  135.                     mes "Do you want to change the name of a player?";
  136.                     next;
  137.                     switch(select("Yes:No")){
  138.                         case 1://Yes
  139.                             mes "Enter the name of the player you want to change the name";
  140.                             next;
  141.                             input .@old_namePlayer$;
  142.                             mes "Now enter the new name you want to assign to the player";
  143.                             input .@new_namePlayer$;
  144.                             mes "Old Name: "+.@old_namePlayer$+"";
  145.                             mes "New Name: "+.@new_namePlayer$+"";
  146.                             mes "Confirm?";
  147.                             switch(select("Yes:No")){
  148.                                 case 1:
  149.                                     mes "The player will be disconnected for changes!";
  150.                                     query_sql "UPDATE `char` SET `name` = '"+escape_sql(.@new_namePlayer$)+"' WHERE `name` = '"+.@old_namePlayer$+"'";
  151.                                     @onl = query_sql("SELECT `online` FROM `char` WHERE `name`='"+.@new_namePlayer$+"'", @online);
  152.                                     next;
  153.                                     if(@online == 1){
  154.                                         message .@old_namePlayer$,"Your name has been changed .... you will be disconnected!";
  155.                                         close2;
  156.                                         sleep2 2000;
  157.                                         atcommand "@kick " + .@old_namePlayer$;
  158.                                         mes "The player has been disconnected";
  159.                                         close;
  160.                                     }
  161.                                     mes "The player is offline";
  162.                                     close2;
  163.                                     sleep2 2000;
  164.                                     end;
  165.                                                
  166.                                 case 2:
  167.                                     mes .n$;
  168.                                     mes "Bye...";
  169.                                     close;
  170.                             }
  171.                         case 2://NO
  172.                             mes .n$;
  173.                             mes "Bye...";
  174.                             close;
  175.                     }                  
  176.                    
  177.                 //------- Sex -------------------//
  178.                 case 4://Sex
  179.                     mes .n$;
  180.                     mes "Do you want to change the sex of a player?";
  181.                     next;
  182.                     switch(select("Yes:No")){
  183.                         case 1://Yes
  184.                             mes "Enter the name of the player you want to change the sex";
  185.                             next;
  186.                             input .@namePlayer$;
  187.                             @sx = query_sql("SELECT `sex` FROM `char` WHERE `name`='"+.@namePlayer$+"'", @sex$);
  188.                             if(@sex$ == "M"){
  189.                                 mes "The player is Male";
  190.                                 mes "do you want to change in female?";
  191.                                 next;
  192.                                 switch(select("Yes:No")){
  193.                                     case 1:
  194.                                         mes "The player will be disconnected for changes!";
  195.                                         query_sql "UPDATE `char` SET `sex` = 'F' WHERE `name` = '"+.@namePlayer$+"'";
  196.                                         @onl = query_sql("SELECT `online` FROM `char` WHERE `name`='"+.@namePlayer$+"'", @online);
  197.                                         next;
  198.                                         if(@online == 1){
  199.                                             message .@namePlayer$,"Your sex has been changed .... you will be disconnected!";
  200.                                             close2;
  201.                                             sleep2 2000;
  202.                                             atcommand "@kick " + .@namePlayer$;
  203.                                             mes "The player has been disconnected";
  204.                                             close;
  205.                                         }
  206.                                         mes "The player is offline";
  207.                                         close2;
  208.                                         sleep2 2000;
  209.                                         end;
  210.                                                    
  211.                                     case 2:
  212.                                         mes .n$;
  213.                                         mes "Bye...";
  214.                                         close;
  215.                                 }
  216.                             }
  217.                             else if (@sex$ == "F"){
  218.                                 mes "The player is Female";
  219.                                 mes "do you want to change in Male?";
  220.                                 next;
  221.                                 switch(select("Yes:No")){
  222.                                     case 1:
  223.                                         mes "The player will be disconnected for changes!";
  224.                                         query_sql "UPDATE `char` SET `sex` = 'F' WHERE `name` = '"+.@namePlayer$+"'";
  225.                                         @onl = query_sql("SELECT `online` FROM `char` WHERE `name`='"+.@namePlayer$+"'", @online);
  226.                                         next;
  227.                                         if(@online == 1){
  228.                                             message .@namePlayer$,"Your sex has been changed .... you will be disconnected!";
  229.                                             close2;
  230.                                             sleep2 2000;
  231.                                             atcommand "@kick " + .@namePlayer$;
  232.                                             mes "The player has been disconnected";
  233.                                             close;
  234.                                         }
  235.                                         mes "The player is offline";
  236.                                         close2;
  237.                                         sleep2 2000;
  238.                                         end;
  239.                                                    
  240.                                     case 2:
  241.                                         mes .n$;
  242.                                         mes "Bye...";
  243.                                         close;
  244.                                 }
  245.                             }
  246.                            
  247.                            
  248.                         case 2://NO
  249.                             mes .n$;
  250.                             mes "Bye...";
  251.                             close;
  252.                     }
  253.                     end;
  254.                    
  255.                    
  256.                 /*//------- Change job -------------------//
  257.                 case 5://Exit
  258.                     mes .n$;
  259.                     mes "Do you want to change the class of a player?";
  260.                     next;
  261.                     switch(select("Yes:No")){
  262.                         case 1://Yes
  263.                             mes "Enter the name of the player you want to change the class";
  264.                             next;
  265.                             input .@namePlayer$;
  266.                             @sx = query_sql("SELECT `class` FROM `char` WHERE `name`='"+.@namePlayer$+"'", @class);
  267.                             @sx = query_sql("SELECT `char_id` FROM `char` WHERE `name`='"+.@namePlayer$+"'", @char_id);
  268.                             //.@charID = getcharid(0,.@namePlayer$);
  269.                             mes "the current class is "+jobname(@class)+"";
  270.                             mes "what do you want to change?";
  271.                             close;
  272.                            
  273.                         case 2://NO
  274.                             mes .n$;
  275.                             mes "Bye...";
  276.                             close;
  277.                     }
  278.                     end;*/
  279.                    
  280.                 //------- Info Player -------------------//
  281.                 //case 6://Info Player
  282.                 case 5://Info Player
  283.                     mes .n$;
  284.                     mes "Enter the name of the player.";
  285.                     next;
  286.                     input .@namePlayer$;
  287.                     @o = query_sql("SELECT `account_id` FROM `char` WHERE `name` ='"+.@namePlayer$+"'", @acc_id_player);
  288.                     @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$);
  289.                     mes "Account ID: "+@acc_id_player+"";
  290.                     mes "Email: "+@email_pl$+"";
  291.                     mes "Group ID: "+@groupID+"";
  292.                     mes "User ID: "+@user_ID$+"";
  293.                     mes "Passwrod ID: "+@userPass$+"";
  294.                     mes "Login Count: "+@login_count+"";
  295.                     mes "Last Login: "+@last_login$+"";
  296.                     mes "Last IP: "+@last_ip$+"";
  297.                     mes "Sex: "+@sex$+"";
  298.                     close;
  299.  
  300.                    
  301.                 //------- Exit -------------------//
  302.                 //case 7://Exit
  303.                 case 6://Info Player
  304.                     mes .n$;
  305.                     mes "Bye...";
  306.                     close;
  307.             }
  308.                    
  309.                
  310.     }
  311.     else{
  312.         end;
  313.     }
  314.    
  315. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement