Author Topic: Request - AFK kicker  (Read 2950 times)

0 Members and 4 Guests are viewing this topic.

Offline Psycho

  • Flagrunner
  • ****
  • Posts: 678
  • Decomposing
Request - AFK kicker
« on: December 14, 2007, 05:49:46 pm »
Today I was playing on our clan server, and I came to notice there were one or two people being afk.
I would like a script that could remove theese players from the game (move them to spectator or kicking them)

I know people are being automatically kicked after a while, but when there is a 5 vs 4 and 1 guy on the team with 4 is AFK, you dont wanna wait 5-10 minutes for that to happen.

So what the /kick afk (or whatever) would do, is to kick everyone who has being standing still for a certain amount of time.
Could also be /spec afk to set them as spectators so they can resume playing when they get back.

I know you can also move them there manually, but that is kind of more time consuming than you would sometimes like it to be.
Looking down from ethereal skies

Offline chrisgbk

  • Moderator
  • Veteran
  • *****
  • Posts: 1739
Re: Request - AFK kicker
« Reply #1 on: December 14, 2007, 06:06:13 pm »
There isn't a reliable way to detect when someone is AFK from inside the scripting engine.

Not that it's not possible, but it's not reliable.

Offline Psycho

  • Flagrunner
  • ****
  • Posts: 678
  • Decomposing
Re: Request - AFK kicker
« Reply #2 on: December 14, 2007, 06:08:17 pm »
Perhaps in a scripting core update?
Looking down from ethereal skies

Offline Ride

  • Soldier
  • **
  • Posts: 199
    • NA Soldat Clan Website
Re: Request - AFK kicker
« Reply #3 on: December 14, 2007, 07:24:12 pm »
You wait.. 1 -2 minutes at most

Dunno why u just cant spec them or remove them urself
Ingame Name: TC ~ Ryde.Lf ~
Past Clans: ^Re/ ~ -eO:

Offline Psycho

  • Flagrunner
  • ****
  • Posts: 678
  • Decomposing
Re: Request - AFK kicker
« Reply #4 on: December 14, 2007, 08:46:58 pm »
It takes way beyond 1-2 minutes, and as I said, I want to be able to perform a quick command instead of minimizing into ARSSE or finding out the players numbers so I can move him to spec.

