Jump to content
  • 0

Kick player out of map after timer ends.


Question

Posted (edited)

Hello , can someone please fix this script :

When ever someone enters the MVP room no other player cant enter except for the one who entered first but it has a 30 min time , when 30 min passes the player gets kicked and the room will be open again till someone rents it again..

Heres the script: 

 

// = Script made by RIKIMARU on rathena.org
// = Profile Link :
// = http://rathena.org/board/user/434-rikimaru/
// = ENJOY THIS SCRIPT!
//===================================================================================
// //=====// /==/ /==/ /==/
// // // /==/ /==/ /=/ /==/
// //=====// /==/ /=/ /==============/ /========/ /==//===/ /==/ /==/
// //=////// /==/ /==//=/ /==/ /==/==/==/==/==/ / / / /==/ /==/ /==/
// // == /==/ /==//=/ /==/ /==/ /==/ /==/ ======/ / /==/ /==/ /==/
// // == /==/ /==/ /=/ /==/ /==/ /==/ /==/ / /===/ / /==/ /==/ /==/
// // == /==/ /==/ /=/ /==/ /==/ /==/ /==/ / /===/ / /==/ /==/=====/==/
// // == /==/ /==/ /=/ /==/ /==/ /==/ /==/ /========/ /==/ /==///////==/
// ================ eAthena Script ==================================================
// ============== Information =======================================================
// = MVP Arena + MVP Arena Warper
// = Made by :
// = Rikimaru
//===== Current Version: ===================================================
//= 1.3
//===== Compatible With: ===================================================
//= eAthena Revision
//===== Description: =======================================================
//= MVP Arena + Warper with the newest MVP's added to the Script
//= LHZ MVP's have a higher cost than normal MVP's,remember that.
//===== Additional Comments: ===============================================
//= 1.0 Finished the Script [Rikimaru]
//= 1.1 Shorted by llchrisll
//= 1.2 Added new MVP'S like Boitata and the new LHZ MVP's [Rikimaru]
//= 1.3 fixed a little Bug in the arrays,which was caused by me. [Rikimaru]
//=========================================================================
//= DO NOT REMOVE MY AND CHRIS CREDITS AND CLAIM OUR WORK AS YOURS
//=========================================================================
prontera,151,181,5	script	MVP Warper	100,{
// ================== Settings ============================================
set .@n$,"^0000FF[ MVP Warper ]^000000";
set .Map$,"guild_vs1";
// ============= End of Settings ==========================================
mes .@n$;
mes "I can warp you to the MVP Room,do you want to go there?";
next;
switch(select("Yes!:No!")) {
case 1:
	if( getmapusers( .Map$ ) ){
		mes "There is still a player using this room, please wait till he's done.";
		close;
		break;
mes .@n$;
mes "Okay I'm going to warp you.";

warp "guild_vs1",50,50;
end;
}
Case 2:
mes .@n$;
mes "Okay Good bye !~.";
close;
	break;
}
}
//========================= First Script End =============//
//================== MVP Summoner ========================//
guild_vs1,50,57,5	script	MVP Summoner	790,{
set .@nsummon$,"^0000FF[ MVP Summoner ]^000000";
mes .@nsummon$;
mes "Hello,I'm able to spawn MVP's.";
mes "Which MVP do you want me to spawn?";
mes "1 MVP costs "+.zeny[1]+" Zeny";
mes "LHZ MVPs and Thanatos have a";
mes "cost of "+.zeny[2]+" Zeny.";
next;
set .@m,select(.smenu$) - 1;
mes .@nsummon$;
mes "Okay let me check if you have enough Zeny.";
if( Zeny < .zeny[.mobze[.@m]] ) {
mes "You don't have enough money";
close;
} else {
close2;
set Zeny, Zeny - .zeny[.mobze[.@m]];
atcommand "@spawn "+.mobid[.@m] + " "+.mobam[.@m];
npctalk "[ MVP Summoner]: "+getmonsterinfo(.mobid[.@m],0) +" Spawned!";
end;
}
OnInit:
setarray .zeny[1],50000000,250000000; // 50m,250m Zeny
// Mob IDs
setarray .mobid[0],1511,1647,1785,1630,1039,1874,2068,1272,1719,1046,1389,1112,1115,1418,1871,1252,1768,1086,1885,1649,1651,1832,1492,1734,1251,1779,1688,1646,1373,1147,1059,1150,1087,1190,1038,1157,1159,1623,1650,1583,1708,1312,1751,1648,1658;
// Mob Spawn Amount
setarray .mobam[0],1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1;
// Price: Entry as Index from .zeny
// 1 = .zeny[1] - 2 = .zeny[2]
setarray .mobze[0],1,2,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,2,2,1,1,1,1,1,1,2,1,1,1,1,1,1,1,1,1,1,2,1,2,1,1,1,2,2;
set .smenu$,"";
for( set .@s,0; .@s < getarraysize(.mobid); set .@s,.@s + 1) {
// Skips an Monster if it does not exist in the db
if(getmonsterinfo(.mobid[.@s],0) == "" || getmonsterinfo(.mobid[.@s],0) == "null") continue;
// else adding it to the menu
set .smenu$,.smenu$ + "- "+getmonsterinfo(.mobid[.@s],0) + ( (.mobid[.@s+1] == 0)?"":":");
}
end;
}
guild_vs1,31,68,5 duplicate(MVP Summoner) MVP Summoner#1 790
guild_vs1,31,31,5 duplicate(MVP Summoner) MVP Summoner#2 790
guild_vs1,68,31,5 duplicate(MVP Summoner) MVP Summoner#3 790
guild_vs1,68,68,5 duplicate(MVP Summoner) MVP Summoner#4 790

}
}

