Mihael Posted December 2, 2019 Posted December 2, 2019 (edited) Hi boomers, I am creating an offer npc that appears 1 time each month, and would like to put a code inside the waitroom that shows the amount of days left until the start of that offer. Like this: Day 1: Next Offer Appears in: 30D at 21:00 Automatic in Day 2: Next Offer Appears in: 29D at 21:00 Automatic in Day 3: Next Offer Appears in: 28D at 21:00 In last Day: OFFER DAY !!! How could I do this? Edited December 2, 2019 by Mihael Quote
0 Mabuhay Posted December 2, 2019 Posted December 2, 2019 2 hours ago, Mihael said: Hi boomers, I am creating an offer npc that appears 1 time each month, and would like to put a code inside the waitroom that shows the amount of days left until the start of that offer. Like this: Day 1: Next Offer Appears in: 30D at 21:00 Automatic in Day 2: Next Offer Appears in: 29D at 21:00 Automatic in Day 3: Next Offer Appears in: 28D at 21:00 In last Day: OFFER DAY !!! How could I do this? Something like this: prontera,154,184,0 script Test CountDown 123,{ end; OnInit: // when npc is initiated.. OnHour00: // resets every 00:00 delwaitingroom; .@end_day = 20; // 20th day of the month is the end time. .@time = gettime(DT_DAYOFMONTH); if ( .@end_day > .@time ) { waitingroom "Next offer appears in "+(.@end_day-.@time)+"D at 21:00",0; // Before offer day } else if ( .@end_day == .@time ) { waitingroom "OFFER DAY!",0; // During offer day } else { waitingroom "OFFER EXPIRED!",0; // After offer day } end; } 1 Quote
0 crazyarashi Posted December 2, 2019 Posted December 2, 2019 (edited) prontera,255,55,5 script NPC 123,{ if(!.active) end; mes "Event is active."; close; OnInit: OnHour00: .active = 0; function check_month_end; .@day = 10; .@months_end = check_month_end(); if(.@day > .@months_end) .@day = .@months_end; .@current_day = gettime(DT_DAYOFMONTH); if(.@current_day < .@day) waitingroom "Next offer appears in " + (.@day - .@current_day) + "D at 21:00",0; else if(.@current_day > .@day) waitingroom "Next offer appears in " + ((.@months_end - .@current_day) + .@day) + "D at 21:00",0; else { waitingroom "OFFER DAY!",0; .active = 1; } end; function check_month_end { .@month = gettime(DT_MONTH); switch(.@month){ case APRIL: case JUNE: case SEPTEMBER: case NOVEMBER: .@days = 30; break; case FEBRUARY: .@year = gettime(DT_YEAR); if(.@year % 4 == 0 && .@year % 100 != 0 || .@year % 400 == 0) .@days = 29; else .@days = 28; break; default: .@days = 31; break; } return .@days; } } Edited December 2, 2019 by crazyarashi 1 Quote
0 Mihael Posted December 2, 2019 Author Posted December 2, 2019 3 hours ago, Mabuhay said: Something like this: prontera,154,184,0 script Test CountDown 123,{ end; OnInit: // when npc is initiated.. OnHour00: // resets every 00:00 delwaitingroom; .@end_day = 20; // 20th day of the month is the end time. .@time = gettime(DT_DAYOFMONTH); if ( .@end_day > .@time ) { waitingroom "Next offer appears in "+(.@end_day-.@time)+"D at 21:00",0; // Before offer day } else if ( .@end_day == .@time ) { waitingroom "OFFER DAY!",0; // During offer day } else { waitingroom "OFFER EXPIRED!",0; // After offer day } end; } 1 hour ago, crazyarashi said: prontera,255,55,5 script NPC 123,{ if(!.active) end; mes "Event is active."; close; OnInit: OnHour00: .active = 0; function check_month_end; .@day = 10; .@months_end = check_month_end(); if(.@day > .@months_end) .@day = .@months_end; .@current_day = gettime(DT_DAYOFMONTH); if(.@current_day < .@day) waitingroom "Next offer appears in " + (.@day - .@current_day) + "D at 21:00",0; else if(.@current_day > .@day) waitingroom "Next offer appears in " + ((.@months_end - .@current_day) + .@day) + "D at 21:00",0; else { waitingroom "OFFER DAY!",0; .active = 1; } end; function check_month_end { .@month = gettime(DT_MONTH); switch(.@month){ case APRIL: case JUNE: case SEPTEMBER: case NOVEMBER: .@days = 30; break; case FEBRUARY: .@year = gettime(DT_YEAR); if(.@year % 4 == 0 && .@year % 100 != 0 || .@year % 400 == 0) .@days = 29; else .@days = 28; break; default: .@days = 31; break; } return .@days; } } BOOOOOOOOM, Solved! That was it, thanks to the 2 comrades. Quote
Question
Mihael
Hi boomers,
I am creating an offer npc that appears 1 time each month, and would like to put a code inside the waitroom that shows the amount of days left until the start of that offer.
Like this:
Day 1:
Next Offer Appears in: 30D at 21:00
Automatic in Day 2:
Next Offer Appears in: 29D at 21:00
Automatic in Day 3:
Next Offer Appears in: 28D at 21:00
In last Day:
OFFER DAY !!!
How could I do this?
Edited by Mihael3 answers to this question
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.