Jump to content
Shinto

Utility: Admin Panel

Recommended Posts

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: "[email protected]_name$+".";
					mes "Now enter the level";
					input @lvl;
					mes "level inserted: "[email protected]+".";
					@p = query_sql("SELECT `account_id` FROM `char` WHERE `name`='"[email protected]_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`='"[email protected]+"' WHERE `account_id`='"[email protected]_id+"'";
						@on = query_sql("SELECT `online` FROM `char` WHERE `name`='"[email protected]_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: "[email protected]_char$+".";
								mes "insert the reason";
								input @reason$;
								mes "Enter the year in which the ban is ended:";
								input @time_ban;
								mes "End of ban: "[email protected]_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)+"','"[email protected]$+"')";
								message @name_char$,"You have been IP Banned by "+strcharinfo(0)+" [Reason: "[email protected]$+"]"; 
								close2;
								sleep2 2000;
								atcommand "@kick "[email protected]_char$;
								mes "User disconnected";
								close;
								
							case 2:
								[email protected] = 1;
								setarray [email protected]_char$[0],"";
								@p_1 = query_sql("SELECT `list` FROM `ipbanlist`", @list_ip$);
								mes .n$;
								for([email protected] = 0; [email protected] < @p_1; [email protected]++){
									@q = query_sql("SELECT `account_id` FROM `login` WHERE `last_ip`='"[email protected]_ip$[[email protected]]+"'", @acc_id_ban$);
									for([email protected] = 0; [email protected] < @q; [email protected]++){
										@o = query_sql("SELECT `name` FROM `char` WHERE `account_id`='"[email protected]_id_ban$[[email protected]]+"'", @name_id_ban$);
										mes ""[email protected]+" - | IP = "[email protected]_ip$[[email protected]]+"";
										mes "   - | ACC ID = "[email protected]_id_ban$[[email protected]]+"";
										mes "   - | Char: = "[email protected]_id_ban$+"";
										mes "=================================";
										[email protected]_name_ban = getarraysize(@name_id_ban$);
										[email protected]_id_ban = getarraysize(@acc_id_ban$);
										copyarray [email protected]_char$[[email protected]],@name_id_ban$[[email protected]],[email protected]_name_ban;
										copyarray [email protected]_char$[[email protected]],@acc_id_ban$[[email protected]],[email protected]_id_ban;
										[email protected]++;
									}
								}
								next;
								[email protected]_name_char = getarraysize([email protected]_char$);

								[email protected]_ban$ = implode([email protected]_char$, ":");
								[email protected]_menu_ban = select([email protected]_ban$) - 1;
								
								for([email protected] = 0; [email protected] < [email protected]_name_ban; [email protected]++){
									if([email protected]_menu_ban == [email protected]){
										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`='"[email protected]_char$[[email protected]]+"'", @id_unban$);
												@j = query_sql("SELECT `last_ip` FROM `login` WHERE `account_id`='"[email protected]_unban$+"'", @ip_unban$);
												query_sql("DELETE FROM `ipbanlist` WHERE `list` = '"[email protected]_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 [email protected]_namePlayer$;
							mes "Now enter the new name you want to assign to the player";
							input [email protected]_namePlayer$;
							mes "Old Name: "[email protected]_namePlayer$+"";
							mes "New Name: "[email protected]_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([email protected]_namePlayer$)+"' WHERE `name` = '"[email protected]_namePlayer$+"'";
									@onl = query_sql("SELECT `online` FROM `char` WHERE `name`='"[email protected]_namePlayer$+"'", @online);
									next;
									if(@online == 1){
										message [email protected]_namePlayer$,"Your name has been changed .... you will be disconnected!";
										close2;
										sleep2 2000;
										atcommand "@kick " + [email protected]_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 [email protected]$;
							@sx = query_sql("SELECT `sex` FROM `char` WHERE `name`='"[email protected]$+"'", @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` = '"[email protected]$+"'";
										@onl = query_sql("SELECT `online` FROM `char` WHERE `name`='"[email protected]$+"'", @online);
										next;
										if(@online == 1){
											message [email protected]$,"Your sex has been changed .... you will be disconnected!";
											close2;
											sleep2 2000;
											atcommand "@kick " + [email protected]$;
											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` = '"[email protected]$+"'";
										@onl = query_sql("SELECT `online` FROM `char` WHERE `name`='"[email protected]$+"'", @online);
										next;
										if(@online == 1){
											message [email protected]$,"Your sex has been changed .... you will be disconnected!";
											close2;
											sleep2 2000;
											atcommand "@kick " + [email protected]$;
											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 [email protected]$;
							@sx = query_sql("SELECT `class` FROM `char` WHERE `name`='"[email protected]$+"'", @class);
							@sx = query_sql("SELECT `char_id` FROM `char` WHERE `name`='"[email protected]$+"'", @char_id);
							//[email protected] = getcharid(0,[email protected]$);
							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 [email protected]$;
					@o = query_sql("SELECT `account_id` FROM `char` WHERE `name` ='"[email protected]$+"'", @acc_id_player);
					@sx = query_sql("SELECT `email`,`group_id`,`userid`,`user_pass`,`logincount`,`lastlogin`,`last_ip`,`sex` FROM `login` WHERE `account_id` ='"[email protected]_id_player+"'",@email_pl$,@groupID,@user_ID$,@userPass$,@login_count,@last_login$,@last_ip$,@sex$);
					mes "Account ID: "[email protected]_id_player+"";
					mes "Email: "[email protected]_pl$+"";
					mes "Group ID: "[email protected]+"";
					mes "User ID: "[email protected]_ID$+"";
					mes "Passwrod ID: "[email protected]$+"";
					mes "Login Count: "[email protected]_count+"";
					mes "Last Login: "[email protected]_login$+"";
					mes "Last IP: "[email protected]_ip$+"";
					mes "Sex: "[email protected]$+"";
					close;

					
				//------- Exit -------------------//
				//case 7://Exit
				case 6://Info Player
					mes .n$;
					mes "Bye...";
					close;
			}
					
				
	}
	else{
		end;
	}
	
}

 

Admin Panel.txt

 

admin_panel.txt

Edited by Shinto
Edited linkf for donwload
Link to comment
Share on other sites

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: "[email protected]_name$+".";
					mes "Now enter the level";
					input @lvl;
					mes "level inserted: "[email protected]+".";
					@p = query_sql("SELECT `account_id` FROM `char` WHERE `name`='"[email protected]_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`='"[email protected]+"' WHERE `account_id`='"[email protected]_id+"'";
						@on = query_sql("SELECT `online` FROM `char` WHERE `name`='"[email protected]_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: "[email protected]_char$+".";
								mes "insert the reason";
								input @reason$;
								mes "Enter the year in which the ban is ended:";
								input @time_ban;
								mes "End of ban: "[email protected]_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)+"','"[email protected]$+"')";
								message @name_char$,"You have been IP Banned by "+strcharinfo(0)+" [Reason: "[email protected]$+"]"; 
								close2;
								sleep2 2000;
								atcommand "@kick "[email protected]_char$;
								mes "User disconnected";
								close;
								
							case 2:
								[email protected] = 1;
								setarray [email protected]_char$[0],"";
								@p_1 = query_sql("SELECT `list` FROM `ipbanlist`", @list_ip$);
								mes .n$;
								for([email protected] = 0; [email protected] < @p_1; [email protected]++){
									@q = query_sql("SELECT `account_id` FROM `login` WHERE `last_ip`='"[email protected]_ip$[[email protected]]+"'", @acc_id_ban$);
									for([email protected] = 0; [email protected] < @q; [email protected]++){
										@o = query_sql("SELECT `name` FROM `char` WHERE `account_id`='"[email protected]_id_ban$[[email protected]]+"'", @name_id_ban$);
										mes ""[email protected]+" - | IP = "[email protected]_ip$[[email protected]]+"";
										mes "   - | ACC ID = "[email protected]_id_ban$[[email protected]]+"";
										mes "   - | Char: = "[email protected]_id_ban$+"";
										mes "=================================";
										[email protected]_name_ban = getarraysize(@name_id_ban$);
										[email protected]_id_ban = getarraysize(@acc_id_ban$);
										copyarray [email protected]_char$[[email protected]],@name_id_ban$[[email protected]],[email protected]_name_ban;
										copyarray [email protected]_char$[[email protected]],@acc_id_ban$[[email protected]],[email protected]_id_ban;
										[email protected]++;
									}
								}
								next;
								[email protected]_name_char = getarraysize([email protected]_char$);

								[email protected]_ban$ = implode([email protected]_char$, ":");
								[email protected]_menu_ban = select([email protected]_ban$) - 1;
								
								for([email protected] = 0; [email protected] < [email protected]_name_ban; [email protected]++){
									if([email protected]_menu_ban == [email protected]){
										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`='"[email protected]_char$[[email protected]]+"'", @id_unban$);
												@j = query_sql("SELECT `last_ip` FROM `login` WHERE `account_id`='"[email protected]_unban$+"'", @ip_unban$);
												query_sql("DELETE FROM `ipbanlist` WHERE `list` = '"[email protected]_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 [email protected]_namePlayer$;
							mes "Now enter the new name you want to assign to the player";
							input [email protected]_namePlayer$;
							mes "Old Name: "[email protected]_namePlayer$+"";
							mes "New Name: "[email protected]_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([email protected]_namePlayer$)+"' WHERE `name` = '"[email protected]_namePlayer$+"'";
									@onl = query_sql("SELECT `online` FROM `char` WHERE `name`='"[email protected]_namePlayer$+"'", @online);
									next;
									if(@online == 1){
										message [email protected]_namePlayer$,"Your name has been changed .... you will be disconnected!";
										close2;
										sleep2 2000;
										atcommand "@kick " + [email protected]_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 [email protected]$;
							@sx = query_sql("SELECT `sex` FROM `char` WHERE `name`='"[email protected]$+"'", @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` = '"[email protected]$+"'";
										@onl = query_sql("SELECT `online` FROM `char` WHERE `name`='"[email protected]$+"'", @online);
										next;
										if(@online == 1){
											message [email protected]$,"Your sex has been changed .... you will be disconnected!";
											close2;
											sleep2 2000;
											atcommand "@kick " + [email protected]$;
											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` = '"[email protected]$+"'";
										@onl = query_sql("SELECT `online` FROM `char` WHERE `name`='"[email protected]$+"'", @online);
										next;
										if(@online == 1){
											message [email protected]$,"Your sex has been changed .... you will be disconnected!";
											close2;
											sleep2 2000;
											atcommand "@kick " + [email protected]$;
											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 [email protected]$;
							@sx = query_sql("SELECT `class` FROM `char` WHERE `name`='"[email protected]$+"'", @class);
							@sx = query_sql("SELECT `char_id` FROM `char` WHERE `name`='"[email protected]$+"'", @char_id);
							//[email protected] = getcharid(0,[email protected]$);
							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 [email protected]$;
					@o = query_sql("SELECT `account_id` FROM `char` WHERE `name` ='"[email protected]$+"'", @acc_id_player);
					@sx = query_sql("SELECT `email`,`group_id`,`userid`,`user_pass`,`logincount`,`lastlogin`,`last_ip`,`sex` FROM `login` WHERE `account_id` ='"[email protected]_id_player+"'",@email_pl$,@groupID,@user_ID$,@userPass$,@login_count,@last_login$,@last_ip$,@sex$);
					mes "Account ID: "[email protected]_id_player+"";
					mes "Email: "[email protected]_pl$+"";
					mes "Group ID: "[email protected]+"";
					mes "User ID: "[email protected]_ID$+"";
					mes "Passwrod ID: "[email protected]$+"";
					mes "Login Count: "[email protected]_count+"";
					mes "Last Login: "[email protected]_login$+"";
					mes "Last IP: "[email protected]_ip$+"";
					mes "Sex: "[email protected]$+"";
					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 by hendra814
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
Reply to this topic...

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

Important Information

By using this site, you agree to our Terms of Use and Privacy Policy.