Jump to content
  • 0
kalabasa

Credit limit

Question

prontera,128,213,5	script	Coin Manager#1::CM	733,{

// Your Server Max Zeny Amount
set .MaxZeny,1000000000;
// Coins Item ID and each Coins Costs
setarray .Coins[1],677;
setarray .Zeny[1],10000000;
set [email protected]_zeny_per_day, 50000000;

// Quest
setarray [email protected]_need, 7227,5, 7444,100, 969,100, 999,100;
[email protected]_need = getarraysize( [email protected]_need );
set @Menu$,"";
for( set [email protected],1; [email protected] < getarraysize( .Coins ); set [email protected],[email protected]+1 )
set @Menu$,@Menu$ + getitemname( .Coins[[email protected]] )+":";
while( 1 ){
mes "Hello I am the Coin Manager, if you are interested in coins you have to talk with me,What can i help you with?";
next;
switch( select( "I want trade Coin to Zeny:I want trade Zeny to Coin" ) ){

Case 1:
mes "Very well. But im only interested on really expensive Coins made of Platinum:";
for( set [email protected],1; [email protected] < getarraysize( .Coins ); set [email protected],[email protected]+1 ){
mes "^0000FF"+getitemname( .Coins[[email protected]] )+" ^FF0000"+.Zeny[[email protected]]+"^000000 Zeny.";
}
next;
set [email protected],select( @Menu$ );
mes "Select the Amount of Coins you want to trade into Zeny.";
mes "You have "+countitem( .Coins[[email protected]] )+" "+getitemname( .Coins[[email protected]] )+".";
input @Amount,0,countitem( .Coins[[email protected]] );
if( @Amount < 1 ){
mes "You don't have that quantity of Coins.";
}else if( ( Zeny + ( @Amount * .Zeny[[email protected]] ) ) > .MaxZeny ){
mes "You can't hold this amount of Zeny.";
}else{
set Zeny,Zeny + ( @Amount * .Zeny[[email protected]] );
delitem .Coins[[email protected]],@Amount;
mes "Done, you have traded "[email protected]+" of "+getitemname(.Coins[[email protected]])+" into "+( @Amount * .Zeny[[email protected]] )+" Zeny.";
}
next;
break;
Case 2:
if ( zeny_coin_quest < gettimetick(2) ) {
mes "im sory but you have to make platinum permit quest to trade zeny into platinum coins, do you want to make platinum permit quest?";
next;
if ( select( "yes", "no" ) -1 ) end;
mes "you need :";
for ( [email protected] = 0; [email protected] < [email protected]_need; [email protected] += 2 )
mes "- "+ [email protected]_need[[email protected]+1] +" "+ getitemname( [email protected]_need[[email protected]] );
mes "and 100,000,000z";
next;

if ( select( "give the items", "leave" ) -1 ) close;
[email protected] = 0;
for ( [email protected] = 0; [email protected] < [email protected]_need; [email protected] += 2 )
if ( countitem( [email protected]_need[[email protected]] ) < [email protected]_need[[email protected]+1] ) {
if ( [email protected] ) mes "I'm sorry you need";
mes "- "+ ( [email protected]_need[[email protected]+1] - countitem( [email protected]_need[[email protected]] ) ) +" "+ getitemname( [email protected]_need[[email protected]] );
[email protected]++;
}

if ( Zeny < 100000000 )
mes "You need "+ ( 100000000 - Zeny ) +" zeny.";
if ( [email protected] || Zeny < 100000000 ) close;
for ( [email protected] = 0; [email protected] < [email protected]_need; [email protected] += 2 )
delitem [email protected]_need[[email protected]], [email protected]_need[[email protected]+1];
Zeny = Zeny - 100000000;
zeny_coin_quest = gettimetick(2) + 30 * 86400;
close;

}

else if ( getstrlen( maxchange_zeny_per_day$ ) ) {
explode( [email protected]$, maxchange_zeny_per_day$, "|" );
if ( atoi( [email protected]$ ) == gettime(4) && atoi( [email protected]$[1] ) > [email protected]_zeny_per_day ) {
mes "I'm sorry you can't exchange more than "+ [email protected]_zeny_per_day +" zeny per day.";
close;
}

else if ( atoi( [email protected]$ ) != gettime(4) )
[email protected]$[1] = 0;
}

mes "Very well. Here is the list on how much each coin is worth:";
for( set [email protected],1; [email protected] < getarraysize( .Coins ); set [email protected],[email protected]+1 ){
mes "^0000FF"+getitemname( .Coins[[email protected]] )+" ^FF0000"+.Zeny[[email protected]]+"^000000 Zeny.";
}

next;
set [email protected],select( @Menu$ );
mes "Select the Amount of Zeny you want to trade into "+getitemname( .Coins[[email protected]] )+".";
mes "You can get maximum of "+Zeny/.Zeny[[email protected]]+" "+getitemname( .Coins[[email protected]] )+".";
input @Amount,0,Zeny/.Zeny[[email protected]];
if( @Amount < 1 ){
mes "You don't have that quantity of Zeny.";
}else{
set Zeny,Zeny - ( @Amount * .Zeny[[email protected]] );
getitem .Coins[[email protected]],@Amount;

mes "Done, you have traded "+( @Amount * .Zeny[[email protected]] )+" Zeny into "[email protected]+" of "+getitemname(.Coins[[email protected]])+" .";
[email protected]$ = gettime(4);
[email protected]$[1] = atoi( [email protected]$[1] ) + @Amount * .Zeny[[email protected]];
maxchange_zeny_per_day$ = implode( [email protected]$, "|" );
}
next;
break;
}
}
close;
}

