|
You last visited: Today at 20:48
Advertisement
[Release] Auto Afk Kick
Discussion on [Release] Auto Afk Kick within the CO2 PServer Guides & Releases forum part of the CO2 Private Server category.
12/11/2008, 16:14
|
#1
|
elite*gold: 1142
Join Date: Aug 2006
Posts: 2,464
Received Thanks: 1,161
|
[Release] Auto Afk Kick
Meh, this is just really easy and got this idea from CounterStrike.
This is what it does :
Every 10 minutes it checks if an player have got the same coordinates for 10 minutes. If he / she does, they get kicked, else it continue..
AFK = Away From Keyboard = Not at their computer
NOTE : I did not test this and it could be bugs / not working at all in this code. If you find any please report.
Search for:
Code:
void TimerElapsed(object source, ElapsedEventArgs e)
Above, add :
Code:
void AfkKickElapsed(object source, ElapsedEventArgs e)
{
if (LocMap != MAPID)
{
if (AfkX == LocX && AfkY == LocY && AfkMap == LocMap)
{
World.SendMsgToAll(Name + " has been AFK longer than 10 minutes and therefore got kicked out of the server!", "SYSTEM", 2005);
MyClient.Drop();
}
else
{
AfkX = LocX;
AfkY = LocY;
AfkMap = LocMap;
}
}
}
Search for :
Code:
TheTimer.Interval = 555;
TheTimer.Elapsed += new ElapsedEventHandler(TimerElapsed);
TheTimer.Start();
Under that , add:
Code:
AfkTimer.Interval = 600000;
AfkTimer.Elapsed += new ElapsedEventHandler(AfkKickElapsed);
AfkTimer.Start();
Search for:
public byte StigLevel = 0;
Under , add :
Quote:
public Timer AfkTimer = new Timer();
|
Search for :
Code:
public ushort LocX = 0;
public ushort LocY = 0;
public ushort LocMap = 0;
Under that , add :
Code:
public ushort AfkX = 0;
public ushort AfkY = 0;
public ushort AfkMap = 0;
As I said, simple, but a few did not know it was this simple.
Enjoy
|
|
|
12/11/2008, 16:21
|
#2
|
elite*gold: 0
Join Date: Nov 2008
Posts: 412
Received Thanks: 314
|
but what if the character is on TG? or market vender?
well forget about the market vender thing because no one got it workin yet but TG is a problem is there a way that he doesnt check on TG?
|
|
|
12/11/2008, 16:48
|
#3
|
elite*gold: 1142
Join Date: Aug 2006
Posts: 2,464
Received Thanks: 1,161
|
#UPDATED
The "MAPID" should be an existing mapid. If you want to add a serveral maps that you can be afk in, you do like this :
if (LocMap != MAPID && LocMap != MAPID && LocMap != MAPID) etc etc etc
|
|
|
12/11/2008, 17:37
|
#4
|
elite*gold: 0
Join Date: Jun 2008
Posts: 70
Received Thanks: 3
|
ty Emme That Good code and idea 2
|
|
|
12/11/2008, 17:51
|
#5
|
elite*gold: 0
Join Date: Dec 2007
Posts: 618
Received Thanks: 213
|
omg, why does ppl dont understand, TOO MANY TIMERS = A LOT CPU USAGE
|
|
|
12/11/2008, 17:57
|
#6
|
elite*gold: 0
Join Date: Jan 2007
Posts: 1,034
Received Thanks: 58
|
Quote:
Originally Posted by alexbigfoot
omg, why does ppl dont understand, TOO MANY TIMERS = A LOT CPU USAGE
|
hmm Its kinda True look at Kinshico ... it does have many timers ... and CPU usage is way higher than Orginal LOTF
|
|
|
12/11/2008, 18:01
|
#7
|
elite*gold: 1142
Join Date: Aug 2006
Posts: 2,464
Received Thanks: 1,161
|
Ofcourse we get that. Im just releasing to show people how things work. If you like another way to do this, go ahead, show us.
|
|
|
12/11/2008, 21:38
|
#8
|
elite*gold: 20
Join Date: Jan 2008
Posts: 2,012
Received Thanks: 2,882
|
Quote:
Originally Posted by alexbigfoot
omg, why does ppl dont understand, TOO MANY TIMERS = A LOT CPU USAGE
|
No it doesn't, but timers do infact slow down a .net application. Go find out how user32.dll timers (System.Timers.Timer uses the user32 API) work and you might understand.
|
|
|
12/11/2008, 22:11
|
#9
|
elite*gold: 0
Join Date: Dec 2007
Posts: 618
Received Thanks: 213
|
well...maybe i dunno and many on this forum dont know same, so i cant go in dlls and do things bla bla , but i know 1 thing, i can put all i need in a single timer =);
|
|
|
12/11/2008, 22:14
|
#10
|
elite*gold: 0
Join Date: Oct 2006
Posts: 222
Received Thanks: 27
|
Code:
public System.Timers.Timer AfkTimer = new System.Timers.Timer();
for the nuubs if you get an error: AfkTimer doesn't exist bla bla, add this code underneath:
Code:
public ushort AfkX = 0;
public ushort AfkY = 0;
public ushort AfkMap = 0;
Or somewhere else if you like
|
|
|
12/11/2008, 22:15
|
#11
|
elite*gold: 0
Join Date: Feb 2008
Posts: 1,590
Received Thanks: 154
|
Quote:
Originally Posted by alexbigfoot
well...maybe i dunno and many on this forum dont know same, so i cant go in dlls and do things bla bla , but i know 1 thing, i can put all i need in a single timer =);
|
I can do it all without a timer....
Btw, you're probably still doing one timer per player if you're using LOTF.
|
|
|
12/11/2008, 22:18
|
#12
|
elite*gold: 0
Join Date: Oct 2006
Posts: 222
Received Thanks: 27
|
@tao4229 lol nice (i guess it's nice, because i just started off learning coding :P)
|
|
|
12/11/2008, 22:22
|
#13
|
elite*gold: 1142
Join Date: Aug 2006
Posts: 2,464
Received Thanks: 1,161
|
I dont see why you added that AfkMap blabla, already been defined once ( or did i forget it? )
|
|
|
12/11/2008, 22:22
|
#14
|
elite*gold: 0
Join Date: Feb 2008
Posts: 1,590
Received Thanks: 154
|
Quote:
Originally Posted by sherwin9
@tao4229 lol nice (i guess it's nice, because i just started off learning coding :P)
|
I'm serious; my auto attack doesn't use timers
|
|
|
12/12/2008, 02:15
|
#15
|
elite*gold: 0
Join Date: Dec 2006
Posts: 684
Received Thanks: 238
|
Your spamming this forum with stuff that will only work in the LOTF source, because thats where everything is defined. All your doing is producing more Hamachi LOTF servers, and to be honest you should of just posted all your LOTF creations in one thread.
|
|
|
|
|
Similar Threads
|
[Release] [INT] KalOnline Bot , no kick out (:
07/14/2010 - Kal Online - 27 Replies
read the ; comments , enjoy ~! took me ennuf time to learn this shit and make it.
$e=0
$x=0
$hl=859 ; daemon health x coordinates
$hr=540 ; daemon health y coordinates
$mhl=681 ; your health x coordinates
$mhr=510 ; your health y coordinates
$ylowr=7 ; yellow message when canot press daemon x coordinates
|
[Release]Kick Ass CO
02/15/2010 - CO2 PServer Archive - 1 Replies
Hey, well I want to post up our server for testing and for general gaming (but mostly for testing) our server is connected through Hamachi, for now... until we someone show us how to operate it without Hamachi in a very detailed and possibly team viewed way. :P so, about the whole Hamachi thing, the Hamachi network is called New Generation Gaming and the password is 2468
once you've connected to the server you no longer have to Hamachi running, i know it's Strange and confusing, but it...
|
Metin2 Auto Kick verursachen
03/26/2009 - Metin2 - 6 Replies
hallo, und willkommen zum ersten beitrag xDD
hab ma ne frage:
ich will meinen shop 24std offen lassen, der pc sollte aber keine 24 std laufen
da dachte ich, ich kann doch nen auto kick machen, dann bleib ich eingeloggt, und kann den pc ausschalten, somit wäre mein shop immer noch offen
geht sowas??
thx
|
Xiu Auto Kick
04/04/2008 - Kal Online - 13 Replies
Hat xiu server nen auto ban bei cooldownusing? Ansonsten haben die sehr wachsamme gms :o
|
All times are GMT +2. The time now is 20:48.
|
|