Tracking client join/left action

Started by Allnei, September 13, 2012, 04:17:32 PM

Previous topic - Next topic

Allnei

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

Thanks for your message.

Quote from: Allnei on September 13, 2012, 04:17:32 PM
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

And do you have client-channelID implemented in your Bot or i must write it ?

Stefan1200

#3
Quote from: Allnei on September 14, 2012, 11:18:48 AM
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)"):
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.

Allnei

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

Quote from: Allnei 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.

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