Jump to content
• 0

# Coin exchanger with limit

## Question

Hello Guys is someone have a coin exchanger with limitation every day?

Example players can change coin for only 50 every day, it will reset every 12:00am.

10,000,000z + 1 DAILY_POINTS = 1 Platinum Coin (677).

## Recommended Posts

• 0

this is a reference for you

```	if(getd("#wqeqwe_" + gettime(DT_YYYYMMDD)) < .day_limit){
.@left = .day_limit - getd("#wqeqwe_" + gettime(DT_YYYYMMDD));
mes "Input how many";
input .@count,0,.@left;
delitem .@coin,.@count;
getitem .@new_coin,.@count;
setd("#wqeqwe_" + gettime(DT_YYYYMMDD),getd("#wqeqwe_" + gettime(DT_YYYYMMDD)) + .@count);
end;
}
mes "You cannot exchange anymore today!";
end;```

##### Share on other sites

• 0
On 11/13/2021 at 12:57 AM, sader1992 said:

this is a reference for you

```	if(getd("#wqeqwe_" + gettime(DT_YYYYMMDD)) < .day_limit){
.@left = .day_limit - getd("#wqeqwe_" + gettime(DT_YYYYMMDD));
mes "Input how many";
input .@count,0,.@left;
delitem .@coin,.@count;
getitem .@new_coin,.@count;
setd("#wqeqwe_" + gettime(DT_YYYYMMDD),getd("#wqeqwe_" + gettime(DT_YYYYMMDD)) + .@count);
end;
}
mes "You cannot exchange anymore today!";
end;```

i done it but,

```maintown,193,173,5	script	Coin Trader	117,{
function int__;

do{
callsub exchange_rate;
[email protected] = select( "Zeny to Coin","Coin to Zeny","Close" );
switch( [email protected] ){
Case 1:
mes "Convert Zeny to which Coins ?";
[email protected] = select( implode( .coin_name\$,":" ) ) - 1;
if( Zeny <  .value[[email protected]] ){
mes "^FF0000[ERROR]^000000 You didnt have enough zeny.";
}else{
[email protected] = Zeny / .value[[email protected]];
mes "You can get maximum of ^FF0000"+int__( [email protected] )+" x "+getitemname( .coin_id[[email protected]] )+"^000000";

if(getd("#wqeqwe1_" + gettime(DT_YYYYMMDD)) < .day_limit){
[email protected] = .day_limit - getd("#wqeqwe1_" + gettime(DT_YYYYMMDD));
input [email protected],0,[email protected];
if( [email protected] )
if( checkweight( .coin_id[[email protected]],[email protected] ) ){
[email protected] = ( [email protected] * .value[[email protected]] );
Zeny -= [email protected];
getitem .coin_id[[email protected]],[email protected];
setd("#wqeqwe1_" + gettime(DT_YYYYMMDD),getd("#wqeqwe1_" + gettime(DT_YYYYMMDD)) + [email protected]);
message strcharinfo(0),"Exchanged "+int__( [email protected] )+" Zeny to "+int__( [email protected] )+" "+getitemname( .coin_id[[email protected]] )+"^000000";
}
}
else{
mes "^FF0000[ERROR]^000000 You cant take this much.";
}
}
break;
Case 2:
mes "Convert which Coins to Zeny ?";
[email protected] = select( implode( .coin_name\$,":" ) ) - 1;
if( !countitem( .coin_id[[email protected]] ) ){
mes "^FF0000[ERROR]^000000 You didnt have any "+getitemname( .coin_id[[email protected]] )+".";
}else if( ( .max_zeny - Zeny ) < .value[[email protected]] ){
mes "^FF0000[ERROR]^000000 You cant exchange this Coin as it will exceed the Zeny limit.";
}else{
[email protected] = (( .max_zeny - Zeny ) / .value[[email protected]] );
if( [email protected] > countitem( .coin_id[[email protected]] ) ) [email protected] = countitem( .coin_id[[email protected]] );
mes "You can exchange maximum of ^FF0000"+int__( [email protected] )+" x "+getitemname( .coin_id[[email protected]] )+"^000000 to zeny";
input [email protected],0,[email protected];
if( [email protected] ){
[email protected] = ( [email protected] * .value[[email protected]] );
Zeny += [email protected];
delitem .coin_id[[email protected]],[email protected];
message strcharinfo(0),"Exchanged "+int__( [email protected] )+" "+getitemname( .coin_id[[email protected]] )+" to "+int__( [email protected] )+" Zeny^000000";
}
}
break;
default: break;
}
next;
}while( [email protected] != 3 );
mes "Thank you.";
close;

exchange_rate:
mes "Exchange Rate :";
for( [email protected] = 0; [email protected] < .coin_size; [email protected]++ )
mes "^777777 > "+.coin_name\$[[email protected]]+" - "+int__( .value[[email protected]] )+" z^000000";
return;

OnInit:
// server max zeny
.max_zeny = 1000000000;
.day_limit = 50;
// coin list + name + value
setarray .coin_name\$,"Platinum Coin";
setarray .coin_id,677;
setarray .value,10000000;

.coin_size = getarraysize( .coin_name\$ );
end;

// credits to annieruru
function	int__	{
set [email protected], atoi(""+getarg(0));
if ( [email protected] == 0 || [email protected] >= 2147483647 ) return getarg(0);
set [email protected], getstrlen(""[email protected]);
for ( set [email protected],0; [email protected] < [email protected]; set [email protected], [email protected] + 1 ) {
set [email protected]\$, [email protected] % pow(10,[email protected]+1) / pow(10,[email protected]) + [email protected]\$;
if ( ([email protected]+1) % 3 == 0 && [email protected]+1 != .[email protected] ) set [email protected]\$, ","+ [email protected]\$;
}
return [email protected]\$;
}

}```

yeah it stops when i already exchange more than 50, the problem is if i change 1st time of the day by 49 i records 49 and again if i change again 50 total of 99 it still accepts it.

##### Share on other sites

• 0
17 hours ago, qtdan said:

yeah it stops when i already exchange more than 50, the problem is if i change 1st time of the day by 49 i records 49 and again if i change again 50 total of 99 it still accepts it.

I didn't understand but I guess you are talking about the [email protected]

look how I used it in the example above, you assigned it in your script but you never used it

## Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

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.

×
• Forums

• Downloads

• #### My Account

×
• Create New...

## Important Information

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