Advertisement
BlackKnight683

Fishing System

Apr 4th, 2021
1,037
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. //------------//Buy Rod Commmand//------------//
  2. $eval
  3.  
  4. if(typeof a$ID === "undefined") {a$ID = 0};
  5. if(typeof hasfishingrod$ID === "undefined") {hasfishingrod$ID = 0}
  6.  
  7. var fishingRod$ID = 0
  8. var rodPrice = 6900
  9. var output = "";
  10.  
  11. if(hasfishingrod$ID>=1) {output = "**You already bought a fishing rod :P**"
  12. fishingRod$ID = 1};
  13.  
  14. if(a$ID<rodPrice) {output = "**You only have " + encodeURIComponent(a$ID) +  " coins!**\nA fishing rod costs $6900 :P"};
  15.  
  16. if(a$ID>=rodPrice && hasfishingrod$ID<1) {
  17. a$ID -= rodPrice
  18. fishingRod$ID += 1
  19. hasfishingrod$ID += 1
  20. output = "**You successfully bought a fishing rod!**\nUse `.fish` to go fishing :D"};
  21. $halt $get(output)
  22.  
  23. //------------//Fish Commmand//------------//
  24. $eval
  25.  
  26. if(typeof fishingRod$ID === "undefined") {fishingRod$ID = 0};
  27.  
  28. var breakChance = $rollnum(1,69)
  29.  
  30. if(breakChance === 5) {output = "**Looks like your rod broke!**\nBuy a new one using `.buy fishing-rod`"
  31. fishingRod$ID === 0
  32. hasfishingrod$ID === 0}
  33.  
  34. if(fishingRod$ID === 1 && breakChance !== 5) {
  35. var fishChance = $rollnum(1,3)
  36. var fishMade = $rollnum(1,5) * fishingRod$ID
  37. var fish$ID = (fish$ID == null) ? fishMade : fish$ID += fishMade;
  38. var output = ""
  39.  
  40. if(fishChance<3) {
  41. output = "**You just went to fishing and caught " + encodeURIComponent(fishMade) + " :fish: **"};
  42.  
  43. if(fishChance === 3) {output = "**You weren't able to catch anything...**\nGuess the weather was too bad :P"
  44. fish$ID -= fishMade};
  45. };
  46.  
  47. if(fishingRod$ID<1) {output = "**You are not planning to fish with your hand, are you?**\nBuy a fishing rod with `.buy fishing-rod`"};
  48. $halt $get(output)
  49. //------------//Sell Commmand//------------//
  50. $eval
  51.  
  52. if(typeof fish$ID === "undefined") {fish$ID = 0};
  53.  
  54. if(typeof a$ID === "undefined") {a$ID = 0};
  55.  
  56. try{
  57. var fishSold = $messageAfterCommand
  58. }catch(e) {fishSold = 0}
  59.  
  60. var fishPrice = fishSold * $rollnum(50,150)
  61. var output = "**Bruh enter a number :P**"
  62.  
  63. if(fishSold > fish$ID) {output = "**You can't sell imaginary fishes :/**\nCurrent Balance: " + encodeURIComponent(fish$ID) + " :fish:"};
  64.  
  65. if(fishSold <= 0) {output = "**Invalid amount of fish sold.**"};
  66.  
  67. if(fishSold <= fish$ID && fish$ID > 0) {
  68. a$ID += fishPrice
  69. fish$ID -= fishSold
  70. output = "**Sold " + encodeURIComponent(fishSold) + " :fish: for `$" + encodeURIComponent(fishPrice) + "`!**"
  71. };
  72. $halt $get(output)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement