CommandHelper

CommandHelper

46.5k Downloads

The simple_date() API does not function correctly when used with the sever_ping event.

LadyCailinBot opened this issue ยท 2 comments

commented

CMDHELPER-2767 - Reported by psnider85

I am trying to include the current world time in line with the MOTD.

When returning get_world_time() in the MOTD, it updates correctly, but would prefer to show standard time notation.
When I return this bit of code, it always returns as 7:00PM regardless of what I have done.

I have tried multiple ways of making it show up, but this should work as it works as a command.

    assign( @ct, simple_date( 'K:mm a', get_world_time( 'world' ) ) )
    modify_event( 'motd', colorize( '&bTime: ' . @ct ) )
)```
commented

Comment by LadyCailin

This is not a bug. You are providing an invalid input to simple_date. It accepts the time in unix time in milliseconds. get_world_time returns the time in server ticks. These are not compatible time formats. You'll have to convert to unix millisecond time if you wish to format the time with the simple_date function, or, more easily, just write a procedure to do it. (Take the time, divide by 1000, truncate, which gives you the hours, take the remainder, divide by 60, which gives you the minutes)

commented

Comment by psnider85

Well don't I just sound stupid. Thanks LadyCailin :)