Jump to content
  • 0

Security System(Secondary Password) Official


nesotomayor

Question


  • Group:  Members
  • Topic Count:  59
  • Topics Per Day:  0.02
  • Content Count:  122
  • Reputation:   0
  • Joined:  06/08/14
  • Last Seen:  

Hi All Script Master,

 

Good Day, I would like to request a script that will do the following:

 

Once the player is already in game they will required to set a secondary password

Save the secondary password of the player into database with md5 features

 

Players who will not yet set the secondary password

1.) All players that has not yet set the secondary password will go to jail to prevent the @warp,@go,flywing,bwing,@jump and death that will bypass the script.

2.) Once the secondary password is already set they will kick out of the game

 

Players who already set the secondary password

1.) Everytime the player will login, they will go to jail and enter their secondary password to prevent the @warp,@go,flywing,bwing,@jump and death that will bypass the script.

2.) If the player type correctly the secondary password(db checking), the player will be unjail and back to its original location(location where he is located b4 he warp to jail)

3.) If the player type the wrong secondary password he will be kick out on the game

 

NPC:

1.) Players can change their secondary password.

        - to change the secondary password it will require to enter his current secondary password.

2.) GM 99 group id can enable/disable the security system feature.

 

Feel free to add anything guys. we need this for the security of our server.

 

Hoping for your immediate response script master.

 

Please advise,

 

Thanks,


following this up please..

 

Thanks,

Edited by nesotomayor
Link to comment
Share on other sites

2 answers to this question

Recommended Posts


  • Group:  Forum Moderator
  • Topic Count:  33
  • Topics Per Day:  0.01
  • Content Count:  1268
  • Reputation:   382
  • Joined:  02/03/12
  • Last Seen:  

/* Run this Query before installing this script!
CREATE TABLE IF NOT EXISTS `gmprotect` (
  `account_id` int(11) unsigned NOT NULL default '0',
  `password` varchar(24) NOT NULL default '',
  `gm_level` int(11) unsigned NOT NULL default '0',
  `switch` BOOLEAN NOT NULL default '0',
  PRIMARY KEY  (`account_id`)
) ENGINE=MyISAM;
*/

-	script	GMPROTECT	-1,{
	OnPCLoginEvent:
		if( !.second_pass ) end;
		set @p, query_sql("SELECT `password`,`switch` FROM `gmprotect` WHERE `account_id` = "+getcharid(3)+";", @pass$, @a );
		if( !@a
		||  !.norm && getgmlevel() < 10 
		||  getgmlevel() >= .bypass ) end;
		set @info, 1;
		if( strcharinfo(3) != "sec_pri" )
			atcommand "@jail "+strcharinfo(0);
		end;
			
	OnPCLoadMapEvent:
		if( !@info ) end;
		atcommand "@mute 100 "+strcharinfo(0);
		if( !@p ) {
			mes "I see it's your first time logging in!";
			if( .norm_mod ) {
				mes "Would you like to set a login password?";
				next;
				if(select("Yes:No")&2) {
					query_sql "INSERT INTO `gmprotect` ( `account_id`, `gm_level` ) VALUES ( '"+getcharid(3)+"', "+getgmlevel()+" );";
					mes "Alright, maybe next time.";
					@info = 0;
					callfunc "unlocker", strcharinfo(0), getcharid(3), 1;
					atcommand "@unjail "+strcharinfo(0);
					close;
				}
			}
			pass:
			mes "Please input your secondary password.";
			input( @pass$ );
			while( @pass$ != .@pass2$ ) {
				mes "Again.";	input(.@pass2$);	set .@z,.@z+1;
				if( .@z > 1 ){
					mes "I'm sorry, but your passwords didn't match, try again?";
					next;
					if( .norm_mod )
						if(select("Yes:No")&2) {
							mes "Alright, maybe next time.";
							query_sql "INSERT INTO `gmprotect` ( `account_id`, `gm_level` ) VALUES ( '"+getcharid(3)+"', "+getgmlevel()+" );";
							@info = 0;
							callfunc "unlocker", strcharinfo(0), getcharid(3), 1;
							atcommand "@unjail "+strcharinfo(0);
							close;
						}
					set .@z,0;
					goto pass;
				}
			}
			query_sql "INSERT INTO `gmprotect` ( `account_id`, `password`, `gm_level`, `switch` ) VALUES ( '"+getcharid(3)+"', '"+escape_sql(((.md5)?md5(@pass$):@pass$))+"', "+getgmlevel()+", 1 );";
			mes "Don't forget your password has been set to ["+@pass$+"].";
			@pass$ = "";
			@info = 0;
			callfunc "unlocker", strcharinfo(0), getcharid(3), 1;
			atcommand "@unjail "+strcharinfo(0);
			close;
		}
		setnpctimer 0; attachnpctimer(strcharinfo(0)); startnpctimer;
		mes "Please input your password, before 60 seconds are up.";
		next;
		input(.@input$);
		if(((.md5)?md5(.@input$):.@input$) == @pass$) {
			mes "Welcome back!";
			close2;
			stopnpctimer;
			if( playerattached() ){
				@pass$ = "";
				@info = 0;
				callfunc "unlocker", strcharinfo(0), getcharid(3), 1;
				atcommand "@unjail "+strcharinfo(0);
			}
		} else {
			mes "Incorrect!";
			close2;
			if( playerattached() )
				callfunc "unlocker", strcharinfo(0), getcharid(3), 0;
		}
	end;
	
	OnTimer10000:
		if(playerattached()){
			callfunc "unlocker", strcharinfo(0), getcharid(3), 0;
		}
	end;
	
	OnSwitch:
		set .second_pass, ((.second_pass)?0:1);
		end;
	
	OnInit:
		set .bypass, 100; //GMs this level or greater don't need passwords.
		set .md5, 1; //MD5 Passwords this is for added security (1=on:0=off) rAthena Only!
		set .norm, 1; //Enable Passwords for normal players (1=on:0=off)
		set .norm_mod, 0; //Players able to opt-out of second passwords. (1=on:0=off)
		set .second_pass, 1; //Enable disable second passwords.
		setmapflag "sec_pri", mf_loadevent;
		end;
}

