|
You last visited: Today at 18:14
Advertisement
Can someone help me with a AFK timer ?
Discussion on Can someone help me with a AFK timer ? within the CO2 Private Server forum part of the Conquer Online 2 category.
03/06/2010, 12:20
|
#1
|
elite*gold: 0
Join Date: Feb 2010
Posts: 492
Received Thanks: 222
|
Can someone help me with a AFK timer ?
So I saw an AFK timer and it looked pretty cool so I wanted to use it and as you have most likely guest that it was LOTF and LOTF = **** so.... So I was think something like
AFK for 10 mins you get auto-kicked
and maybe add a code so like if (!==1002) || (!==1038)
so like if your in ANY map u get kicked after 10mins of not moving but (!==1002) can be there so I can add a map that does NOT have the Auto AFK timer.
So can anyone help me out ? or you can just PM me the code if you dont want other people having it
Many Thanks,
Paralyzer!
|
|
|
03/06/2010, 14:45
|
#2
|
elite*gold: 0
Join Date: Jan 2009
Posts: 1,922
Received Thanks: 491
|
well not moving isthe first step.. not talking is the second step. not doing anything in their inventory or checking things out is the third step.
|
|
|
03/06/2010, 15:47
|
#3
|
elite*gold: 0
Join Date: Feb 2010
Posts: 492
Received Thanks: 222
|
Cheers, but my question was can someone give me the code ?
|
|
|
03/06/2010, 15:52
|
#4
|
elite*gold: 0
Join Date: Jan 2009
Posts: 1,922
Received Thanks: 491
|
**** NO
|
|
|
03/06/2010, 15:56
|
#5
|
elite*gold: 0
Join Date: Feb 2010
Posts: 492
Received Thanks: 222
|
lol why its just a little code ** have a biscuit  **
|
|
|
03/06/2010, 16:01
|
#6
|
elite*gold: 0
Join Date: Oct 2009
Posts: 8,783
Received Thanks: 5,304
|
Quote:
Originally Posted by Paralyzer[GM]
lol why its just a little code ** have a biscuit  **
|
Reason people won't give you the code is because this forum is full of leechers and most of us intermediate people want the newcomers to try to learn for themselves. Well that's my reason anyways.
|
|
|
03/06/2010, 16:05
|
#7
|
elite*gold: 0
Join Date: Jan 2009
Posts: 1,922
Received Thanks: 491
|
my reason is do it ur ******* self. and + no one uses a afk timer for their server because its plain stupid... there is multiple things u have to count for ( its possible, itsbeen done)
- Training Ground
- Attacking Guild Pole
- Talking with friends
- Viewing items and different combinations
- Thinking of a cool name to change yours to
- leveling skills..
whoever wants to kick players out of their server for no reason other than being gone for like 5 seconds... seriously what if the person has to go somewhere and returns? hes like brb for 10 mins u gonna kick him? .. anyway why would u kick players? people want to get MORE players not less.
|
|
|
03/06/2010, 16:09
|
#8
|
elite*gold: 0
Join Date: Feb 2010
Posts: 492
Received Thanks: 222
|
Can anyone teach me how to code such a thing ?
|
|
|
03/06/2010, 16:13
|
#9
|
elite*gold: 0
Join Date: Jan 2009
Posts: 1,922
Received Thanks: 491
|
did u try urself and btw lotf does not equal ****.
|
|
|
03/06/2010, 16:25
|
#10
|
elite*gold: 0
Join Date: Feb 2010
Posts: 492
Received Thanks: 222
|
I did attempt it but no luck just got a **** load of errors so clearly nobody can help me or teach me to learn these things so
#Request Close
|
|
|
03/07/2010, 00:54
|
#11
|
elite*gold: 0
Join Date: Jun 2009
Posts: 787
Received Thanks: 314
|

Perfect guide.
|
|
|
03/07/2010, 01:27
|
#12
|
elite*gold: 0
Join Date: Jul 2008
Posts: 259
Received Thanks: 73
|
Quote:
Originally Posted by _tao4229_