can anyone update this script?

for example i want to limit 5 coins to be exchanged per day.

if i exactly input 5 coins it will automatically stop you from exchanging

 

but let's say you exchange 4 coins first and then you exchange 4 again. it wont let you stop from exchanging

it will only stop you from exchanging if you input the exact number

 

Link to comment
Share on other sites

3 answers to this question

Recommended Posts

  • 1
On 11/27/2022 at 7:25 AM, kalabasa said:

thanks for the effort but i got a mistake here my fault.

it should be on Zeny to Coin where in i want to limit the Zeny that can be exchanged into Coin up to 50m only.

eg.

so 1 Coin = 10m

for example the user input/exchange 4 Coins

so that's 4 coins = 40m

if the user exchange again for example another 4 coins it should not convert because he got only 1 more coin left  to exchange to complete the 50m limit

should notify that the user has xxx more left to exchange

then after that the cooldown applies.

 

Got it!

Spoiler
prontera,128,213,5	script	Coin Manager#1::CM	733,{
// Your Server Max Zeny Amount
set .MaxZeny,1000000000;
// Coins Item ID and each Coins Costs
setarray .Coins[1],677;
setarray .Zeny[1],10000000;
.@exchange_coin_limit = 5;				//Amount of Coin > Zeny per day 
set .@change_zeny_per_day, 50000000;	//Amount of Zeny > Coin per day (0 = unlimited)

// it will only stop you from exchanging if you input the exact number
.@limit_only_exact_number = false;

