Practicyn Posted September 2, 2020 Share Posted September 2, 2020 (edited) #==========================================================================================================# # -------------------------------------------------------------------------------------------------------- # # OPTIONS # # -------------------------------------------------------------------------------------------------------- # #==========================================================================================================# options: #Main Things: Prefix: &9▪ Referral&9> NoPermissions: &cYou don't have the permission to execute this command. #Options: reward_command-1: /eco give [player] 1200 reward_command-2: / reward_command-3: / #==========================================================================================================# # -------------------------------------------------------------------------------------------------------- # # MAIN COMMAND # # -------------------------------------------------------------------------------------------------------- # #==========================================================================================================# command /referral [<text>] [<text>]: trigger: if argument-1 isn't set: if player has permission "referral.create": if {referrals::referral::%uuid of player%} isn't set: set {percent_%%} to 10 loop 3 times: set {percent_%%} to a random integer between {percent_%%}+5 and ({percent_%%}+7)*2 if {percent_%%} < 100: message " {@Prefix} &7Creating your unique code... &8[&a%{percent_%%}%%%&8]" #CAN EDIT [ONLY THE ENGLISH SENTECE] else: stop loop message "" set {_numbers} to "%random integer between 1000 and 999999%" parsed as integer set {_char} to "%player's name%" set {_char} to the first (index of "%player's name%" in {_char} + 4) characters of {_char} set {referrals::referral::%uuid of player%} to "%{_char}%_%{_numbers}%" set {referrals::%{referrals::referral::%uuid of player%}%::uses} to 0 add {referrals::referral::%uuid of player%} to {referral::codes::*} set {referrals::%{referrals::referral::%uuid of player%}%::owner} to "%player's name%" message " {@Prefix} &7Your unique code is&8: &b%{referrals::referral::%uuid of player%}% &8[&a100%%&8]" #CAN EDIT [ONLY THE ENGLISH SENTECE] stop else: message " {@Prefix} &7Your unique code is&8: &b%{referrals::referral::%uuid of player%}%" #CAN EDIT [ONLY THE ENGLISH SENTECE] message " {@Prefix} &7Your code was used for &a%{referrals::%{referrals::referral::%uuid of player%}%::uses}% &7times." #CAN EDIT [ONLY THE ENGLISH SENTECE] stop else: message " {@Prefix} {@NoPermissions}" stop if argument-1 is "use": if player has permission "referral.use": if argument-2 is set: loop {referral::codes::*}: if arg-2 is loop-value: loop {referral::%uuid of player%::codes::*}: if loop-value-2 is arg-2: message " {@Prefix} &7You already used this referral code." #CAN EDIT [ONLY THE ENGLISH SENTECE] stop if {referrals::%loop-value%::owner} isn't player's name: add "%loop-value%" to {referral::%uuid of player%::codes::*} add 1 to {referrals::%loop-value%::uses} message " {@Prefix} &7You used the referral code of &a%{referrals::%loop-value%::owner}%&7." #CAN EDIT [ONLY THE ENGLISH SENTECE] message " {@Prefix} &7Use &b/referral claim &7to claim your reward." #CAN EDIT [ONLY THE ENGLISH SENTECE] set {_player} to "%{referrals::%loop-value%::owner}%" parsed as offlineplayer set {_uuid} to "%uuid of {_player}%" if {_player} is online: message " {@Prefix} &a%player% &7used your referral code." to {_player} #CAN EDIT [ONLY THE ENGLISH SENTECE] message " {@Prefix} &7Use &b/referral claim &7to claim your reward." to {_player} #CAN EDIT [ONLY THE ENGLISH SENTECE] add 1 to {referrals::claims::%{_uuid}%} add 1 to {referrals::claims::%uuid of player%} stop else: message " @Prefix} &7You can't claim your own referral code." #CAN EDIT [ONLY THE ENGLISH SENTECE] stop else: message " @Prefix} {@NoPermissions}" stop if argument-1 is "codes" or "list": if player has permission "referral.admin": loop {referral::codes::*}: message " {@Prefix} &3%loop-index%&8) &a%{referrals::%loop-value%::owner}% &8- &b%loop-value%" stop else: message " {@Prefix} {@NoPermissions}" stop if argument-1 is "claim": if player has permission "referral.claim": if {referrals::claims::%uuid of player%} > 0: remove 1 from {referrals::claims::%uuid of player%} set {_command-1} to "{@reward_command-1}" replace all "[player]" with "%player%" in {_command-1} make console execute command "%{_command-1}%" set {_command-2} to "{@reward_command-2}" replace all "[player]" with "%player%" in {_command-2} make console execute command "%{_command-2}%" set {_command-3} to "{@reward_command-3}" replace all "[player]" with "%player%" in {_command-3} make console execute command "%{_command-3}%" message " {@Prefix} &7You claimed your reward." #CAN EDIT [ONLY THE ENGLISH SENTECE] message " {@Prefix} &7You still have &a%{referrals::claims::%uuid of player%}% &7rewards to claim." #CAN EDIT [ONLY THE ENGLISH SENTECE] stop else: message " {@Prefix} &7You don't have anything to claim." #CAN EDIT [ONLY THE ENGLISH SENTECE] stop else: message " {@Prefix} {@NoPermissions}" stop if argument-1 is "reset", "delete" or "del": if player has permission "referral.admin": if argument-2 is set: set {_player} to "%arg-2%" parsed as offlineplayer set {_uuid} to "%uuid of {_player}%" remove {referrals::referral::%{_uuid}%} from {referral::codes::*} clear {referrals::%{referrals::referral::%{_uuid}%}%::*} delete {referrals::referral::%{_uuid}%} message " {@Prefix} &7You have reset the &a%arg-2%&7's referral." #CAN EDIT [ONLY THE ENGLISH SENTECE] stop else: message " {@Prefix} &7You have to write the player's name." #CAN EDIT [ONLY THE ENGLISH SENTECE] stop else: message " {@Prefix} {@NoPermissions}" stop if argument-1 is "info", "ver", "version" or "author": message " {@Prefix} &aYoshYz Version&8: &7v1.3.2a" stop if argument-1 is "help": if player has permission "referral.admin": message "&f&l&m---------------------------------------" message "&a&l REFERRAL CODES" message " &9▪ /referral help" message " &9▪ /referral ver" message " &9▪ /referral" message " &9▪ /referral use [<code>]" message " &9▪ /referral claim" message " &9▪ /referral reset [<player>]" message " &9▪ /referral codes/list" message "&f&l&m---------------------------------------" stop else: message " {@Prefix} {@NoPermissions}" stop Every player can create max one code using the command /referral Every player can use max one time the same code with the command /referral use You can claim your reward using the command /referral claim Warning: You can set your custom reward command in the options. The console will execute this command for reward the player. You can check the list of codes with the command /referral list You can check the list of commands with the command /referral help Users: referral.use - referral.create - referral.claim Admins: referral.admin (Codes list & command set) There may be a few errors when loading the skript but it should be fine (( dont have time to fix it )) ReferalSystem.sk Edited September 2, 2020 by Practicyn Fixed Hey, I am a java developer/website designer and I make free skripts and post them at My Spigot Page. Executive at PracticynLLC Employee at MDC Development Founder of NightmarePvP Owner of OrbitSky Trainee at FlamePvP www.minehut.xyz www.practicyn.com www.skript.live www.skriptify.xyz Copyright @ PracitcynLLCo Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now