Loan system skript

  • 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!

DevNation

New Member
Jun 11, 2020
9
0
1
23
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!!!
 
give me a sec ill code it
[doublepost=1595779722,1595779644][/doublepost]wait a player will do /loan to make him need to pay it?
also use 2 spaces or a tab?
 
so how does /loan works
what does it do?
Opens a gui for the player to make him pay?
[doublepost=1595780756,1595780667][/doublepost]Do you have discord so we can talk about it?
[doublepost=1595784996][/doublepost]Here:
Tell me if i did something wrong

Code:
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 virtual chest with size 3 named "&c&l&nLoans" to player
        format gui slot 0 of player with red wool named "&4Cancel." to close
        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%"
        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%"
        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%"
    
command /minor loan [<player>]:
    permission:loan.pizzapod
    trigger:
        if {active minor loan::%arg-1%} is "no":
            if {money::%arg-1%} is higher than 0.09:
                send "&3You paid a minor loan" to arg-1
                add 0.09 to {bank}
                remove 0.09 from {money::%arg-1%}
            else:
                send "&cYou don't have enough money to pay that" to arg-1
                send "&cDo ""/payloan minor"" when you have enough." to arg-1
                add 1 to {minor loans::%arg-1%}
                set {active minor loan::%arg-1%} to "yes"
        else:
            send "&cYou already have an active minor loan" to arg-1

command /major loan [<player>]:
    permission:loan.pizzapod
    trigger:
        if {active major loan::%arg-1%} is "no":
            if {money::%arg-1%} is higher than 0.9:
                send "&3You paid a major loan" to arg-1
                add 1 to {bank}
                remove 1 from {money::%arg-1%}
            else:
                send "&cYou don't have enough money to pay that" to arg-1
                send "&cDo ""/payloan major"" when you have enough." to arg-1
                add 1 to {major loans::%arg-1%}
                set {active major loan::%arg-1%} to "yes"
        else:
            send "&cYou already have an active major loan" to arg-1
          
            
command /extreme loan [<player>]:
    permission:loan.pizzapod
    trigger:
        if {active extreme loan::%arg-1%} is "no":
            if {money::%arg-1%} is higher than 149:
                send "&3You paid an extreme loan" to arg-1
                add 150 to {bank}
                remove 150 from {money::%arg-1%}
            else:
                send "&cYou don't have enough money to pay that" to arg-1
                send "&cDo ""/payloan extreme"" when you have enough." to arg-1
                add 1 to {extreme loans::%arg-1%}
                set {active extreme loan::%arg-1%} to "yes"
        else:
            send "&cYou already have an active extreme loan" to arg-1

command /recentloans:
    trigger:
        send "&3You have &6%{minor loans::%player%}% &3minor loans,"
        send "&6%{major loans::%player%}% &3major loans"
        send "&3and &6%{extreme loans::%player%}% &3extreme loans"
        
command /payloan [<text>]:
    trigger:
        if arg-1 is set:
            if arg-1 is "minor":
                if {money::%player%} is higher than 0.09:
                    remove 1 from {minor loans::%player%}
                    remove 0.1 from {money::%player%}
                    send "&aSuccessfully paid a minor loan"
                    set {active minor loan::%player%} to "no"
                else:
                    send "&cYou dont have enough money to pay it"
            else if arg-1 is "major":
                if {money::%player%} is higher than 0.9:
                    remove 1 from {major loans::%player%}
                    remove 1 from {money::%player%}
                    send "&aSuccessfully paid a major loan"
                    set {active major loan::%player%} to "no"
                else:
                    send "&cYou dont have enough money to pay it"
            else if arg-1 is "extreme":
                if {money::%player%} is higher than 149:
                    remove 1 from {extreme loans::%player%}
                    remove 150 from {money::%player%}
                    send "&aSuccessfully paid an extreme loan"
                    set {active extreme loan::%player%} to "no"
                else:
                    send "&cYou dont have enough money to pay it"
            else:
                send "&c/payloan minor/major/extreme"
        else:
            send "&c/payloan minor/major/extreme"
        
on first join:
    set {money::%player%} to 0
    
on first join:
    set {minor loans::%player%} to 0
    
on first join:
    set {major loans::%player%} to 0
    
on first join:
    set {extreme loans::%player%} to 0
    
on join:
    if {bank} is not set:
        set {bank} to 0
        