TIA :D

 

Edited by iMrFreeziNg

10 answers to this question

Recommended Posts

Posted (edited)

I have written this from scratch and I cannot test it, but I hope you get the idea.

 

Add this after warping the player, and before the NPC closes.

close2;
set .MvpUser,getcharid(0,"+strcharinfo(0)+");
Sleep2 1800000;
if(getmapusers(.Map$)) { warpchar "prontera",200,200,.MvpUser; }
end;
Edited by sandbox
Posted

Okay ! thank you..


Hello I seem to have figured it out my problem now is how do I remove the:
 

set #mvproomuse,1;
addtimer 1800000,"Private MVP Room 1::OnEnd";

when ever the server restarts. Thank you. very much..

 

 

Btw heres my script : 



ayothaya,172,171,5	script	Private MVP Room 3	100,{
disablenpc "Room Entrance 3";
set .@n$,"^0000FF[ MVP Warper ]^000000";
set .Map$,"guild_vs4";
mes .@n$;
mes "Hello , Would you like to rent a private MVP room ? It costs 1 ibRO token for 30mins.";
next;
switch(select("Okay let me in!:Maybe next time!")) {
case 1:
	    if(countitem(20600) >= 1) {
				mes .@n$;
				mes "Okay I'm going to warp you.";
				delitem 20600,1;
				warp .Map$,50,50;
				set #mvproomuse3,1;
				addtimer 1800000,"Private MVP Room 3::OnEnd";
				addtimer 900000,"Private MVP Room 3::On15mins";
				addtimer 1740000,"Private MVP Room 3::On1min";
				hideonnpc "Private MVP Room 3";
				enablenpc  "Room Entrance 3";
				end;
			}
				mes .@n$;
				mes "Sorry but you need 1 ibRO Token to rent a private MVP room.";
				close;
				end;

						Case 2:
						mes .@n$;
						mes "Okay Good bye !~.";
						close;
						break;

									OnEnd:
									announce " 30 mins is up ! Please register again to continue using the room.You will be warped in 5 seconds.",3;
									sleep2 5000;
									announce " The Private MVP Room 3 is now opened!",0;
									mapwarp .Map$,"ayothaya",150,167;
									disablenpc "Room Entrance 3";
									hideoffnpc  "Private MVP Room 3";
									set #mvproomuse3,0;
									killmonsterall .Map$;
 									end;
										On15mins:
										announce " 15 minutes left till we reopen the MVP room to the public.",3;	
										end;
											On1min:
											announce " 1 minute left till we reopen the MVP room to the public.",3;	
											end;
							}
}

prontera,153,181,5	script	Room Entrance 3	100,{
		set .Map$,"guild_vs4";
		if( !#mvproomuse3 ){
		mes "[ Guard ]";
		mes " Sorry but only the one who rented the room can enter.";
		close;
		}else{
		mes " [ Guard ] ";
		mes " Do you want to return to the MVP Room ?";
			menu "Yes..",enter_M,"No.",No_bad,"Release MVP Room.",R_reset;
				
					enter_M:
					mes "[ Guard ]";
					mes "Okay, I'm gonna warp you now";
					warp .Map$,50,50;
					close;
					end;

							No_bad:
							mes "[ Guard ]";
							mes "Okay, Bye !~";
							close;
							end;
								R_reset:
								next;
								mes "[ Guard ]";
								mes "Are you sure you want to reset the room ?";
								menu "Yes..",Y_reset,"No.",N_reset;
									Y_reset:
									next;
									mes "[ Guard ]";
									mes "Right away sir!";
									progressbar "",2;
									specialeffect2 248;
									announce " The Private MVP Room 3 has been released by " + strcharinfo(0) + " !",0;
									mapwarp .Map$,"ayothaya",150,167;
									disablenpc "Room Entrance 3";
									hideoffnpc  "Private MVP Room 3";
									set #mvproomuse2,0;
									deltimer "Private MVP Room 3::OnEnd";
									deltimer "Private MVP Room 3::On15mins";
									deltimer "Private MVP Room 3::On1min";
									killmonsterall .Map$;
									close;
										N_reset:
										mes "[ Guard ]";
										mes "Okay then..";
										close;
							}
}

So yeah :) Please help.

Posted

If you're talking about the timer, there's 'deltimer' function for that.. I advise using sleep2 instead of timers.. Can you explain how your script works? Too lazy to read, i'll to write one myself..

Posted

its a private MVP room, thats the npc you would talk to if you want to go inside , there's a payment of 1 token ( 20600 ) to get in.
Once inside a 30min time will start when the timer reaches 0 the renter would be kicked out and there would be announcements that the room X has been opened to the public and a 1min left warning on the user of the room. Theres also a reset function on that npc that would let the player release the room the he renter.



I finished that script already , what I want to do is when ever the server restarts or reboots is it would delete the:

 

set #mvproomuse,1;
addtimer 1800000,"Private MVP Room 1::OnEnd";

That was attached to the player that used it. 

Posted

Kindly test..

 

attachrid(3);
set #mvproomuse,1;
addtimer 1800000,"Private MVP Room 1::OnEnd";

 

OnInit:
set #mvproomuse,0;
detachrid;
deltimer "Private MVP Room 1::OnEnd";
end;

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...