Jump to content
  • 0
Jayz

Simple bank sql base thanks a lot

Question

can i request a simple bank sql base deposit and withdrawal only

Menu:
    Deposit -> Can deposit any amount ( 2% tax ) if possible the 2% tax will go to the "tax" field under the "login table" just to find out how much the player's tax contribution is when using this bank
    Withdraw -> Can withdraw upto 1b only
    Balance -> Can check their balance
    

The database I will use is the login table, I created a new field whose name is deposit, thank you very much

 

image.png.afab186b826583a7b57d33969a2baa19.png

Link to comment
Share on other sites

6 answers to this question

Recommended Posts

  • 0
prontera,155,181,5	script	Simple Bank	757,{
	
	query_sql("SELECT `deposit`, `tax` FROM `login` WHERE `account_id` = "+getcharid(3)+" LIMIT 1", [email protected]_zeny, [email protected]_tax);
	mes "You have "+F_InsertComma([email protected]_zeny)+" Zeny.";
	mes "You contributed "+F_InsertComma([email protected]_tax)+" Zeny of Tax.";
	mes " ";
	switch(select(
		"Deposit Zeny",
		"Withdraw Zeny"
	)) {
		case 1:
			input [email protected], 0, Zeny;
			if ([email protected] < 100) {
				mes "You cant deposit less than 100 Zeny.";
			}
			else if ((MAX_ZENY - [email protected]_zeny) < [email protected]) {
				mes "Your bank can't hold that much of Zeny.";
			}
			else {
				mes "You have deposited "+F_InsertComma([email protected])+" Zeny.";
				Zeny -= [email protected];
				query_sql("UPDATE `login` SET `deposit` = (`deposit` + "[email protected]+" - "+(([email protected] / 100) * 2)+"), `tax` = (`tax` + "+(([email protected] / 100) * 2)+") WHERE `account_id` = "+getcharid(3)+" LIMIT 1");
			}
			break;
		case 2:
			input [email protected], 0, min([email protected]_zeny, 1000000000);
			if ([email protected] <= 0) {
				mes "You cant deposit 0 Zeny.";
			}
			else if ((MAX_ZENY - Zeny) < [email protected]) {
				mes "You can't hold that much of Zeny.";
			}
			else {
				mes "You have withdraw "+F_InsertComma([email protected])+" Zeny.";
				Zeny += [email protected];
				query_sql("UPDATE `login` SET `deposit` = (`deposit` - "[email protected]+") WHERE `account_id` = "+getcharid(3)+" LIMIT 1");
			}
			break;
	}
	close;
}

since tax value doesn't have limit, you probably should create the column with bigger datatype to support more than 2.1b value.

Edited by Emistry
fix tax
  • Love 1
Link to comment
Share on other sites

  • 0
9 minutes ago, Mihael said:

I think this npc can help you

 

 

Thank you i already check this before making post, but i want more simplier like on my description

Link to comment
Share on other sites

  • 0
3 hours ago, Emistry said:

prontera,155,181,5	script	Simple Bank	757,{
	
	query_sql("SELECT `deposit`, `tax` FROM `login` WHERE `account_id` = "+getcharid(3)+" LIMIT 1", [email protected]_zeny, [email protected]_tax);
	mes "You have "+F_InsertComma([email protected]_zeny)+" Zeny.";
	mes "You contributed "+F_InsertComma([email protected]_tax)+" Zeny of Tax.";
	mes " ";
	switch(select(
		"Deposit Zeny",
		"Withdraw Zeny"
	)) {
		case 1:
			input [email protected], 0, Zeny;
			if ([email protected] < 100) {
				mes "You cant deposit less than 100 Zeny.";
			}
			else if ((MAX_ZENY - [email protected]_zeny) < [email protected]) {
				mes "Your bank can't hold that much of Zeny.";
			}
			else {
				mes "You have deposited "+F_InsertComma([email protected])+" Zeny.";
				Zeny -= [email protected];
				query_sql("UPDATE `login` SET `deposit` = (`deposit` + "[email protected]+"), `tax` = (`tax` + "+(([email protected] / 100) * 2)+") WHERE `account_id` = "+getcharid(3)+" LIMIT 1");
			}
			break;
		case 2:
			input [email protected], 0, min([email protected]_zeny, 1000000000);
			if ([email protected] <= 0) {
				mes "You cant deposit 0 Zeny.";
			}
			else if ((MAX_ZENY - Zeny) < [email protected]) {
				mes "You can't hold that much of Zeny.";
			}
			else {
				mes "You have withdraw "+F_InsertComma([email protected])+" Zeny.";
				Zeny += [email protected];
				query_sql("UPDATE `login` SET `deposit` = (`deposit` - "[email protected]+") WHERE `account_id` = "+getcharid(3)+" LIMIT 1");
			}
			break;
	}
	close;
}

since tax value doesn't have limit, you probably should create the column with bigger datatype to support more than 2.1b value.

work perfect!

I'll just open it again, because I noticed that the tax percentage works but the tax didn't reduce the zeny deposit

 

Link to comment
Share on other sites

  • 0
query_sql("UPDATE `login` SET `deposit` = (`deposit` + "[email protected]+" - "+(([email protected] / 100) * 2)+"), `tax` = (`tax` + "+(([email protected] / 100) * 2)+") WHERE `account_id` = "+getcharid(3)+" LIMIT 1");

 

  • Upvote 1
Link to comment
Share on other sites

  • 0
9 minutes ago, Emistry said:
query_sql("UPDATE `login` SET `deposit` = (`deposit` + "[email protected]+" - "+(([email protected] / 100) * 2)+"), `tax` = (`tax` + "+(([email protected] / 100) * 2)+") WHERE `account_id` = "+getcharid(3)+" LIMIT 1");

 

thanks it work perfect now

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

Important Information

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