1. Welcome to skUnity!

    Welcome to skUnity! This is a forum where members of the Skript community can communicate and interact. Skript Resource Creators can post their Resources for all to see and use.

    If you haven't done so already, feel free to join our official Discord server to expand your level of interaction with the comminuty!

    Now, what are you waiting for? Join the community now!

Dismiss Notice
This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

Loan system skript

Discussion in 'Requests' started by DevNation, Jun 11, 2020.

  1. DevNation

    DevNation Member

    Joined:
    Jun 11, 2020
    Messages:
    9
    Likes Received:
    0
    Category: Finance

    Suggested name: Loans?

    Spigot/Skript Version: I dont min

    What I want:
    I am trying to make /loan command, I want it to be able to have a cooldown and
    I wanted 3 types of loans a 100k Loan (minor) 1mil loan(Major) 150mil loan (Extreme)
    and they can do /recent loans to see what loan they have in progress and they can't do any loans when they have one in progress. And they can pay it back anytime through a GUI. And if they don't pay it back in 2 weeks. Their balance gets taken away and they will not be able to use a Loan for 1 week. Each overdue loan will be logged in a GUI so Bankers (I will make a rank) can see them and take them for a court hearing. I've done the basics but I need help with the rest. And they have to have a balance over 69k to use the loan system.


    Ideas for commands:
    /loan
    /recentloans
    /payloan [<amount>]
    /overdueloans


    Ideas for permissions:
    banned.loan
    allowed.loan
    overdue.gui
    pay.loan
    recent.loans

    When I'd like it by: A week maybe or 2


    Heres a basis when I tried to make it
    Code (Skript):
    command /loan:
    aliases: /bankloan, /loanbank
    permission: loan.pizzapod
    permission message: &c&lYou have been banned from using this loan system.
    executable by: players and console
    description: This command opens a loan GUI where you can take a loan.
    trigger:
    open a virtual chest inventory with 3 rows named "&c&l&nLoans"
    format gui slot 0 with red wool named "&4Cancle."
    format gui slot 10 with water bucket named "&bMinor Loan" with lore "&1This is a 100k L on run:


    THANKS THIS WILL HELP ALOT!!!
     
  2. Time4Games

    Time4Games Well-Known Member

    Joined:
    Jul 25, 2020
    Messages:
    59
    Likes Received:
    1
    still need it?
     
  3. DevNation

    DevNation Member

    Joined:
    Jun 11, 2020
    Messages:
    9
    Likes Received:
    0
    Yes
     
  4. Time4Games

    Time4Games Well-Known Member

    Joined:
    Jul 25, 2020
    Messages:
    59
    Likes Received:
    1
    give me a sec ill code it
    --- Double Post Merged, Jul 26, 2020, Original Post Date: Jul 26, 2020 ---
    wait a player will do /loan to make him need to pay it?
    also use 2 spaces or a tab?
     
  5. DevNation

    DevNation Member

    Joined:
    Jun 11, 2020
    Messages:
    9
    Likes Received:
    0
    tab
     
  6. Time4Games

    Time4Games Well-Known Member

    Joined:
    Jul 25, 2020
    Messages:
    59
    Likes Received:
    1
    okay also im using TuSke becuase i think its the best skript plugin to make GUIs
     
  7. DevNation

    DevNation Member

    Joined:
    Jun 11, 2020
    Messages:
    9
    Likes Received:
    0
    thats alright
     
  8. Time4Games

    Time4Games Well-Known Member

    Joined:
    Jul 25, 2020
    Messages:
    59
    Likes Received:
    1
    so how does /loan works
    what does it do?
    Opens a gui for the player to make him pay?
    --- Double Post Merged, Jul 26, 2020, Original Post Date: Jul 26, 2020 ---
    Do you have discord so we can talk about it?
    --- Double Post Merged, Jul 26, 2020 ---
    Here:
    Tell me if i did something wrong

    Code (Text):
    1. command /loan:
    2.     aliases: /bankloan, /loanbank
    3.     permission: loan.pizzapod
    4.     permission message: &c&lYou have been banned from using this loan system.
    5.     executable by: players and console
    6.     description: This command opens a loan GUI where you can take a loan.
    7.     trigger:
    8.         open virtual chest with size 3 named "&c&l&nLoans" to player
    9.         format gui slot 0 of player with red wool named "&4Cancel." to close
    10.         format gui slot 10 of player with water bucket named "&bMinor Loan" with lore "&1This is a 100k Loan" to run console command "/minor loan %player%"
    11.         format gui slot 13 of player with water bucket named "&bMajor Loan" with lore "&1This is a 1M Loan" to run console command "/major loan %player%"
    12.         format gui slot 16 of player with water bucket named "&bExtreme Loan" with lore "&1This is a 150M Loan" to run console command "/extreme loan %player%"
    13.    
    14. command /minor loan [<player>]:
    15.     permission:loan.pizzapod
    16.     trigger:
    17.         if {active minor loan::%arg-1%} is "no":
    18.             if {money::%arg-1%} is higher than 0.09:
    19.                 send "&3You paid a minor loan" to arg-1
    20.                 add 0.09 to {bank}
    21.                 remove 0.09 from {money::%arg-1%}
    22.             else:
    23.                 send "&cYou don't have enough money to pay that" to arg-1
    24.                 send "&cDo ""/payloan minor"" when you have enough." to arg-1
    25.                 add 1 to {minor loans::%arg-1%}
    26.                 set {active minor loan::%arg-1%} to "yes"
    27.         else:
    28.             send "&cYou already have an active minor loan" to arg-1
    29.  
    30. command /major loan [<player>]:
    31.     permission:loan.pizzapod
    32.     trigger:
    33.         if {active major loan::%arg-1%} is "no":
    34.             if {money::%arg-1%} is higher than 0.9:
    35.                 send "&3You paid a major loan" to arg-1
    36.                 add 1 to {bank}
    37.                 remove 1 from {money::%arg-1%}
    38.             else:
    39.                 send "&cYou don't have enough money to pay that" to arg-1
    40.                 send "&cDo ""/payloan major"" when you have enough." to arg-1
    41.                 add 1 to {major loans::%arg-1%}
    42.                 set {active major loan::%arg-1%} to "yes"
    43.         else:
    44.             send "&cYou already have an active major loan" to arg-1
    45.          
    46.            
    47. command /extreme loan [<player>]:
    48.     permission:loan.pizzapod
    49.     trigger:
    50.         if {active extreme loan::%arg-1%} is "no":
    51.             if {money::%arg-1%} is higher than 149:
    52.                 send "&3You paid an extreme loan" to arg-1
    53.                 add 150 to {bank}
    54.                 remove 150 from {money::%arg-1%}
    55.             else:
    56.                 send "&cYou don't have enough money to pay that" to arg-1
    57.                 send "&cDo ""/payloan extreme"" when you have enough." to arg-1
    58.                 add 1 to {extreme loans::%arg-1%}
    59.                 set {active extreme loan::%arg-1%} to "yes"
    60.         else:
    61.             send "&cYou already have an active extreme loan" to arg-1
    62.  
    63. command /recentloans:
    64.     trigger:
    65.         send "&3You have &6%{minor loans::%player%}% &3minor loans,"
    66.         send "&6%{major loans::%player%}% &3major loans"
    67.         send "&3and &6%{extreme loans::%player%}% &3extreme loans"
    68.        
    69. command /payloan [<text>]:
    70.     trigger:
    71.         if arg-1 is set:
    72.             if arg-1 is "minor":
    73.                 if {money::%player%} is higher than 0.09:
    74.                     remove 1 from {minor loans::%player%}
    75.                     remove 0.1 from {money::%player%}
    76.                     send "&aSuccessfully paid a minor loan"
    77.                     set {active minor loan::%player%} to "no"
    78.                 else:
    79.                     send "&cYou dont have enough money to pay it"
    80.             else if arg-1 is "major":
    81.                 if {money::%player%} is higher than 0.9:
    82.                     remove 1 from {major loans::%player%}
    83.                     remove 1 from {money::%player%}
    84.                     send "&aSuccessfully paid a major loan"
    85.                     set {active major loan::%player%} to "no"
    86.                 else:
    87.                     send "&cYou dont have enough money to pay it"
    88.             else if arg-1 is "extreme":
    89.                 if {money::%player%} is higher than 149:
    90.                     remove 1 from {extreme loans::%player%}
    91.                     remove 150 from {money::%player%}
    92.                     send "&aSuccessfully paid an extreme loan"
    93.                     set {active extreme loan::%player%} to "no"
    94.                 else:
    95.                     send "&cYou dont have enough money to pay it"
    96.             else:
    97.                 send "&c/payloan minor/major/extreme"
    98.         else:
    99.             send "&c/payloan minor/major/extreme"
    100.        
    101. on first join:
    102.     set {money::%player%} to 0
    103.    
    104. on first join:
    105.     set {minor loans::%player%} to 0
    106.    
    107. on first join:
    108.     set {major loans::%player%} to 0
    109.    
    110. on first join:
    111.     set {extreme loans::%player%} to 0
    112.    
    113. on join:
    114.     if {bank} is not set:
    115.         set {bank} to 0
    116.        
    117. on join:
    118.     if {minor loans::%player%} is not set:
    119.         set {minor loans::%player%} to 0
    120.    
    121. on join:
    122.     if {major loans::%player%} is not set:
    123.         set {major loans::%player%} to 0
    124.        
    125. on join:
    126.     if {extreme loans::%player%} is not set:
    127.         set {extreme loans::%player%} to 0
    128.        
    129. on join:
    130.     if {money::%player%} is not set:
    131.         set {money::%player%} to 0
    132.        
    133. command /money:
    134.     trigger:
    135.         send "&3You have &6%{money::%player%}%&6M"
    136.  
     
  9. DevNation

    DevNation Member

    Joined:
    Jun 11, 2020
    Messages:
    9
    Likes Received:
    0







    _________________________________
    Im so sorry for not responding power went out for like 2 hours. Im going to test it out rn
    --- Double Post Merged, Jul 29, 2020 ---
    It looks good but here are they problems.
    It says all players have a Minor/Major/Extreme Loan
    no matter what.
    The other problem is that i would like it too go off vault/essentials
    economy so when i do /money it says i have 0 dollars. even tho i have 500bil
    so thats a thing that can be fixed but thats rly all
    Thanks
     
  10. Time4Games

    Time4Games Well-Known Member

    Joined:
    Jul 25, 2020
    Messages:
    59
    Likes Received:
    1
    Sorry for not responding, i was on a trip.
    What do you mean it says all players have a minor/major/extreme loan?
    Also when i tested it i had essentials and it showed me the correct amount
     
  11. DevNation

    DevNation Member

    Joined:
    Jun 11, 2020
    Messages:
    9
    Likes Received:
    0
    When anyone on the server joins and they try do a loan it says they already have one... but they never took one
     
  12. Time4Games

    Time4Games Well-Known Member

    Joined:
    Jul 25, 2020
    Messages:
    59
    Likes Received:
    1
    Oh yea i forgot to set {active major/minor/extreme loan} of player to no when a player joins the server.
    My bad, i will do it later its 1AM here
    Also you use tabs right?
     
  13. DevNation

    DevNation Member

    Joined:
    Jun 11, 2020
    Messages:
    9
    Likes Received:
    0
    yes spaces are disgusting
     
  14. Time4Games

    Time4Games Well-Known Member

    Joined:
    Jul 25, 2020
    Messages:
    59
    Likes Received:
    1
    Just add this code to the current code, is should fix the problem
    Code (Text):
    1. on first join:
    2.     set {active minor loan::%player%} to "no"
    3.  
    4. on join:
    5.     if {active minor loan::%player%} is not set:
    6.         set {active minor loan::%player%} to "no"
    7.  
    8. on first join:
    9.     set {active major loan::%player%} to "no"
    10.  
    11. on join:
    12.     if {active major loan::%player%} is not set:
    13.         set {active major loan::%player%} to "no"
    14.  
    15. on first join:
    16.     set {active extreme loan::%player%} to "no"
    17.  
    18. on join:
    19.     if {active extreme loan::%player%} is not set:
    20.         set {active extreme loan::%player%} to "no"
     
Loading...