on join:
    if {minor loans::%player%} is not set:
        set {minor loans::%player%} to 0
    
on join:
    if {major loans::%player%} is not set:
        set {major loans::%player%} to 0
        
on join:
    if {extreme loans::%player%} is not set:
        set {extreme loans::%player%} to 0
        
on join:
    if {money::%player%} is not set:
        set {money::%player%} to 0
        
command /money:
    trigger:
        send "&3You have &6%{money::%player%}%&6M"
 
so how does /loan works
what does it do?
Opens a gui for the player to make him pay?
[doublepost=1595780756,1595780667][/doublepost]Do you have discord so we can talk about it?
[doublepost=1595784996][/doublepost]Here:
Tell me if i did something wrong

Code:
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 virtual chest with size 3 named "&c&l&nLoans" to player
        format gui slot 0 of player with red wool named "&4Cancel." to close
        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%"
        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%"
        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%"
   
command /minor loan [<player>]:
    permission:loan.pizzapod
    trigger:
        if {active minor loan::%arg-1%} is "no":
            if {money::%arg-1%} is higher than 0.09:
                send "&3You paid a minor loan" to arg-1
                add 0.09 to {bank}
                remove 0.09 from {money::%arg-1%}
            else:
                send "&cYou don't have enough money to pay that" to arg-1
                send "&cDo ""/payloan minor"" when you have enough." to arg-1
                add 1 to {minor loans::%arg-1%}
                set {active minor loan::%arg-1%} to "yes"
        else:
            send "&cYou already have an active minor loan" to arg-1

command /major loan [<player>]:
    permission:loan.pizzapod
    trigger:
        if {active major loan::%arg-1%} is "no":
            if {money::%arg-1%} is higher than 0.9:
                send "&3You paid a major loan" to arg-1
                add 1 to {bank}
                remove 1 from {money::%arg-1%}
            else:
                send "&cYou don't have enough money to pay that" to arg-1
                send "&cDo ""/payloan major"" when you have enough." to arg-1
                add 1 to {major loans::%arg-1%}
                set {active major loan::%arg-1%} to "yes"
        else:
            send "&cYou already have an active major loan" to arg-1
         
           
command /extreme loan [<player>]:
    permission:loan.pizzapod
    trigger:
        if {active extreme loan::%arg-1%} is "no":
            if {money::%arg-1%} is higher than 149:
                send "&3You paid an extreme loan" to arg-1
                add 150 to {bank}
                remove 150 from {money::%arg-1%}
            else:
                send "&cYou don't have enough money to pay that" to arg-1
                send "&cDo ""/payloan extreme"" when you have enough." to arg-1
                add 1 to {extreme loans::%arg-1%}
                set {active extreme loan::%arg-1%} to "yes"
        else:
            send "&cYou already have an active extreme loan" to arg-1

command /recentloans:
    trigger:
        send "&3You have &6%{minor loans::%player%}% &3minor loans,"
        send "&6%{major loans::%player%}% &3major loans"
        send "&3and &6%{extreme loans::%player%}% &3extreme loans"
       
command /payloan [<text>]:
    trigger:
        if arg-1 is set:
            if arg-1 is "minor":
                if {money::%player%} is higher than 0.09:
                    remove 1 from {minor loans::%player%}
                    remove 0.1 from {money::%player%}
                    send "&aSuccessfully paid a minor loan"
                    set {active minor loan::%player%} to "no"
                else:
                    send "&cYou dont have enough money to pay it"
            else if arg-1 is "major":
                if {money::%player%} is higher than 0.9:
                    remove 1 from {major loans::%player%}
                    remove 1 from {money::%player%}
                    send "&aSuccessfully paid a major loan"
                    set {active major loan::%player%} to "no"
                else:
                    send "&cYou dont have enough money to pay it"
            else if arg-1 is "extreme":
                if {money::%player%} is higher than 149:
                    remove 1 from {extreme loans::%player%}
                    remove 150 from {money::%player%}
                    send "&aSuccessfully paid an extreme loan"
                    set {active extreme loan::%player%} to "no"
                else:
                    send "&cYou dont have enough money to pay it"
            else:
                send "&c/payloan minor/major/extreme"
        else:
            send "&c/payloan minor/major/extreme"
       
on first join:
    set {money::%player%} to 0
   
on first join:
    set {minor loans::%player%} to 0
   
