Jump to content
  • 0

How to limit exchange of coins? thanks!


Gelo

Question


  • Group:  Members
  • Topic Count:  22
  • Topics Per Day:  0.01
  • Content Count:  56
  • Reputation:   1
  • Joined:  05/10/12
  • Last Seen:  

Need help with this, when a player select Exchange points to Bronze Coins, it will only accept 1000 Points. if the points is more than 1000 it will message that the user cannot exchange because max points that can be trade is 1000 points. and also, NPC will check the players weight, if more than 50% weight, it will message the character that he/she is overweight.

thanks in advance :)

prontera,164,172,2 script Points Room 757,{
waitingroom "Collect Points and Get Bronze Coins, 10 GPoints = 1 BC!",0;
if(countitem(20812) < 1){
mes "You are not a VIP Card User, you will get random points from 1 to 5"; next;}
else{
mes "You are a VIP Card User!, You can get random points from 5 to 10."; next;}
switch( select( "Enter Greedy Points Room",
	"Exchange Points to "+getitemname(.CoinID),
	"Check Points",
 "Infomation",
	"Exit" ) ){
Case 1:
atcommand "@die";
atcommand "@die";
atcommand "@alive";
set .@A,rand(50);
set .@B,rand(50);
mes "[insert the right answer to enter]";
mes "If A = "+.@A+"   B = "+.@B;
switch( rand(1) ){
Case 0:
set .@Answer,.@A + .@B;
mes "How many is A + B ?";
break;
//Case 1:
set .@Answer,.@A - .@B;
mes "How many is A - B ?";
break;
//Case 2:
set .@Answer,.@A * .@B;
mes "How many is A * B ?";
break;
//Case 3:
set .@Answer,.@A / .@B;
mes "How many is A / B ?";
break;
}
input .@Input;
if( .@Input != .@Answer ){
mes "Incorrect Code Please Try Again";
Close;
}
else if( .@Input == .@Answer ){
warp .Map$,0,0; end;
}
Case 2:
 mes "[Points Room]";
 mes "You got "+#Points+" Points.";
 mes "How many Points will be used to change into "+getitemname(.CoinID)+" ?";
 mes "^FF0033NOTE: Make sure you are not overweight and the Bronze Coins in your inventory should not exceed to 30,000 pieces^000000";
 mes "Each "+getitemname(.CoinID)+" = "+.Rate+" Points.";
 if( #Points >= .Rate ){
  input .@Amount,0,#Points;
  set .@Calculation,( .@Amount / .Rate );
  if( .@Calculation ){
	set #Points,#Points - ( .@Calculation * .Rate );
	getitem 673,.@Calculation;
	mes "Gained "+.@Calculation+" x "+getitemname(.CoinID);
}
 }
 close;
Case 3:
mes "[Points Room]";
mes "You got "+#Points+" Greedy Points.";
close;
Case 4:
mes "[Points Room]";
mes "***^FF0033ABOUT POINTS ROOM!^000000***";
mes "Points room is a place where you can collect ^33FF33Greedy Points^000000 and exchange it to ^666633Bronze Coins^000000";
next;
mes "For Every Greedy Pouring, you gain random points from 1 to 5. if you have a VIP card, you can get random points from 5 to 10";
next;
mes "Damage recieve by Greedy Pourings is 1";
next;
mes "Skills are disabled inside the Points Room";
next;
mes "Points Exchange rate:";
mes "^FF660010 Greedy Points = 1 Bronze Coins^000000";
next;
mes "^FF0033TIP!: Use Sniper with falcon and items that increases walking speed for faster points.^000000";
close;
end;
default: break;
}
close;
OnInit:
set .Map$,"jupe_core2";
set .CoinID,673;
set .Rate,10;
monster .Map$,0,0,1906,100,strnpcinfo(0)+"::OnNPCKillEvent";
end;
OnNPCKillEvent:
if (strcharinfo(3) != "jupe_core2") end;
if (killedrid != 2126) end;
if(countitem(20812) < 1){
set #Points,#Points + rand(1,5);}
else{
set #Points,#Points + rand(5,10);}
monster .Map$,0,0,2126,1,strnpcinfo(0)+"::OnNPCKillEvent";
dispbottom "You Currently Have " +#Points +" Greedy Points";
end;
}
new_zone03,96,23,2 script Exit 757,{
mes "[Exit Points Room]";
mes "Do you want to leave this room now?";
next;
menu "Yes",exit,"No",-; close;
exit:
warp "prontera",155,197;
close;
end;
}

Edited by Arcenciel
Codeboxed
Link to comment
Share on other sites

2 answers to this question

Recommended Posts


  • Group:  Forum Moderator
  • Topic Count:  93
  • Topics Per Day:  0.02
  • Content Count:  10015
  • Reputation:   2348
  • Joined:  10/28/11
  • Last Seen:  

input .@Amount,0,#Points;
if( .@Amount >= 1000 ){
   mes "You cant input more than 1000";
   close;
}

Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  218
  • Topics Per Day:  0.05
  • Content Count:  1180
  • Reputation:   141
  • Joined:  01/27/12
  • Last Seen:  

This will allow you to check if the player can hold the coins they recieve. Also I was wondering why you have "if(.@Calculation) {"? What is it comparing it to?

Peopleperson49

if(#Points>=.Rate ) {
input .@Amount,0,#Points;
set .@Calculation,(.@Amount / .Rate );
if(.@Calculation) {  set #Points,#Points - ( .@Calculation * .Rate );
if(checkweight(.CoinID,.@Calculation)==0) { mes "You cannot hold that many "+getitemname(.CoinID)+"."; close; }
getitem 673,.@Calculation;
mes "Gained "+.@Calculation+" x "+getitemname(.CoinID);

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