problem with variable and remaining time

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

DanRub

Active Member
Jun 3, 2023
155
13
18
23
Hello, so im making skript about queue, i wont paste here the whole code cause it would be too confusing, but i will describe it. So i have variable set as time for a ban and when i use the variable in other arg then where its created its not working. This is the start of the skript:
Code:
command /queue <string> [<offline player>] [<text>] [<timespan>] [<text>]:
    usage: &cUse: /queue <join, leave>
    trigger:
        if arg-1 is "join":
later in this arg is
Code:
%{banned.reason.%arg-2's UUID%}%
and THIS when i send message to player with the var and it just say <none>
but when the var is here:
Code:
if arg-1 is "ban":
            if player has permission "queue.ban":
                if arg-2 is not set:
                    send "&7Use: &c/queue ban <player> <reason> <lenght>"
later in this arg i set
Code:
{banned.reason.%arg-2's UUID%} to arg-3
which is [<text>] and when i send message from this arg with this var its working just fine and send player the reason of the ban.. idk where is the problem..



Second problem like i already mentioned before im making queue and there is the ban part and i need somehow to do that from arg-4 which is the lenght of the ban get remaining time before the ban ends, but i dont know how..
 
Okay i probably solved the first problem, but i still dont know how to get the remaining time of the ban.
 
Okay i probably solved the first problem, but i still dont know how to get the remaining time of the ban.
When it comes to Skript and checking the time of certain things, you'll probably wanna store that info into a variable (Note: It won't update the time unless you add code for that too):


Code:
command test [<number>] [<player>]:
  trigger:
      set {bantime::%arg 2's uuid%} to "%arg 1%" # Sets a player's banned time to two minutes (In seconds, this can be changed to minutes if needed)
      convtomins(arg-1, player, arg-2)

# Keep in mind, you could easily add a function like the one below to turn your seconds into minutes to retrieve that info better
function convtomins(n: number, p: player, p2: player):
   set {_n} to {_n} / 60 # Divides your number by 60 (How many seconds that are in a minute)
   send "&b%{_p2}% has been banned for &3%{_n}% &bminutes!" to {_p}
An extra note: This code likely is not perfect and needs to be tested/configured in order to be set up to your liking.