Tempban Skript <none>

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

  • LOOKING FOR A VERSION OF SKRIPT?

    You can always check out skUnity Downloads for downloads and any other information about Skript!

Status
Not open for further replies.

Jules

Member
Oct 6, 2020
2
0
1
74
Skript Version (do not put latest): Skript 2.5-beta2-MH (This is the Minehut Version)
Skript Author: Njol,Mirreski,besku,TheBentoBox,FranKusmiruk,SahneBeee,Blueyescat,JRoy,Nicofisi,ApicledWalrus,xXAndrew28Xx, Syst3ms, TheLimeGrass, Pikachu920, Sashie,Walthyturtle,OfficialDonut, and eyesniper2
Minecraft Version: 1.16.3

The error is, if you put it in there and execute command /tempban <player> test 30 seconds and join back. It'll give you that the time remaining is <none>. I've tried many fixes, but they never work. This is not skidded. Any suggestions? EDIT: I don't know how to put it in that "code thing", and the addons that i'm using is SkQuery, skRayFall. I am also using Vault
---
Full Code:
command /tempban [<offline player>] [<text>] [<timespan>]:
permission: admin
permission message: &cYou cannot use this command!
trigger:
if arg 1 is set:
if arg 2 is set:
if arg 3 is set:
set {tempbanned.time.%arg-1's uuid%} to arg 3
set {tempbanned.%arg-1's uuid%} to true
set {tempbanned.timestamp.%arg-1's uuid%} to now
set {tempbanreason.%arg-1's uuid%} to arg 2
set {tempbanned.executor.%arg-1's uuid%} to "%executor%"
kick arg 1 due to "&cYou were tempbanned for %arg-2%&c! &cYou were banned for &6%arg-3%&c!"
loop all players:
if player has permission "MOD":
send "&a%arg-1% &awas tempbanned by %player%&a for &a%arg-3%&a!"
if arg 1 is not set:
send "&cYou must specify a player to ban!"
if arg 2 is not set:
send "&cYou must specify a reason!"
if arg 3 is not set:
send "&cYou must specify a time to ban someone!"

on connect:
if {tempbanned.time.%player's uuid%} is set:
set {_waited} to difference between {tempbanned.timestamp.%player's uuid%} and now
if {_waited} is less than {tempbanned.time.%player's uuid%}:
kick player due to "&cYou were temporaily banned from this server!%nl%&cBanned by: &6%{tempbanned.executor.%player's uuid%}%&c!%nl%&cReason: &6%{tempbanreason.%player's uuid%}%%nl%&cTime Remaining: &6%difference between {tempbanned.time.%player's uuid%} and {_waiting}%&c!"
else:
delete {tempbanned.executor.%player's uuid%}
delete {tempbanned.time.%player's uuid%}
delete {tempbanreason.%player's uuid%}
delete {tempbanned.timestamp.%player's uuid%}
 
You didn't define {_waiting} so that's why it returns <none>

Use this:
Code:
on connect:
    if {tempbanned.time.%player's uuid%} is set:
        set {_waited} to difference between {tempbanned.timestamp.%player's uuid%} and now
    set {_totaltime} to {tempbanned.time.%player's uuid%}
    subtract {_waited} from {_totaltime}
    if {_waited} is less than {tempbanned.time.%player's uuid%}:
        kick player due to "&cYou were temporaily banned from this server!%nl%&cBanned by: &6%{tempbanned.executor.%player's uuid%}%&c!%nl%&cReason: &6%{tempbanreason.%player's uuid%}%%nl%&cTime Remaining: &6%{_totaltime}%&c!"
    else:
        delete {tempbanned.executor.%player's uuid%}
        delete {tempbanned.time.%player's uuid%}
        delete {tempbanreason.%player's uuid%}
        delete {tempbanned.timestamp.%player's uuid%}
 
Status
Not open for further replies.