Solved How to remove Decimal from 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!

Status
Not open for further replies.

minecubeks

Member
Oct 4, 2020
4
0
1
35
Hi i maded daily reward system and i also maked checker that count how long player must wait until they can claim it again.

Code:
set {timetowait} to difference between {dailyrewardcooldown::%player%} and now
set {remaining.time} to difference between {timetowait} and 24 hours
send "%{prefix}%&cYou cant claim daily reward! You must wait %{remaining.time}%!"

From {remaining.time} im getting for example 17 hours and 42.85 minutes and i want to remove the decimal part or the number. (sorry for bad english)
 
Code:
function floorTimespan(time: timespan) :: timespan:
    set {_s} to join (regex split "%{_time}%" at ".\d+")
    return {_s} parsed as timespan

Example:
Code:
set {_a} to "2 minutes and 36.47 seconds" parsed as timespan
broadcast floorTimespan({_a}
# output: 2 minutes and 36 seconds
 
Error:

Can't understand this expression: 'join (regex split "%{_time}%" at ".\d+")' (main.sk, line 162: set {_s} to join (regex split "%{_time}%" at ".\d+")')
 
Error:

Can't understand this expression: 'join (regex split "%{_time}%" at ".\d+")' (main.sk, line 162: set {_s} to join (regex split "%{_time}%" at ".\d+")')
RegEx split effect only works for Skript 2.5.2 and above
 
Status
Not open for further replies.