// Quest
setarray .@item_need, 7227,5, 7444,100, 969,100, 999,100;




	.@size_need = getarraysize( .@item_need );
	set @Menu$,"";
	for( set .@a,1; .@a < getarraysize( .Coins ); set .@a,.@a+1 )
		set @Menu$,@Menu$ + getitemname( .Coins[.@a] )+":";
	while( 1 ){
		mes "[" + strnpcinfo(1) + "]";
		mes "Hello I am the Coin Manager, if you are interested in coins you have to talk with me. What can I help you with?";
		next;
		switch( select( "I want trade Coin to Zeny:I want trade Zeny to Coin" ) ){
		
		Case 1:
			mes "[" + strnpcinfo(1) + "]";
			if (exchange_coin_cooldown == gettime(DT_YYYYMMDD)) {
				mes "[" + strnpcinfo(1) + "]";
				mes "Sorry. You can only trade ^FF0000" + .@exchange_coin_limit + " coins per day^000000.";
				mes "Come back tomorrow.";
				close;
			}

			mes "Very well. But im only interested on really expensive Coins made of Platinum:";
			for( set .@a,1; .@a < getarraysize( .Coins ); set .@a,.@a+1 ){
				mes "^0000FF"+getitemname( .Coins[.@a] )+" ^FF0000"+.Zeny[.@a]+"^000000 Zeny.";
			}
			next;
			.@available = .@exchange_coin_limit - exchange_coin_traded;
			set .@a,select( @Menu$ );
			mes "Select the Amount of Coins you want to trade into Zeny.";
			mes "You have "+countitem( .Coins[.@a] )+" "+getitemname( .Coins[.@a] )+".";
			mes "You can trade ^0000FF" + .@available + " coin" + (.@available>1?"s":"") + " at max^000000.";
			input @Amount,0,countitem( .Coins[.@a] );
			clear;
			if( @Amount < 1 )
				mes "You don't have that quantity of Coins.";
			else if ( @Amount > .@available) {
				mes "[" + strnpcinfo(1) + "]";
				mes "Sorry. You can't trade that many coins at one time.";
			}else if( ( Zeny + ( @Amount * .Zeny[.@a] ) ) > .MaxZeny ){
				mes "You can't hold this amount of Zeny.";
			}else{
				set Zeny,Zeny + ( @Amount * .Zeny[.@a] );
				delitem .Coins[.@a],@Amount;
				mes "Done, you have traded "+@Amount+" of "+getitemname(.Coins[.@a])+" into "+( @Amount * .Zeny[.@a] )+" Zeny.";
				exchange_coin_traded += @Amount;
				if (.@limit_only_exact_number && @Amount < .@exchange_coin_limit)
					exchange_coin_traded = 0;
				if (exchange_coin_traded >= .@exchange_coin_limit) {
					exchange_coin_traded = 0;
					exchange_coin_cooldown = gettime(DT_YYYYMMDD);
				}
			}
			next;
			break;
		Case 2:
			if ( zeny_coin_quest < gettimetick(2) ) {
				mes "[" + strnpcinfo(1) + "]";
				mes "im sory but you have to make platinum permit quest to trade zeny into platinum coins, do you want to make platinum permit quest?";
				next;
				if ( select( "yes", "no" ) -1 ) end;
				mes "you need :";
				for ( .@i = 0; .@i < .@size_need; .@i += 2 )
					mes "- "+ .@item_need[.@i+1] +" "+ getitemname( .@item_need[.@i] );
				mes "and 100,000,000z";
				next;
		
				if ( select( "Give the items", "Leave" ) -1 ) close;
				.@j = 0;
				for ( .@i = 0; .@i < .@size_need; .@i += 2 )
				if ( countitem( .@item_need[.@i] ) < .@item_need[.@i+1] ) {
					if ( !.@j ) mes "I'm sorry you need";
					mes "- "+ ( .@item_need[.@i+1] - countitem( .@item_need[.@i] ) ) +" "+ getitemname( .@item_need[.@i] );
					.@j++;
				}
		
				if ( Zeny < 100000000 )
					mes "You need "+ ( 100000000 - Zeny ) +" zeny.";
				if ( .@j || Zeny < 100000000 ) close;
				for ( .@i = 0; .@i < .@size_need; .@i += 2 )
					delitem .@item_need[.@i], .@item_need[.@i+1];
				Zeny = Zeny - 100000000;
				zeny_coin_quest = gettimetick(2) + 30 * 86400;
				close;
			}
			if (.@change_zeny_per_day) {
				mes "[" + strnpcinfo(1) + "]";
				if ( getstrlen( maxchange_zeny_per_day$ ) ) {
					explode( .@tmp$, maxchange_zeny_per_day$, "|" );
					if ( atoi( .@tmp$ ) == gettime(4) && atoi( .@tmp$[1] ) >= .@change_zeny_per_day ) {
						mes "I'm sorry you can't exchange more than "+ F_InsertComma(.@change_zeny_per_day) +" zeny per day.";
						close;
					}
				
					else if ( atoi( .@tmp$ ) != gettime(4) )
						.@tmp$[1] = 0;
				}
				.@possible_zeny_exchange = .@change_zeny_per_day - atoi(.@tmp$[1]);
				mes "You can exchange a maximum of " + F_InsertComma(.@possible_zeny_exchange) + "z today.";
			}
			else
				mes "[" + strnpcinfo(1) + "]";
			mes "Which coin do you want? Here is the list on how much each coin is worth:";
			for( set .@a,1; .@a < getarraysize( .Coins ); set .@a,.@a+1 ){
				mes "^0000FF"+getitemname( .Coins[.@a] )+" ^FF0000"+ F_InsertComma(.Zeny[.@a]) +"^000000z.";
			}
			
			next;
			set .@a,select( @Menu$ );

			if (.@change_zeny_per_day)
				.@max = .@possible_zeny_exchange / .Zeny[.@a];
			else
				.@max = Zeny/.Zeny[.@a];
			mes "[" + strnpcinfo(1) + "]";
			mes "How many do you want? You can get maximum of " + .@max + " " + getitemname( .Coins[.@a] ) + ".";
			input @Amount;
			clear;
			mes "[" + strnpcinfo(1) + "]";
			if ( @Amount < 1 ){
				mes "Did you change your mind?";
			}
			else {
				if ( @Amount > .@max ) {
					mes "As I said... You can get maximum of " + .@max + " " + getitemname( .Coins[.@a] ) + ".";
					mes "Will you accept this amount?";
					next;
					if (select("That will do.", "Cancel") == 2) {
						mes "[" + strnpcinfo(1) + "]";
						mes F_Bye;
						close;
					}
					@Amount = .@max;
					mes "[" + strnpcinfo(1) + "]";
				}
				if (Zeny < @Amount * .Zeny[.@a]) {
					mes "You don't have enough Zeny.";
					mes "You're " + F_InsertComma( (@Amount * .Zeny[.@a]) - Zeny) + "z short.";
					close;
				}
				set Zeny,Zeny - ( @Amount * .Zeny[.@a] );
				getitem .Coins[.@a],@Amount;
				
				mes "Done, you have traded "+ F_InsertComma( @Amount * .Zeny[.@a] ) + " Zeny into "+@Amount+" of "+getitemname(.Coins[.@a]) + ".";
				if (.@change_zeny_per_day) {
					.@tmp$ = gettime(4);
					.@tmp$[1] = atoi( .@tmp$[1] ) + @Amount * .Zeny[.@a];
					maxchange_zeny_per_day$ = implode( .@tmp$, "|" );
				}
			}
			next;
			break;
		}
	}
	close;
}

 

 

  • Upvote 1
