Jump to content
  • 0
Sign in to follow this  
dfabsgwapings

Time Request

Question

Hi there, can anyone do a script for this?

 

like it will announce every hour

 

It is currently <time> on <day>, <month> <date>, <year>.

 

example:

 

It is currently 08:00:00 on Thursday, January 5th, 2017.

 

thanks in advance..

Share this post


Link to post
Share on other sites

3 answers to this question

Recommended Posts

  • 0

Hello there i made it in 2 ways 

1- short way

-	script	timeannouncer	FAKE_NPC,{

OnMinute00:
	announce("It is currently " + gettimestr("%Y-%m/%d %H:%M:%S", 21), bc_all);
	end;
}

2- A bit long one

-	script	timeannouncer	FAKE_NPC,{

OnMinute00:
	setarray(.@Days$, "Monday", "Thuesday", "Wednesday", "Thursday", "Friday", "Saturday", "Sunday");
	setarray(.@Months$, "January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December");
	.@sec = gettime(GETTIME_SECOND);
	.@min = gettime(GETTIME_MINUTE);
	.@hour = gettime(GETTIME_HOUR);
	.@day = gettime(GETTIME_WEEKDAY);
	.@dayofmonth = gettime(GETTIME_DAYOFMONTH);
	.@month = gettime(GETTIME_MONTH);
	.@year = gettime(GETTIME_YEAR);
	
	if (.@dayofmonth == 1) {
		.@tr$ = "st"; 
	} else if (.@dayofmonth == 2) {
		.@tr$ = "nd"; 
	} else if (.@dayofmonth == 3) {
		.@tr$ = "rd"; 
	} else {
		.@tr$ = "th";
	}
	
	announce(sprintf("It is currently %d:%d:%d on %s, %s %d%s, %d", .@sec, .@min, .@hour, .@Days$[.@day], .@Months$[.@month], .@dayofmonth, .@tr$, .@year), bc_all);
	end;
}

(ps: maybe there is a better way to do this but i dont know it :D)

Share this post


Link to post
Share on other sites
  • 0

@Asheraf

 

Hi, thanks for the script and I like the second one, I am getting exactly what I want however the time and date is not same as what's the time on the server. :C

 

please help me for this one


it crashes my server. this one automatically shuts down the map server without any error

Share this post


Link to post
Share on other sites
  • 0

@Asheraf

 

Hi, thanks for the script and I like the second one, I am getting exactly what I want however the time and date is not same as what's the time on the server. :C

 

 

You must change this line:

announce(sprintf("It is currently %d:%d:%d on %s, %s %d%s, %d", .@sec, .@min, .@hour, .@Days$[.@day], .@Months$[.@month], .@dayofmonth, .@tr$, .@year), bc_all);

 

 

 

to this:

announce(sprintf("It is currently %d:%d:%d on %s, %s %d%s, %d", .@hour, .@min, .@sec, .@Days$[.@day], .@Months$[.@month], .@dayofmonth, .@tr$, .@year), bc_all);

to follow <hour>:<minutes>:<seconds> format.

 

 

it crashes my server. this one automatically shuts down the map server without any error

 

It works very well with me.

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Answer this question...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
Sign in to follow this  

×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.