on first join:
    set {major loans::%player%} to 0
   
on first join:
    set {extreme loans::%player%} to 0
   
on join:
    if {bank} is not set:
        set {bank} to 0
       
on join:
    if {minor loans::%player%} is not set:
        set {minor loans::%player%} to 0
   
on join:
    if {major loans::%player%} is not set:
        set {major loans::%player%} to 0
       
on join:
    if {extreme loans::%player%} is not set:
        set {extreme loans::%player%} to 0
       
on join:
    if {money::%player%} is not set:
        set {money::%player%} to 0
       
command /money:
    trigger:
        send "&3You have &6%{money::%player%}%&6M"








_________________________________
Im so sorry for not responding power went out for like 2 hours. Im going to test it out rn
[doublepost=1596038311][/doublepost]
so how does /loan works
what does it do?
Opens a gui for the player to make him pay?
[doublepost=1595780756,1595780667][/doublepost]Do you have discord so we can talk about it?
[doublepost=1595784996][/doublepost]Here:
Tell me if i did something wrong

Code:
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 virtual chest with size 3 named "&c&l&nLoans" to player
        format gui slot 0 of player with red wool named "&4Cancel." to close
        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%"
        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%"
        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%"
   
command /minor loan [<player>]:
    permission:loan.pizzapod
    trigger:
        if {active minor loan::%arg-1%} is "no":
            if {money::%arg-1%} is higher than 0.09:
                send "&3You paid a minor loan" to arg-1
                add 0.09 to {bank}
                remove 0.09 from {money::%arg-1%}
            else:
                send "&cYou don't have enough money to pay that" to arg-1
                send "&cDo ""/payloan minor"" when you have enough." to arg-1
                add 1 to {minor loans::%arg-1%}
                set {active minor loan::%arg-1%} to "yes"
        else:
            send "&cYou already have an active minor loan" to arg-1

command /major loan [<player>]:
    permission:loan.pizzapod
    trigger:
        if {active major loan::%arg-1%} is "no":
            if {money::%arg-1%} is higher than 0.9:
                send "&3You paid a major loan" to arg-1
                add 1 to {bank}
                remove 1 from {money::%arg-1%}
            else:
                send "&cYou don't have enough money to pay that" to arg-1
                send "&cDo ""/payloan major"" when you have enough." to arg-1
                add 1 to {major loans::%arg-1%}
                set {active major loan::%arg-1%} to "yes"
        else:
            send "&cYou already have an active major loan" to arg-1
         
           
command /extreme loan [<player>]:
    permission:loan.pizzapod
    trigger:
        if {active extreme loan::%arg-1%} is "no":
            if {money::%arg-1%} is higher than 149:
                send "&3You paid an extreme loan" to arg-1
                add 150 to {bank}
                remove 150 from {money::%arg-1%}
            else:
                send "&cYou don't have enough money to pay that" to arg-1
                send "&cDo ""/payloan extreme"" when you have enough." to arg-1
                add 1 to {extreme loans::%arg-1%}
                set {active extreme loan::%arg-1%} to "yes"
        else:
            send "&cYou already have an active extreme loan" to arg-1

command /recentloans:
    trigger:
        send "&3You have &6%{minor loans::%player%}% &3minor loans,"
        send "&6%{major loans::%player%}% &3major loans"
        send "&3and &6%{extreme loans::%player%}% &3extreme loans"
       
command /payloan [<text>]:
    trigger:
        if arg-1 is set:
            if arg-1 is "minor":
                if {money::%player%} is higher than 0.09:
                    remove 1 from {minor loans::%player%}
                    remove 0.1 from {money::%player%}
                    send "&aSuccessfully paid a minor loan"
                    set {active minor loan::%player%} to "no"
                else:
                    send "&cYou dont have enough money to pay it"
            else if arg-1 is "major":
                if {money::%player%} is higher than 0.9:
                    remove 1 from {major loans::%player%}
                    remove 1 from {money::%player%}
                    send "&aSuccessfully paid a major loan"
                    set {active major loan::%player%} to "no"
                else:
                    send "&cYou dont have enough money to pay it"
            else if arg-1 is "extreme":
                if {money::%player%} is higher than 149:
                    remove 1 from {extreme loans::%player%}
                    remove 150 from {money::%player%}
                    send "&aSuccessfully paid an extreme loan"
                    set {active extreme loan::%player%} to "no"
                else:
                    send "&cYou dont have enough money to pay it"
            else:
                send "&c/payloan minor/major/extreme"
        else:
            send "&c/payloan minor/major/extreme"
       