Link to comment
Share on other sites

  • 0

Hi

Spoiler
prontera,128,213,5	script	Coin Manager#1::CM	733,{
// Your Server Max Zeny Amount
set .MaxZeny,1000000000;
// Coins Item ID and each Coins Costs
setarray .Coins[1],677;
setarray .Zeny[1],10000000;
.@exchange_coin_limit = 5;				//Amount of Coin that can be enchange to Zeny per day 
set .@change_zeny_per_day, 50000000;	//Amount of Zeny that can be exchange to Coin per day

// it will only stop you from exchanging if you input the exact number
.@limit_only_exact_number = true;

// Quest
setarray .@item_need, 7227,5, 7444,100, 969,100, 999,100;




	.@size_need = getarraysize( .@item_need );
	set @Menu$,"";
	for( set .@a,1; .@a < getarraysize( .Coins ); set .@a,.@a+1 )
		set @Menu$,@Menu$ + getitemname( .Coins[.@a] )+":";
	while( 1 ){
		mes "Hello I am the Coin Manager, if you are interested in coins you have to talk with me,What can i help you with?";
		next;
		switch( select( "I want trade Coin to Zeny:I want trade Zeny to Coin" ) ){
		
		Case 1:
			if (exchange_coin_cooldown == gettime(DT_YYYYMMDD)) {
				mes "[" + strnpcinfo(1) + "]";
				mes "Sorry. You can only trade ^FF0000" + .@exchange_coin_limit + " coins per day^000000.";
				mes "Come back tomorrow.";
				close;
			}

			mes "Very well. But im only interested on really expensive Coins made of Platinum:";
			for( set .@a,1; .@a < getarraysize( .Coins ); set .@a,.@a+1 ){
				mes "^0000FF"+getitemname( .Coins[.@a] )+" ^FF0000"+.Zeny[.@a]+"^000000 Zeny.";
			}
			next;
			.@available = .@exchange_coin_limit - exchange_coin_traded;
			set .@a,select( @Menu$ );
			mes "Select the Amount of Coins you want to trade into Zeny.";
			mes "You have "+countitem( .Coins[.@a] )+" "+getitemname( .Coins[.@a] )+".";
			mes "You can trade ^0000FF" + .@available + " coin" + (.@available>1?"s":"") + " at max^000000.";
			input @Amount,0,countitem( .Coins[.@a] );
			clear;
			if( @Amount < 1 )
				mes "You don't have that quantity of Coins.";
			else if ( @Amount > .@available) {
				mes "[" + strnpcinfo(1) + "]";
				mes "Sorry. You can't trade that many coins at one time.";
			}else if( ( Zeny + ( @Amount * .Zeny[.@a] ) ) > .MaxZeny ){
				mes "You can't hold this amount of Zeny.";
			}else{
				set Zeny,Zeny + ( @Amount * .Zeny[.@a] );
				delitem .Coins[.@a],@Amount;
				mes "Done, you have traded "+@Amount+" of "+getitemname(.Coins[.@a])+" into "+( @Amount * .Zeny[.@a] )+" Zeny.";
				exchange_coin_traded += @Amount;
				if (.@limit_only_exact_number && @Amount < .@exchange_coin_limit)
					exchange_coin_traded = 0;
				if (exchange_coin_traded >= .@exchange_coin_limit) {
					exchange_coin_traded = 0;
					exchange_coin_cooldown = gettime(DT_YYYYMMDD);
				}
			}
			next;
			break;
		Case 2:
			if ( zeny_coin_quest < gettimetick(2) ) {
				mes "im sory but you have to make platinum permit quest to trade zeny into platinum coins, do you want to make platinum permit quest?";
				next;
				if ( select( "yes", "no" ) -1 ) end;
				mes "you need :";
				for ( .@i = 0; .@i < .@size_need; .@i += 2 )
				mes "- "+ .@item_need[.@i+1] +" "+ getitemname( .@item_need[.@i] );
				mes "and 100,000,000z";
				next;
		
				if ( select( "give the items", "leave" ) -1 ) close;
				.@j = 0;
				for ( .@i = 0; .@i < .@size_need; .@i += 2 )
				if ( countitem( .@item_need[.@i] ) < .@item_need[.@i+1] ) {
					if ( !.@j ) mes "I'm sorry you need";
					mes "- "+ ( .@item_need[.@i+1] - countitem( .@item_need[.@i] ) ) +" "+ getitemname( .@item_need[.@i] );
					.@j++;
				}
		
				if ( Zeny < 100000000 )
				mes "You need "+ ( 100000000 - Zeny ) +" zeny.";
				if ( .@j || Zeny < 100000000 ) close;
				for ( .@i = 0; .@i < .@size_need; .@i += 2 )
				delitem .@item_need[.@i], .@item_need[.@i+1];
				Zeny = Zeny - 100000000;
				zeny_coin_quest = gettimetick(2) + 30 * 86400;
				close;
			}
		
			else if ( getstrlen( maxchange_zeny_per_day$ ) ) {
				explode( .@tmp$, maxchange_zeny_per_day$, "|" );
				if ( atoi( .@tmp$ ) == gettime(4) && atoi( .@tmp$[1] ) > .@change_zeny_per_day ) {
					mes "I'm sorry you can't exchange more than "+ .@change_zeny_per_day +" zeny per day.";
					close;
				}
			
				else if ( atoi( .@tmp$ ) != gettime(4) )
					.@tmp$[1] = 0;
			}
		
			mes "Very well. Here is the list on how much each coin is worth:";
			for( set .@a,1; .@a < getarraysize( .Coins ); set .@a,.@a+1 ){
				mes "^0000FF"+getitemname( .Coins[.@a] )+" ^FF0000"+.Zeny[.@a]+"^000000 Zeny.";
			}
			
			next;
			set .@a,select( @Menu$ );
			mes "Select the Amount of Zeny you want to trade into "+getitemname( .Coins[.@a] )+".";
			mes "You can get maximum of "+Zeny/.Zeny[.@a]+" "+getitemname( .Coins[.@a] )+".";
			input @Amount,0,Zeny/.Zeny[.@a];
			if( @Amount < 1 ){
				mes "You don't have that quantity of Zeny.";
			}else{
				set Zeny,Zeny - ( @Amount * .Zeny[.@a] );
				getitem .Coins[.@a],@Amount;
				
				mes "Done, you have traded "+( @Amount * .Zeny[.@a] )+" Zeny into "+@Amount+" of "+getitemname(.Coins[.@a])+" .";
				.@tmp$ = gettime(4);
				.@tmp$[1] = atoi( .@tmp$[1] ) + @Amount * .Zeny[.@a];
				maxchange_zeny_per_day$ = implode( .@tmp$, "|" );
			}
			next;
			break;
		}
	}
	close;
}

 

 

Link to comment
Share on other sites

  • 0

thanks for the effort but i got a mistake here my fault.

it should be on Zeny to Coin where in i want to limit the Zeny that can be exchanged into Coin up to 50m only.

eg.

so 1 Coin = 10m

for example the user input/exchange 4 Coins

so that's 4 coins = 40m

if the user exchange again for example another 4 coins it should not convert because he got only 1 more coin left  to exchange to complete the 50m limit

should notify that the user has xxx more left to exchange

then after that the cooldown applies.

 

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