Perfect guide.
|
pwnt + agreed. read some tuts...
|
|
|
03/07/2010, 01:42
|
#13
|
elite*gold: 21
Join Date: Jul 2005
Posts: 9,193
Received Thanks: 5,380
|
I'd suggest a date time check.
Under your characters I'd do a datetime controling when the last 'action' was and a bool controlling if the character is afk or not.
Then in your movement, attack and chat sections reset the date time to current datetime (saying the last time the client was active is now)
Then where your source handles server checks (such as pk tourneys, dis city or w/e), do a loop through all connected client seeing if they are not on certain maps (market/tg) check if their last action + 10 minutes is less than the current date time. if so, kick them... or use an afk bool which you could use to display an effect around a character to show they are 'away' or whatnot.
|
|
|
03/07/2010, 18:14
|
#14
|
elite*gold: 0
Join Date: Mar 2010
Posts: 133
Received Thanks: 22
|
Here..I just wrote this..Just an example..
I wrote this just now...This could help you a little bit..I hope you continue from what I wrote otherwise it was just a waste of my time.. I thought since no one really is "helping" you , I guess i would...
Code:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Timers;
/* AFK Timer Project..Quick Example */
/* EP-PN © 2010 */
namespace AFKTimerProjectQuick
{
public class Program
{
public static void Check(Character Entity)
{
if (Entity._LastAction == Character.LastAction.Fighting || Entity._LastAction == Character.LastAction.Move || Entity._LastAction == Character.LastAction.Talk)
{
if (Entity.LastActionTime.Minute > 15) // The Entity's last action is greater than 15 minutes..kick
{
Console.WriteLine(Entity.Name + " is AFK..being kicked");
Entity.Drop();
}
}
}
static void Main(string[] args)
{
Console.Title = "AFK Timer Quick Example v1.0";
Character startChar = new Character();
Console.ReadLine();
}
}
public class Character
{
public string Name;
public byte Level;
public UInt16 MapId;
public UInt16 X_Cord;
public UInt16 Y_Cord;
public Timer AFKTimer = new Timer();
public LastAction _LastAction;
public DateTime LastActionTime;
public enum LastAction
{
Talk,
Move,
Fighting,
}
public Character()
{
AFKTimer.Interval = 1000;
AFKTimer.Elapsed += new ElapsedEventHandler(AFKTimer_Elapsed);
AFKTimer.Start();
}
void AFKTimer_Elapsed(object sender, ElapsedEventArgs e)
{
Program.Check(this);
}
internal void Tele(UInt16 x, UInt16 y)
{
X_Cord = x;
Y_Cord = y;
_LastAction = LastAction.Move;
LastActionTime = DateTime.Now;
}
internal void Drop()
{
// Kick
}
}
public class Client
{
Character _Entity = new Character();
Character subAttacker = new Character();
public void SendPacket()
{
UInt16 PacketID = new UInt16(); // Quick Example...Really does nothing..
switch (PacketID)
{
/* Don't know if any are attacking or moving or talking, but you should see what i mean */
case 21: // Attack
Attack(_Entity, subAttacker);
break;
case 133: // Move
Move();
break;
case 1018: // Talk
Chat();
break;
}
}
public void Attack(Character Attacker, Character Attacked)
{
// Attacking Calculations
Attacker._LastAction = Character.LastAction.Fighting;
Attacker.LastActionTime = DateTime.Now;
Attacked._LastAction = Character.LastAction.Fighting;
Attacked.LastActionTime = DateTime.Now;
}
public void Move()
{
System.Random newMove = new Random();
int _x = newMove.Next(1, 999);
int _y = newMove.Next(1, 999);
_Entity.Tele(Convert.ToUInt16(_x), Convert.ToUInt16(_y));
}
public void Chat()
{
// Blah Blah Blah..Check Commands
InternalUniverse.SendMessage(_Entity, "Hello, This is just an example.", 2005);
}
}
public class InternalUniverse
{
public static void SendMessage(Character _Char, string Message, UInt16 type)
{
switch (type)
{
case 2005: // Top
Console.WriteLine("[TOP]"+_Char.Name + ": " + Message + "");
break;
case 2000: // Regular
Console.WriteLine(_Char.Name + ": " + Message + "");
break;
case 2072: // Broadcast
Console.WriteLine("[BROADCAST]"+_Char.Name + ": " + Message + "");
break;
case 111: // SYSTEM
Console.WriteLine("[SYSTEM]" + _Char.Name + ": " + Message + "");
break;
}
_Char._LastAction = Character.LastAction.Talk;
_Char.LastActionTime = DateTime.Now;
}
}
}
If you want to omit some maps under
Code:
Public DateTime LastActionTime;
put something like this
Code:
public UInt16[] OmittedMaps = new UInt16[5] { 1002, 1015, 1050, 1323, 1564 };
Then at this part
Code:
if (Entity.LastActionTime.Minute > 15) // The Entity's last action is greater than 15 minutes..kick
{
Console.WriteLine(Entity.Name + " is AFK..being kicked");
Entity.Drop();
}
Change it to
Code:
if (Entity.LastActionTime.Minute > 15) // The Entity's last action is greater than 15 minutes..kick
{
if (Entity.OmittedMaps.Contains(Entity.MapId))
Console.WriteLine(Entity.Name + " is AFK BUT!!! is allowed to stay online due to training ground or somereason");
else
{
Console.WriteLine(Entity.Name + " is AFK..being kicked");
Entity.Drop();
}
}
reply also.. want to know if it helped u ><
|
|
|
03/07/2010, 18:36
|
#15
|
elite*gold: 0
Join Date: Feb 2010
Posts: 492
Received Thanks: 222
|
THANK YOU!
but were do I put
Code:
[B][B]using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Timers;
/* AFK Timer Project..Quick Example */
/* EP-PN © 2010 */
namespace AFKTimerProjectQuick
{
public class Program
{
public static void Check(Character Entity)
{
if (Entity._LastAction == Character.LastAction.Fighting || Entity._LastAction == Character.LastAction.Move || Entity._LastAction == Character.LastAction.Talk)
{
if (Entity.LastActionTime.Minute > 15) // The Entity's last action is greater than 15 minutes..kick
{
Console.WriteLine(Entity.Name + " is AFK..being kicked");
Entity.Drop();
}
}
}
static void Main(string[] args)
{
Console.Title = "AFK Timer Quick Example v1.0";
Character startChar = new Character();
Console.ReadLine();
}
}
public class Character
{
public string Name;
public byte Level;
public UInt16 MapId;
public UInt16 X_Cord;
public UInt16 Y_Cord;
public Timer AFKTimer = new Timer();
public LastAction _LastAction;
public DateTime LastActionTime;
public enum LastAction
{
Talk,
Move,
Fighting,
}
public Character()
{
AFKTimer.Interval = 1000;
AFKTimer.Elapsed += new ElapsedEventHandler(AFKTimer_Elapsed);
AFKTimer.Start();
}
void AFKTimer_Elapsed(object sender, ElapsedEventArgs e)
{
Program.Check(this);
}
internal void Tele(UInt16 x, UInt16 y)
{
X_Cord = x;
Y_Cord = y;
_LastAction = LastAction.Move;
LastActionTime = DateTime.Now;
}
internal void Drop()
{
// Kick
}
}
public class Client
{
Character _Entity = new Character();
Character subAttacker = new Character();
public void SendPacket()
{
UInt16 PacketID = new UInt16(); // Quick Example...Really does nothing..
switch (PacketID)
{
/* Don't know if any are attacking or moving or talking, but you should see what i mean */
case 21: // Attack
Attack(_Entity, subAttacker);
break;
case 133: // Move
Move();
break;
case 1018: // Talk
Chat();
break;
}
}
public void Attack(Character Attacker, Character Attacked)
{
// Attacking Calculations
Attacker._LastAction = Character.LastAction.Fighting;
Attacker.LastActionTime = DateTime.Now;
Attacked._LastAction = Character.LastAction.Fighting;
Attacked.LastActionTime = DateTime.Now;
}
public void Move()
{
System.Random newMove = new Random();
int _x = newMove.Next(1, 999);
int _y = newMove.Next(1, 999);
_Entity.Tele(Convert.ToUInt16(_x), Convert.ToUInt16(_y));
}
public void Chat()
{
// Blah Blah Blah..Check Commands
InternalUniverse.SendMessage(_Entity, "Hello, This is just an example.", 2005);
}
}
public class InternalUniverse
{
public static void SendMessage(Character _Char, string Message, UInt16 type)
{
switch (type)
{
case 2005: // Top
Console.WriteLine("[TOP]"+_Char.Name + ": " + Message + "");
break;
case 2000: // Regular
Console.WriteLine(_Char.Name + ": " + Message + "");
break;
case 2072: // Broadcast
Console.WriteLine("[BROADCAST]"+_Char.Name + ": " + Message + "");
break;
case 111: // SYSTEM
Console.WriteLine("[SYSTEM]" + _Char.Name + ": " + Message + "");
break;
}
_Char._LastAction = Character.LastAction.Talk;
_Char.LastActionTime = DateTime.Now;
}
}[/B][/B]
}
|
|
|
 |