on first join:
    set {money::%player%} to 0
   
on first join:
    set {minor loans::%player%} to 0
   
on first join:
    set {major loans::%player%} to 0
   
on first join:
    set {extreme loans::%player%} to 0
   
on join:
    if {bank} is not set:
        set {bank} to 0
       
on join:
    if {minor loans::%player%} is not set:
        set {minor loans::%player%} to 0
   
on join:
    if {major loans::%player%} is not set:
        set {major loans::%player%} to 0
       
on join:
    if {extreme loans::%player%} is not set:
        set {extreme loans::%player%} to 0
       
on join:
    if {money::%player%} is not set:
        set {money::%player%} to 0
       
command /money:
    trigger:
        send "&3You have &6%{money::%player%}%&6M"
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
 
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
 
When anyone on the server joins and they try do a loan it says they already have one... but they never took one
 
When anyone on the server joins and they try do a loan it says they already have one... but they never took one
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?
 
Just add this code to the current code, is should fix the problem
Code:
on first join:
    set {active minor loan::%player%} to "no"

on join:
    if {active minor loan::%player%} is not set:
        set {active minor loan::%player%} to "no"

on first join:
    set {active major loan::%player%} to "no"
 
on join:
    if {active major loan::%player%} is not set:
        set {active major loan::%player%} to "no"

on first join:
    set {active extreme loan::%player%} to "no"

on join:
    if {active extreme loan::%player%} is not set:
        set {active extreme loan::%player%} to "no"
 
Hey there! I'm new to this forum, but I stumbled upon this thread while searching for information about loan systems. Thanks for sharing your script and ideas! It sounds like you have a solid foundation and just need help with some of the details. I recently discovered Mortgage Broker in Nuneaton, which may be able to provide some helpful insights on any type of loan, including virtual ones for your Minecraft server. As for your commands and permissions, they seem well thought out and organized. Good luck with your project, and let us know how it turns out!
 
Last edited:
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:
Pag IBIG Death Benefit Claim
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!!!
  1. Setting up the Loan System:
  • Use a database (e.g., SQLite or MySQL) to store loan information, including the player's UUID, loan type, loan amount, timestamp, and status (in progress, overdue, paid, etc.).
  • Create a configuration file to store global settings like loan cooldown duration, overdue duration, and the minimum required balance to use the loan system.
  1. /loan Command:
  • Check if the player has the necessary permissions and meets the minimum balance requirement.
  • Check if the player has any existing loans in progress. If yes, show an error message and exit.
  • Open a GUI with options for the different loan types (100k, 1mil, 150mil).
  • When the player selects a loan type, validate it against their balance to ensure they can afford it.
  • If the player can afford it, create a new loan entry in the database with the relevant details and set the status to "in progress." Apply a cooldown to prevent spamming of the /loan command.
  1. /recentloans Command:
  • Query the database for the player's recent loans (e.g., last 10 loans) and display them in a GUI.
  1. /payloan [<amount>] Command:
  • Open a GUI showing the player's active loans and an option to select the loan they want to repay.
  • If the player selects a loan, deduct the repayment amount from their balance and update the loan status accordingly.
  1. Overdue Handling:
  • Implement a scheduled task that checks the loan database regularly (e.g., every day) for overdue loans.
  • For each overdue loan, check if it's past the allowed repayment period (2 weeks). If yes, update the loan status to "overdue."
  • Deduct the loan amount from the player's balance for each overdue loan and apply a cooldown (1 week) before they can take another loan.
  1. /overdueloans Command:
  • Create a permission node (e.g., "overdue.gui") for players who can access this command.
  • Implement a GUI to display all the overdue loans, allowing the authorized bankers to see them and take appropriate actions (e.g., arranging court hearings).
Please note that this is just an outline, and there's a lot of coding and logic implementation required to achieve the desired functionality. If you are familiar with Skript, this should give you a starting point to work on your plugin. However, if you are not confident in your coding abilities or the timeline is tight, consider seeking help from experienced developers or looking for existing plugins that might have some of these features. Always remember to test your plugin thoroughly before deploying it to a live server. Good luck with your project!