Jump to content
  • 0

Auto Kick or Return to save point when AFK


WhatFT

Question


  • Group:  Members
  • Topic Count:  142
  • Topics Per Day:  0.03
  • Content Count:  511
  • Reputation:   7
  • Joined:  02/15/12
  • Last Seen:  

Can anyone help me with this script? Can someone edit this script and add Auto Kick when they AFK in a certain minute (2 mins) and only works in bat_c01.

Or Can anyone make a script where the script ONLY WORKS on bat_c01.

//*********************************************************************************************************************************************************************************
//*********************************************************************************************************************************************************************************
//***-- Script by :
//***-- Syllabear
//***
//*********************************************************************************************************************************************************************************
//*********************************************************************************************************************************************************************************
//***-- Messages :
//***-- I will do my best to help you
//***-- More Details ? PM Me
//***
//*********************************************************************************************************************************************************************************
//***
//*********************************************************************************************************************************************************************************
//***Although these scripts might not suit or follow with what you have requested completely. But i still wish you can give it a try before reject the works.
//***
//*********************************************************************************************************************************************************************************

//-------------------------MONSTER DATABASE [ REPLACE it in Your MOB_DB.txt ]  --------------------------------------------------------------------
//-------------------------NPC [ Warper + Exchanger  ]  --------------------------------------------------------------------
belagio,72,61,7	script	Gold Room	452,{
mes "[ Gold Room Manager ]";
mes "Hello, ";
mes "How may i serve for you ?";
mes "I can warp you to a Gold Mine.";
mes "Would you like to go there try to get some gold ?";
mes "You could be get rich if you lucky enough.";
next;
switch(select("Hunt Now:Later")) {
	Case 1:
	mes "[ Gold Room Manager ]";
	mes "Okay, here you go";
	next;
	mes "[ Gold Room Manager ]";
	mes "Enjoy !";
	close2;  
	warp "bat_c01",0,0;
	end;
	Case 2:
	mes "[ Gold Room Manager ]";
	mes "Okay, I'll wait you.";
	close;
	Case 3:
	mes "[ Gold Room Manager ]";
	mes "Do you wish to change it into ";
	mes "^0000FFBronze Coin^000000?";
	next;
	switch(select("Exchange:Not yet")) {
	case 1:
		mes "[ Gold Room Manager ]";
		mes "you have ";
		mes "- "+countitem(969)+" x ^008800 Golds^000000";
		mes "- "+countitem(7444)+" x ^008800 Treasure Boxes^000000";
		next;
		switch(select("Gold to Bronze Coin:Treasure Box to Coin")) {
			Case 1:
			mes "[ Gold Room Manager ]";
			if(countitem(969)<100){
				mes "You dont have enough gold with you.";
				close;
			}
			if(countitem(969)>100){
				mes "Okay there you go.";
				mes "100 Gold has been changed to 10 Bronze Coin";
				delitem 969,100;
				getitem 673,10;
				close;
				end;
			}
			Case 2:
			mes "[ Gold Room Manager ]";
			if(countitem(7444)<100){
				mes "You dont have enough treasure box with you.";
				close;
			}
			if(countitem(969)>100){
				mes "Okay there you go.";
				mes "100 Treasure Box has been changed to 10 Bronze Coin";
				delitem 7444,100;
				getitem 673,10;
				close;
				end;
			}
		}
	}
}
}

//-------------------------MONSTER SPAWN--------------------------------------------------------------------

bat_c01,0,0,0,0	monster	Gold Room Angel	1852,80,0,0,0
bat_c01,0,0,0,0	monster	Gold Room Devil	1853,80,0,0,0
bat_c01,0,0,0,0	monster	Gold Room Guardian	2071,1,0,0,0

THANK YOU GUYS !

Edited by Brian
use [codebox] for scripts longer than 10 lines
Link to comment
Share on other sites

9 answers to this question

Recommended Posts


  • Group:  Members
  • Topic Count:  14
  • Topics Per Day:  0.00
  • Content Count:  118
  • Reputation:   6
  • Joined:  01/25/12
  • Last Seen:  

npc cannot check if player is in idle mode i think >.<

Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  7
  • Topics Per Day:  0.00
  • Content Count:  130
  • Reputation:   43
  • Joined:  12/11/11
  • Last Seen:  

You can check if the player haven't moved in a set time interval, it's no safe bet that he/she is afk tho.

For more information, look up: getmapxy, sleep2 and OnPCLoadMapEvent.

  • Upvote 1
Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  14
  • Topics Per Day:  0.00
  • Content Count:  118
  • Reputation:   6
  • Joined:  01/25/12
  • Last Seen:  

//Script by: BrianL
- script IdleKick -1,{
OnPCLoginEvent:
set .interval, 1; // How often to check? (seconds)
set .max_idle, 120; // Idle time before kicking? (seconds)

getmapxy( @map$, @x, @y, 0 );
addtimer .interval *1000, strnpcinfo(3)+"::OnCheck";
end;
OnCheck:
getmapxy( .@map$, .@x, .@y, 0 );

if( .@map$ == "bat_c01" ) {
 if (.@map$==@map$ && .@x==@x && .@y==@y) { // same map,x,y (idle)
  set @idle_seconds, @idle_seconds + .interval;
 } else { // they moved, so reset idle timer
  set @idle_seconds, 0;
 }
 set @map$,.@map$; set @x,.@x; set @y,.@y;

 if (@idle_seconds >= .max_idle) {
  dispbottom "Idle characters are not allowed in Gold Room.   Warping to save point...";
  warp "SavePoint",0,0; // warp out
  // atcommand "@kick "+strcharinfo(0); // or kick
 }
}
addtimer .interval *1000, strnpcinfo(3)+"::OnCheck";
end;
}

  • Like 1
Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  142
  • Topics Per Day:  0.03
  • Content Count:  511
  • Reputation:   7
  • Joined:  02/15/12
  • Last Seen:  

Thanks deathscythe03, ahm, last request, can you upload it in pastebin =(

Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  142
  • Topics Per Day:  0.03
  • Content Count:  511
  • Reputation:   7
  • Joined:  02/15/12
  • Last Seen:  

Thank You sir, I'll try it sorry because I don't know how to tab them >.< Confuse about it..

Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  6
  • Topics Per Day:  0.00
  • Content Count:  22
  • Reputation:   7
  • Joined:  06/22/12
  • Last Seen:  

I have a problem with the script.

When the user is attacking, he/she still get kicked. Cause he's on a single cell while attacking. Is it possible to add a condition wherein when the player attacks, his/her timer gets reset?

Link to comment
Share on other sites


  • Group:  Forum Moderator
  • Topic Count:  93
  • Topics Per Day:  0.02
  • Content Count:  10013
  • Reputation:   2346
  • Joined:  10/28/11
  • Last Seen:  

we dont have official event label or script command to check whether the player is attacking or not...

Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  6
  • Topics Per Day:  0.00
  • Content Count:  22
  • Reputation:   7
  • Joined:  06/22/12
  • Last Seen:  

Oh Ok.. Thanks for the quick response Emistry. :D

Link to comment
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.   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.

×
×
  • Create New...