|
Similar Threads
|
Help with gw timer
02/10/2010 - CO2 Private Server - 0 Replies
Hey, i am using a timer on my gw and im trying to figure out how to make it that the timer could restart before it ends. if you can help me then reply here or add me on msn
[email protected]
thx in advance
flamers will be reported
|
Timer
07/08/2009 - CO2 Private Server - 12 Replies
Would thi sbe how i go about making a timer for my server?
In General.cs
public static System.Timers.Timer Thetimer;
//Regular Save Timer
Thetimer = new System.Timers.Timer();
Thetimer.Interval = 5000;//5 seconds
Thetimer.Elapsed += new ElapsedEventHandler(Thetimer_Elapsed);
Thetimer.Start();
|
[au3]Timer
08/26/2008 - General Coding - 2 Replies
hallo, habe eine frage zu einem timer, undzwar soll es im endeffekt so aussehen das sich ein label auf einer form im sekundentakt von selbst aktualisiert, quasi wie nen timer ;)
leider hab ich kein plan wo ich da ansetzen kann.
hier mal ein codeausschnitt:
$countdown ist die variable die in dem label aktualisiert werden soll.
.....
#Region ### START Koda GUI section ### Form=
|
Timer
06/04/2008 - Metin2 - 13 Replies
Hey leute kann mir jemand bitte eine datei programmiern, die nachdem start den pc in 90 mins herunterfährt. :)
ich bräuchte ihn für den angelbot;), damit ich ihn starten kann, wenn ich in der schule bin, ohne das der pc umsonst so lang an bleibt.:D
|
Timer
01/14/2005 - General Gaming Discussion - 8 Replies
Hi Leutz
Dieser Timer is ne gute hilfe fuer alle Klassen die beim OP fight mit machen.
Der Timer zeigt euch welcher Buff gerade ausgeht (10min Resistbuff) und wann Shelter/def ausläuft... für das schöne syncgelame ^^... gf and hf ;)
http://home.pages.at/smoker/timer/timer.zip
mfg das BluB
|
All times are GMT +1. The time now is 18:14.
|
|