Need help with date handling in 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 community!

    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!

ger0_

Member
Aug 20, 2025
1
0
1
so i have this code, that manages my ranks and global variables using BungeeSK.i have a variable that stores a date as plain text. (like: 2025.08.20 11:28), i want to make my skript like get that date and compare it to whats the date now, and if its greater that that, it executes a bunch of actions. but it dosent work :emoji_frowning: please help me im using skript 2.9.3 (im using 1.18.2)

heres my skript:



command /globalrank <offlineplayer> <text> <text>:
permission: globalrank.admin
permission message: "&cNincs jogod a GlobalRank parancs használatához!"
trigger:
set {_player} to arg-1
set {_rank} to arg-2
set {_duration} to arg-3


set {_current} to now

set {_expiryTime} to now + {_duration} parsed as number * 1000 milliseconds
set {_expiryFormatted} to {_expiryTime} formatted as "yyyy. MM. dd. HH:mm"


set global variable "frostranks_player::%uuid of {_player}%" to name of {_player}
set global variable "frostranks_rank::%uuid of {_player}%" to {_rank}
set global variable "frostranks_rank::%uuid of {_player}%_duration" to {_expiryFormatted}

if {frostranks_player_list::*} is not set:
set {frostranks_player_list::*} to uuid of {_player}
else:
add uuid of {_player} to {frostranks_player_list::*}


execute console command "pr setrank %{_player}% %{_rank}%"


set {_expiryFormatted} to {_expiryTime} formatted as "yyyy. MM. dd. HH:mm"
send "&aSikeresen beállítottad %name of {_player}% rangját %{_rank}% értékre %{_duration}% másodpercig. Lejár: %{_expiryFormatted}%"


every 10 seconds:
loop {frostranks_player_list::*}:
set {_uuid} to loop-value
set {_expiry} to global variable "frostranks_rank::%{_uuid}%_duration"
send "&5Frost&dPlayer&9Check &7» &eJátékos ellenőrizve, UUID: &6%{_uuid}%" to console
set {_expiryLoop} to {_expiry} parsed as date
send "&eDEBUG: now: %now% | expiry: %{_expiryLoop}%" to console

if {_expiryLoop} is set:
if now >= {_expiryLoop}:

delete global variable "frostranks_player::{_uuid}"
delete global variable "frostranks_rank::{_uuid}"
delete global variable "frostranks_rank::{_uuid}_duration"


execute console command "pr setrank %{_uuid}% Tag"


set {_list::*} to {frostranks_player_list::*}
remove {_uuid} from {_list::*}
set {frostranks_player_list::*} to {_list::*}



command /checkrank <offlineplayer>:
permission: globalrank.check
permission message: "&cNincs jogod a rang ellenőrzéséhez!"
trigger:
set {_player} to arg-1
set {_uuid} to uuid of {_player}
set {_rank} to global variable "frostranks_rank::%{_uuid}%"
set {_expiry} to global variable "frostranks_rank::%{_uuid}%_duration"

if {_rank} is not set:
send "&c%name of {_player}% jelenleg nem rendelkezik ideiglenes ranggal."
else:
send "&e%name of {_player}% &frangja: &a%{_rank}%"
send "&fLejárat ideje: &c%{_expiry}%"

command /resetranks:
permission: globalrank.admin
permission message: "&cNincs jogod a rangok visszaállításához!"
trigger:

if {frostranks_player_list::*} is set:
loop {frostranks_player_list::*}:
set {_uuid} to loop-value
delete global variable "frostranks_player::%{_uuid}%"
delete global variable "frostranks_rank::%{_uuid}%"
delete global variable "frostranks_rank::%{_uuid}%_duration"


execute console command "pr setrank %{_uuid}% Tag"


delete {frostranks_player_list::*}
send "&aMinden ideiglenes rang visszaállítva és globális változók törölve."
else:
send "&eNincsenek ideiglenes rangok, amiket vissza lehetne állítani."
 
Hey, paste the code in the the right format, because i cant read anything in this, also i would suggest handling date with timespan - so instead of the last "text" arguemnt i would put "timespan" there.