options: codeLength: 10 command /voucher [] [] []: trigger: if arg 1 is "utworz": if player has permission "voucher.admin": if arg 2 is set: if arg 3 is set: set {_time} to arg 3 set {_rang} to arg 2 set {_code} to "" loop {@codeLength} times: set {_char} to random element of (alphanumeric characters between "0" and "z") # W sumie 62 możliwe znaki set {_code} to "%{_code}%%{_char}%" while {vouchers::*} contains {_code}: loop {@codeLength} times: set {_char} to random element of (alphanumeric characters between "0" and "z") # W sumie 62 możliwe znaki set {_code} to "%{_code}%%{_char}%" send "&eWygenerowano kod &f%{_code}%&e dla rangi&f %{_rang}% &ena czas &f%{_time}%" set {_rang} to "addtemp %{_rang}%" set {vouchers::%{_code}%} to "%{_rang}% %{_time}%" else: set {_time} to "pernament" set {_rang} to arg 2 set {_code} to "" loop {@codeLength} times: set {_char} to random element of (alphanumeric characters between "0" and "z") # W sumie 62 możliwe znaki set {_code} to "%{_code}%%{_char}%" while {vouchers::*} contains {_code}: loop {@codeLength} times: set {_char} to random element of (alphanumeric characters between "0" and "z") # W sumie 62 możliwe znaki set {_code} to "%{_code}%%{_char}%" send "&eWygenerowano kod &f%{_code}%&e dla rangi&f %{_rang}% &ena czas &f%{_time}%" set {_rang} to "add %{_rang}%" set {vouchers::%{_code}%} to "%{_rang}% %{_time}%" else if arg 1 is "list": if player has permission "voucher.admin": send "&eLista Aktywnych Voucherów:" set {_count} to 0 loop {vouchers::*}: if loop-value is not false: set {_sections::*} to loop-value split at " " send " • &eKod: &f%loop-index% &eRanga: &f%{_sections::2}% &eNa czas: &f%{_sections::3}%" add 1 to {_count} if {_count} is 0: send " • &eLista jest &fpusta&e!" else if arg 1 is "reset": if player has permission "voucher.admin": if {vouchers.reset} is not set: if arg 2 is not set: send "&c&lZamierzasz wyczyścić listę voucherów! Ta akcja potrzebuje potwierdzenia!%nl%&cWpisz &e/voucher reset confirm &c aby potwierdzić decyzję!%nl%&cPo usunięciu listy nie da się jej przywrócić!%nl%&cMasz &e30 sekund&c na potwierdzenie akcji!" set {vouchers.reset} to true wait 30 seconds delete {vouchers.reset} if arg 2 is "confirm": if {vouchers.reset} is not set: send "&c&lBłąd! Nie możesz potwierdzić akcji której nie rozpocząłeś! %nl%&cWpisz &e/voucher reset&c aby rozpocząć procedurę!" if {vouchers.reset} is true: clear {vouchers::*} send "&e&lUsunięto wszystkie kody voucherów!" delete {vouchers.reset} else: if arg 1 is set: set {_code} to arg 1 if {vouchers::%{_code}%} is set: set {_ranga} to {vouchers::%{_code}%} if {_ranga} is boolean: send "&c&lBłąd! &cKod zastał już wykorzystany!" else: set {_ranga::*} to {_ranga} split at " " if {_ranga::3} is "pernament": execute console command "lp user %player's name% parent %{_ranga::1}% %{_ranga::2}%" else: execute console command "lp user %player's name% parent %{_ranga::1}% %{_ranga::2}% %{_ranga::3}%" send "&a&lGratulacje! &aOtrzymujesz rangę &f%{_ranga::2}% &ena czas &f%{_ranga::3}%!" set {vouchers::%{_code}%} to false else: send "&c&lBłąd! &cKod nieistnieje!"