Jump to content
  • 0

change OnMinute00 to specific time in a day LMS script


Question

Posted

how can i change this LMS script to start at 1 PM 3 PM 5 PM and 7 PM  only?

thanks in advance
 

// Edit by Mabuhay

-	script	Event_LMS	-1,{
OnInit:
	// item reward
	setarray .item,
		501, 10,
		502, 5;

	// @lmsstart - gm manual start
	bindatcmd "lmsstart", strnpcinfo(0)+"::OnStart",60,60;
	
	// @lms - player join event
	bindatcmd "lms", strnpcinfo(0)+"::OnJoinEvent";
	
	// Event cooldown
	.event_cd = 60 * 60 * 1; // 1hr
	
	// Mapflags
	setarray .@mapflag,
		mf_nowarp,
		mf_nowarpto,
		mf_noteleport,
		mf_nomemo,
		mf_nosave,
		mf_noicewall,
		mf_nobranch,
		mf_noreturn;
		
	for ( .@i = 0; .@i < getarraysize(.@mapflag); .@i++)
		setmapflag "06guild_01", .@mapflag[.@i];
		
	.@min = gettime(DT_MINUTE)*60;
	.@sec = gettime(DT_SECOND);
	.event_time = (gettimetick(2) - ( .@min + .@sec )) + .event_cd - 5;
	end;
	
OnJoinEvent:
	mes " [ Event Status ] ";
	if ( !.start ) mes "Next schedule starts in ^FF0000"+ Time2Str(.event_time) +"^000000.";
	if ( .start == 1 ) mes "Event is currently active.";
	if ( .start == 2 ) mes "Event is currently on-going.";
	next;
	switch(select(
		"Last Man Standing Event - "+ ((.start == 1) ? "^00ff00Join Event":((.start == 2) ? "^00ff00Event On-Going":"^ff0000Not Available"))+"^000000" )) {
	case 1:
		if ( !.start ) {
			mes "Event is not available.";
			close;
		} else if ( .start == 2 ) {
			mes "Event is on-going";
			close;
		}
		else
			warp "06guild_01",0,0;
	}
	end;

OnStart: .@force = true;
OnMinute00: // runs hourly
	.@time = gettimetick(2);
	.@min = gettime(DT_MINUTE)*60;
	.@sec = gettime(DT_SECOND);
	if ( .event_time > .@time && !.@force || .start && !.@force ) end; // doesnt start if cd isn't done.
	.event_time = (.@time - ( .@min + .@sec )) + .event_cd - 5;  
	.start = 1;
	pvpoff "06guild_01";
	announce "LMS: We are going to have a Last Man Standing event.",0;
	sleep 10000;
	announce "LMS: For those who wants to join, use @lms",0;
	sleep 10000;
	announce "LMS: After 1 Minute Event will close.",0;
	sleep 10000;
	announce "LMS: So please if you want to join. use @lms",0;
	sleep 60000;
	announce "LMS: The entry to the event is now closed.",bc_all,0x0ceedb;
	if ( getmapusers("06guild_01") < 2 ) {
		announce "LMS: Not enough participants.",bc_all,0x0ceedb;
		.start = false;
		end;
	}
	.start = 2;
	sleep 3500;
	mapannounce "06guild_01","We're about to begin the event.",bc_map,0x0ceedb;
	sleep 2500;
	mapannounce "06guild_01","The rules are simple.",bc_map,0x0ceedb;
	sleep 2500;
	mapannounce "06guild_01","Kill everyone in the map.",bc_map,0x0ceedb;
	sleep 2500;
	mapannounce "06guild_01","Last Man Standing wins!",bc_map,0x0ceedb;
	sleep 2000;
	mapannounce "06guild_01","That's all. Let's begin.",bc_map,0x0ceedb;
	sleep 3000;
	for (.@i = 10; .@i > 0; .@i--) {
		mapannounce "06guild_01", "LMS: -- "+.@i+" --",bc_map,0x0ceedb;
		sleep 1000;
	}
	mapannounce "06guild_01", "LMS: Fight! ",bc_map,0x0ceedb;
	pvpon "06guild_01";
	.timer = 0;
	initnpctimer;
	end;
	
OnTimer5000: // check every 5 secs..
	.timer++;
	.@size = getmapusers("06guild_01");
	if ( .@size > 1 && .timer == 6 ) {
		.timer = 0;
		mapannounce "06guild_01", "LMS: "+ .@size +" players left..", bc_blue;
	} 
	else if ( .@size <= 1 )
		donpcevent strnpcinfo(3)+"::OnEndEvent";
	setnpctimer 0;
	end;
	
OnEndEvent:
	stopnpctimer;
	.start = false;
	pvpoff "06guild_01";
	mapannounce "06guild_01", "LMS: Event ended!",bc_map,0x0ceedb;
	sleep 5000;
	.@size = getmapunits(BL_PC,"06guild_01",.@aid);
	if ( .@size == 0 ) {
		announce "LMS: No winners.",0;
		end;
	}
	.@amt = getarraysize(.item);
	attachrid .@aid;
	announce strcharinfo(0)+" has won the Last Man Standing Event.",bc_all,0x0ceedb;
	for ( .@j = 0; .@j < .@amt; .@j += 2 )
		getitem .item[.@j], .item[.@j+1];				
	warp "invek",rand(146,164),rand(149,164);
	end;
	
OnPCDieEvent:
	if ( .start && strcharinfo(3) == "06guild_01" ) {
		warp "invek",rand(146,164),rand(149,164);
		.@size = getmapusers("06guild_01");
		if ( .@size > 1 )
			mapannounce "06guild_01", "LMS: "+ .@size +" players left..", bc_blue;
		else if ( .@size <= 1 )
			donpcevent strnpcinfo(3)+"::OnEndEvent";
	}
	end;
	
}

 

4 answers to this question

Recommended Posts

  • 0
Posted (edited)

Hi. Find this line:

.@time = gettimetick(2);

And add above it:

if (gettime(DT_HOUR) != 13 && gettime(DT_HOUR) != 17 && gettime(DT_HOUR) != 19) end;

 

Edited by Racaae
correction

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.   Paste as plain text instead

  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.

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...