//Example Changing Password NPC
prontera,162,191,3	script	Pass Setting	100,{
begin:
	query_sql("SELECT `password`,`switch` FROM `gmprotect` WHERE `account_id` = "+getcharid(3)+";",.@pass$,.@a);
	mes "Would you like to change or set a login password?";
	next;
	select("Change Password:"+( ( getgmlevel()>=60 || getvariableofnpc(.norm_mod,"GMPROTECT") ) ?"Account Second Pass["+((.@a)?"On":"Off")+"]":"" )+":Cancel");
	if(@menu==3) {
		mes "Alright, maybe next time.";
		close;
	}
	if(@menu==1) {
		mes "Please input your old password.";
		next;
		input(.@pass1$);
		if(((.md5)?md5(.@pass1$):.@pass1$)==.@pass$) {
			pass:
				mes "Please input your new password.";
				next;
				input(.@pass$);
				while(.@pass$!=.@pass2$) {
					mes "Again.";	input(.@pass2$);	set .@z,.@z+1;
					if(.@z>1){
						mes "I'm sorry, but your passwords didn't match, try again?";
						next;
						if(select("Yes:No")&2) {
							mes "Alright, maybe next time.";
							close;
						}
						set .@z,0;
						goto pass;
					}
				}
				query_sql "UPDATE `gmprotect` SET `password`='"+((.md5)?md5(.@pass$):.@pass$)+"', `switch`=1 WHERE `account_id`="+getcharid(3)+";";
				mes "Don't forget your password has been set to ["+.@pass$+"].";
				close;
		} else {
			mes "Sorry that's not your old password!";
			close;
		}
	} else {
		if( getgmlevel() >= 99 ) {
			mes "Would you like to "+((getvariableofnpc(.second_pass,"GMPROTECT"))?"deactivate":"activate")+" server secondary passwords?";
			next;
			if( select("Yes:No") == 1 ) {
				donpcevent "GMPROTECT::OnSwitch";
				mes "Secondary passwords switched.";
				close;
			}
			mes "Instead would you like to "+((.@a)?"deactivate":"activate")+" your current secondary password?";
			next;
			if( select("Yes:No") == 2 ) {
				mes "Ok maybe next time.";
				close;
			}
		}
		query_sql "UPDATE `gmprotect` SET `switch`="+((.@a)?0:1)+" WHERE `account_id`="+getcharid(3)+";";
		goto begin;
	}
	end;
	
	OnInit:
		set .md5, getvariableofnpc(.md5,"GMPROTECT"); //MD5 Passwords this is for added security (1=on:0=off) rAthena Only!
		end;
}

function	script	unlocker	{
	detachrid;
	if(getarg(2)){
		atcommand "@unmute "+getarg(0);
		attachrid(getarg(1));
		return;
	}
	atcommand "@unmute "+getarg(0);
	attachrid(getarg(1));
	atcommand "@kick "+getarg(0);
	return;
}

Older script modified to work as suggested above.

Edited by Skorm
Modifed to better support player loading.
Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  59
  • Topics Per Day:  0.02
  • Content Count:  122
  • Reputation:   0
  • Joined:  06/08/14
  • Last Seen:  

thanks Sir Skorm, i will try it and let you know.

Hi Sir Skorm,

 

The Pass Setting NPC is showing, but the login pop up where to set my second password is not showing, and also the character is not go to jail

 

Please advise,

 

Thanks,

Edited by nesotomayor
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
Answer this question...

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