Doing it by name is also a problem when their names are @1337@%£NINJA][[]®
« Last Edit: December 14, 2007, 08:48:39 pm by Psycho »
Looking down from ethereal skies

Offline poutch

  • Major(1)
  • Posts: 34
Re: Request - AFK kicker
« Reply #5 on: December 14, 2007, 10:04:45 pm »
you could make something around that :

POSITION : array[1..MAXPLAYERS] of single;
AFKTIME : array[1..MAXPLAYERS] of byte;

Init the arrays to 0

In ApponIdle You check every 10 seconds for example and :

for i:= 1 to MAXPLAYERS do begin
  if GetPlayerXY(i,X,Y) = POSITION then AFKTIME := AFKTIME + 10; // position didn t change, we increase AFKTIME
  else AFKTIME := 0;
  POSITION := GetPlayerXY(i,X,Y); //getting new positions
end;

if AFKTIME > 120 then KickPlayer(i);

well you get the idea
www.pleez.fr .... coming soon

Offline chrisgbk

  • Moderator
  • Veteran
  • *****
  • Posts: 1739
Re: Request - AFK kicker
« Reply #6 on: December 14, 2007, 10:08:40 pm »
It takes way beyond 1-2 minutes, and as I said, I want to be able to perform a quick command instead of minimizing into ARSSE or finding out the players numbers so I can move him to spec.

Doing it by name is also a problem when their names are @1337@%£NINJA][[]®

Ingame, type /, then hit F1, and you can see the player number of every player, no need to alt tab into ARSSE. You should be able to find their number by the time you type "setteam5 ".

you could make something around that :

POSITION : array[1..MAXPLAYERS] of single;
AFKTIME : array[1..MAXPLAYERS] of byte;

Init the arrays to 0

In ApponIdle You check every 10 seconds for example and :

for i:= 1 to MAXPLAYERS do begin
 if GetPlayerXY(i,X,Y) = POSITION then AFKTIME := AFKTIME + 10; // position didn t change, we increase AFKTIME
 else AFKTIME := 0;
 POSITION := GetPlayerXY(i,X,Y); //getting new positions
end;

if AFKTIME > 120 then KickPlayer(i);

well you get the idea

The basic idea might work, although what you wrote definitely won't.

Offline mar77a

  • Global Moderator
  • Veteran
  • *****
  • Posts: 1295
  • mad
    • random stuffs
Re: Request - AFK kicker
« Reply #7 on: December 14, 2007, 10:29:41 pm »
Suggestion: can you make the fixed 5 minutes idle-kick a setting in server.ini?

Offline poutch

  • Major(1)
  • Posts: 34
Re: Request - AFK kicker
« Reply #8 on: December 15, 2007, 03:15:37 am »
It takes way beyond 1-2 minutes, and as I said, I want to be able to perform a quick command instead of minimizing into ARSSE or finding out the players numbers so I can move him to spec.

Doing it by name is also a problem when their names are @1337@%£NINJA][[]®

Ingame, type /, then hit F1, and you can see the player number of every player, no need to alt tab into ARSSE. You should be able to find their number by the time you type "setteam5 ".

you could make something around that :

POSITION : array[1..MAXPLAYERS] of single;
AFKTIME : array[1..MAXPLAYERS] of byte;

Init the arrays to 0

In ApponIdle You check every 10 seconds for example and :

for i:= 1 to MAXPLAYERS do begin
 if GetPlayerXY(i,X,Y) = POSITION then AFKTIME := AFKTIME + 10; // position didn t change, we increase AFKTIME
 else AFKTIME := 0;
 POSITION := GetPlayerXY(i,X,Y); //getting new positions
end;

if AFKTIME > 120 then KickPlayer(i);

well you get the idea

The basic idea might work, although what you wrote definitely won't.

Yeah i know what i wrote doesn t work directly... i just wanted to show the idea, that s easy enough for people to complete it anyway
« Last Edit: December 15, 2007, 03:22:22 am by poutch »
www.pleez.fr .... coming soon

Offline ghg

  • Camper
  • ***
  • Posts: 411
  • Village Idiot
Re: Request - AFK kicker
« Reply #9 on: December 16, 2007, 06:19:40 am »
Bye bye snipers? Take kills and chat into account.
-=Gradius wuz you=-

Offline Psycho

  • Flagrunner
  • ****
  • Posts: 678
  • Decomposing
Re: Request - AFK kicker
« Reply #10 on: December 16, 2007, 10:30:06 am »
Snipers do atlest move their crosshairs and interact some with their keyboard and mouse.
Looking down from ethereal skies

Offline poutch

  • Major(1)
  • Posts: 34
Re: Request - AFK kicker
« Reply #11 on: December 16, 2007, 10:56:02 pm »
Bye bye snipers? Take kills and chat into account.

OnPlayerKill -> AFKTIME[Killer] := 0
OnPlayerSpeak -> AFKTIME[ID] := 0

Date Posted: December 16, 2007, 07:11:50 pm
and the version without Onplayerkill and onplayerspeak can be used for campers kicking in option ;p
www.pleez.fr .... coming soon

Offline KwS Pall

  • Major(1)
  • Posts: 49
  • I'm going to write Tibia for Soldat
Re: Request - AFK kicker
« Reply #12 on: December 17, 2007, 05:27:56 am »
but campers usually lie on the ground and afkers stay, so you should check if the player lie or stand on the ground...
I'm going to write Tibia for Soldat

Offline Psycho

  • Flagrunner
  • ****
  • Posts: 678
  • Decomposing
Re: Request - AFK kicker
« Reply #13 on: December 17, 2007, 10:37:51 am »
OnPlayerShoot -> AFKTIME[Killer] := 0 ?

I dont know feck about scripting, but that should be possible
Looking down from ethereal skies

Offline Boblekonvolutt

  • Soldier
  • **
  • Posts: 222
  • "YOU are a CAR."
Re: Request - AFK kicker
« Reply #14 on: December 17, 2007, 11:57:20 am »
Should but isn't.

Offline mxyzptlk

  • Veteran
  • *****
  • Posts: 1493
  • The Panda Ninja
Re: Request - AFK kicker
« Reply #15 on: December 17, 2007, 12:58:49 pm »
but campers usually lie on the ground and afkers stay, so you should check if the player lie or stand on the ground...
No, because AFKers who know they'll be AFK prone to avoid being killed.

"While preceding your entrance with a grenade is a good tactic in
Quake, it can lead to problems if attempted at work." -- C Hacking

Offline DorkeyDear

  • Veteran
  • *****
  • Posts: 1507
  • I also go by Curt or menturi
Re: Request - AFK kicker
« Reply #16 on: December 17, 2007, 03:49:33 pm »
but campers usually lie on the ground and afkers stay, so you should check if the player lie or stand on the ground...
besides, not detectable as far as i know via soldat scripting

Offline KwS Pall

  • Major(1)
  • Posts: 49
  • I'm going to write Tibia for Soldat
Re: Request - AFK kicker
« Reply #17 on: December 18, 2007, 08:24:51 am »
yes Curt u r right, you can only check if the player is on the ground...
I'm going to write Tibia for Soldat

Offline Boblekonvolutt

  • Soldier
  • **
  • Posts: 222
  • "YOU are a CAR."
Re: Request - AFK kicker
« Reply #18 on: December 18, 2007, 08:46:41 am »
Anyway, if a player doesn't move, speak, shoot, does damage, kills, interacts with flag, switches weapon, use jets, throw nades, change direction, change teams or uses a command in a couple of minutes, he's probably afk... I think a script like it would be pretty wasted though. Just do it yourself, or let players vote.