Jump to content
  • 0

Question

Posted
-	script	StorageInfo	-1,{

OnSettings:
mes "[Storage Security Info]";
mes "Select an option";
next;
if(#StoragePassword > 1);
switch(select("Change Password:Forgot Password:Close")) {

case 1:
	mes "[Storage Security Info]";
	mes "Input current password";
	next;
	input .@pass;
	if (.@pass != #StoragePassword) {mes "Invalid password, please try again."; close;}
	mes "[Storage Security Info]";
	mes "Input New Password";
	next;
	input .@passn;
	if (.@passn < 1000 || .@pass > 9999) {mes "Invalid password, please try again ^FFF000(1000 - 9999)^000000."; close;}
	mes "[Storage Security Info]";
	mes "Confirm New Password";
	next;
	input .@passnc;
	if (.@passnc != .@passn) {mes "Please try again."; close;}
	set #StoragePassword, .@passn;
	

case 2:
	mes "[Storage Security Info]";
	mes "Please input your account email.";
	next;
	input .@email$;
	query_sql "SELECT email FROM login WHERE account_id = "+ getcharid(3) +";",.@emaill$[0];
	if (.@email$ != .@emaill$[0]) {mes "Invalid email, please try again"; close;}
	
	mes "[Storage Security Info]";
	mes "Input New Password";
	next;
	input .@passn;
	if (.@passn < 1000 || .@pass > 9999) {mes "Invalid password, please try again ^FFF000(1000 - 9999)^000000."; close;}
	mes "[Storage Security Info]";
	mes "Confirm New Password";
	next;
	input .@passnc;
	if (.@passnc != .@passn) {mes "Please try again."; close;}
	set #StoragePassword, .@passn;

case 3:
	close;


else if (!#StoragePassword) {
switch(select("Set Password:Close")) {

case 1:
	mes "[Storage Security Info]";
	mes "Input New Password";
	next;
	input .@passn;
	if (.@passn < 1000 || .@pass > 9999) {mes "Invalid password, please try again ^FFF000(1000 - 9999)^000000."; close;}
	mes "[Storage Security Info]";
	mes "Confirm New Password";
	next;
	input .@passnc;
	if (.@passnc != .@passn) {mes "Please try again."; close;}
	set #StoragePassword, .@passn;
	}

case 2:
	close;

	}
	}
}

GIves me error npc_event: event not found [storageInfo::Onsettings]

4 answers to this question

Recommended Posts

Posted

Try this...

-	script	StorageInfo	-1,{

OnSettings:
	if(!#StoragePassword){
		switch(select("Set Password:Close")){
			case 1:
				mes "[Storage Security Info]";
				mes "Input New Password";
				next;
				input .@passn;
				if (.@passn < 1000 || .@pass > 9999){
					mes "Invalid password, please try again ^FFF000(1000 - 9999)^000000.";
					close;
				}
				mes "[Storage Security Info]";
				mes "Confirm New Password";
				next;
				input .@passnc;
				if (.@passnc != .@passn){
					mes "Please try again.";
					close;
				}
				set #StoragePassword, .@passn;

			case 2:
				close;
		}
	} else {
		mes "[Storage Security Info]";
		mes "Select an option";
		next;
		if(#StoragePassword > 1);
		switch(select("Change Password:Forgot Password:Close")){
			case 1:
				mes "[Storage Security Info]";
				mes "Input current password";
				next;
				input .@pass;
				if (.@pass != #StoragePassword){
					mes "Invalid password, please try again.";
					close;
				}
				mes "[Storage Security Info]";
				mes "Input New Password";
				next;
				input .@passn;
				if (.@passn < 1000 || .@pass > 9999){
					mes "Invalid password, please try again ^FFF000(1000 - 9999)^000000.";
					close;
				}
				mes "[Storage Security Info]";
				mes "Confirm New Password";
				next;
				input .@passnc;
				if (.@passnc != .@passn){
					mes "Please try again.";
					close;
				}
				set #StoragePassword, .@passn;
				
			case 2:
				mes "[Storage Security Info]";
				mes "Please input your account email.";
				next;
				input .@email$;
				query_sql "SELECT email FROM login WHERE account_id = "+ getcharid(3) +";",.@emaill$[0];
				if (.@email$ != .@emaill$[0]){
					mes "Invalid email, please try again";
					close;
				}
				mes "[Storage Security Info]";
				mes "Input New Password";
				next;
				input .@passn;
				if (.@passn < 1000 || .@pass > 9999){
					mes "Invalid password, please try again ^FFF000(1000 - 9999)^000000.";
					close;
				}
				mes "[Storage Security Info]";
				mes "Confirm New Password";
				next;
				input .@passnc;
				if (.@passnc != .@passn){
					mes "Please try again.";
					close;
				}
				set #StoragePassword, .@passn;

			case 3:
				close;
		}
	}
}
Posted (edited)

Are you using this? https://rathena.org/board/topic/102521-storage-password-storageinfo/

Mine is working fine...

29w3j4p.jpg

 

Ok if you are having issues with this just follow what i did...

src/map/atcommand.c

Find this

/*==========================================
 *
 *------------------------------------------*/
ACMD_FUNC(storage)
{
	nullpo_retr(-1, sd);

	if (sd->npc_id || sd->state.vending || sd->state.buyingstore || sd->state.trading || sd->state.storage_flag)
		return -1;

	if (storage_storageopen(sd) == 1)
	{	//Already open.
		clif_displaymessage(fd, msg_txt(sd,250));
		return -1;
	}

	clif_displaymessage(fd, msg_txt(sd,919)); // Storage opened.

	return 0;
}

and replace it with this

/*================================================
 *Storage Modifications By Nova [PromisE rAthena]
 *------------------------------------------------*/
ACMD_FUNC(storage)
{
	int value, password;


	if( sd->npc_id || sd->state.vending || sd->state.buyingstore || sd->state.trading || sd->state.storage_flag )
		return -1;


	value = pc_readaccountreg(sd,"#StoragePassword"); 
	if (!value) {
	storage_storageopen(sd);
	clif_displaymessage(fd, "Storage opened.");
	clif_displaymessage(fd, "For more security, please use @storageinfo to set a password");
	return 0;
		}
	else {
	
	if ( !message || !*message || sscanf(message,"%d", &password ) < 1 ) {
		clif_displaymessage(fd, "@storage <Password>");
		clif_displaymessage(fd, "If you forgot your password you can use @storageinfo");
		return -1;
	}

	if (password != value) {
		clif_displaymessage(fd, "Incorrect Password " );
		clif_displaymessage(fd, "If you forgot your password you can use @storageinfo");
		return -1;
	}
	storage_storageopen(sd);
	clif_displaymessage(fd, "Storage opened.");
	return 0;
	}
}

ACMD_FUNC(storageinfo)
{
if( sd->npc_id || sd->state.vending || sd->state.buyingstore || sd->state.trading)
		return -1;

npc_event(sd,"StorageInfo::OnSettings",0);
	return 0;

}

Find this

		ACMD_DEF(load),
		ACMD_DEF(speed),
		ACMD_DEF(storage),

and add ACMD_DEF(storageinfo), below the ACMD_DEF(storage), like this

		ACMD_DEF(load),
		ACMD_DEF(speed),
		ACMD_DEF(storage),
		ACMD_DEF(storageinfo),

npc/custom/storageinfo.txt

-	script	StorageInfo	-1,{

OnSettings:
	if(!#StoragePassword){
		switch(select("Set Password:Close")){
			case 1:
				mes "[Storage Security Info]";
				mes "Input New Password";
				next;
				input .@passn;
				if (.@passn < 1000 || .@pass > 9999){
					mes "Invalid password, please try again ^FFF000(1000 - 9999)^000000.";
					close;
				}
				mes "[Storage Security Info]";
				mes "Confirm New Password";
				next;
				input .@passnc;
				if (.@passnc != .@passn){
					mes "Please try again.";
					close;
				}
				set #StoragePassword, .@passn;

			case 2:
				close;
		}
	} else {
		mes "[Storage Security Info]";
		mes "Select an option";
		next;
		if(#StoragePassword > 1);
		switch(select("Change Password:Forgot Password:Close")){
			case 1:
				mes "[Storage Security Info]";
				mes "Input current password";
				next;
				input .@pass;
				if (.@pass != #StoragePassword){
					mes "Invalid password, please try again.";
					close;
				}
				mes "[Storage Security Info]";
				mes "Input New Password";
				next;
				input .@passn;
				if (.@passn < 1000 || .@pass > 9999){
					mes "Invalid password, please try again ^FFF000(1000 - 9999)^000000.";
					close;
				}
				mes "[Storage Security Info]";
				mes "Confirm New Password";
				next;
				input .@passnc;
				if (.@passnc != .@passn){
					mes "Please try again.";
					close;
				}
				set #StoragePassword, .@passn;
				
			case 2:
				mes "[Storage Security Info]";
				mes "Please input your account email.";
				next;
				input .@email$;
				query_sql "SELECT email FROM login WHERE account_id = "+ getcharid(3) +";",.@emaill$[0];
				if (.@email$ != .@emaill$[0]){
					mes "Invalid email, please try again";
					close;
				}
				mes "[Storage Security Info]";
				mes "Input New Password";
				next;
				input .@passn;
				if (.@passn < 1000 || .@pass > 9999){
					mes "Invalid password, please try again ^FFF000(1000 - 9999)^000000.";
					close;
				}
				mes "[Storage Security Info]";
				mes "Confirm New Password";
				next;
				input .@passnc;
				if (.@passnc != .@passn){
					mes "Please try again.";
					close;
				}
				set #StoragePassword, .@passn;

			case 3:
				close;
		}
	}
}

npc/scripts_custom.conf

npc: npc/custom/storageinfo.txt

NOTE: Dont forget to recompile your trunk :P

Edited by Lelouch vi Britannia
  • Upvote 1

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.

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...