Author Topic: Tracking client join/left action  (Read 12189 times)

Allnei

  • Newbie
  • *
  • Posts: 3
    • View Profile
Tracking client join/left action
« on: September 13, 2012, 04:17:32 PM »
Hi,
first i want thanks you for your great TS Bot. I was able to add functionality that will give ServerAdmin to client if he whisper right password to Bot.

But now i want add second thing. On our server we have problem with Clients that jump from one channel to another in short time, so i want to give them our "jail" servergroup and move them to "jail" channel. What i need know to do this (i know how to do give servergroup, move them, track how much jump they did etc.) is how to track if client join/left channel or sub-channel. I know you have method to catch notifyclientmove but from what i know it can be used on only 1 channel, and i need track client move on whole server.

Thanks

Stefan1200

  • Administrator
  • *****
  • Posts: 2244
    • View Profile
Re: Tracking client join/left action
« Reply #1 on: September 14, 2012, 07:34:25 AM »
Thanks for your message.

But now i want add second thing. On our server we have problem with Clients that jump from one channel to another in short time, so i want to give them our "jail" servergroup and move them to "jail" channel. What i need know to do this (i know how to do give servergroup, move them, track how much jump they did etc.) is how to track if client join/left channel or sub-channel. I know you have method to catch notifyclientmove but from what i know it can be used on only 1 channel, and i need track client move on whole server.

Last time I checked the TS3 server query interface, there is no easy way to do this. But you can save the channel id of every client at every check interval (maybe save the last 12 check intervalls). If this channel id change more than, for example, 2 times within the last 12 check intervalls (= 12 seconds), you can do the actions with that client. Maybe this helps you :)

Allnei

  • Newbie
  • *
  • Posts: 3
    • View Profile
Re: Tracking client join/left action
« Reply #2 on: September 14, 2012, 11:18:48 AM »
And do you have client-channelID implemented in your Bot or i must write it ?

Stefan1200

  • Administrator
  • *****
  • Posts: 2244
    • View Profile
Re: Tracking client join/left action
« Reply #3 on: September 14, 2012, 12:26:28 PM »
And do you have client-channelID implemented in your Bot or i must write it ?

The client list vector of the bot contains the channel id, but you have to create the list to store the last channel ids of a client.

Method checkTS3Clients() in the for loop ("for (HashMap<String, String> clientInfo : clientList)"):
Code: [Select]
clientInfo.get("cid")to get the current channel id.

You can use the int variable clientID to track the client id.

Just a quick idea, maybe use something like:
Vector<HashMap<Integer, Integer>> clientChannelInfo = new Vector<HashMap<Integer, Integer>>();

The Vector has 12 elements (every check one element). The HashMap contains to every client id the channel id.
Every check insert a new element at position 0 to the vector and trim that vector to the limit you want to check back. My example is 12.

Then use a loop to check if that channel id is changing for a client to often and punish them.
« Last Edit: September 14, 2012, 12:32:46 PM by Stefan1200 »

Allnei

  • Newbie
  • *
  • Posts: 3
    • View Profile
Re: Tracking client join/left action
« Reply #4 on: September 17, 2012, 01:21:15 AM »
Thx for advice. I did it little different, but it works :D
If you want i can share code with you and you can add it in next release.

Stefan1200

  • Administrator
  • *****
  • Posts: 2244
    • View Profile
Re: Tracking client join/left action
« Reply #5 on: September 17, 2012, 07:55:31 AM »
Thx for advice. I did it little different, but it works :D
If you want i can share code with you and you can add it in next release.

Maybe when I have time someday, would be great if you send me the files by email.