Code:
void ts3plugin_onServerGroupClientListEvent(uint64 serverConnectionHandlerID, uint64 serverGroupID, uint64 clientDatabaseID, const char* clientNameIdentifier, const char* clientUniqueID) {
}
you do have the servergroupID in there so you know whether or not a particular group got scanned. It shouldn't get interrupted but then again I never personally tried that function, certainly not with a larger dataset.
In any case this would be easier done using serverquery as there you can just use clientdblist which gives you the list of all clients in the database for the currently selected server including the last time they connected. You could then check to see if the last connection time is within a certain time period and if not use servergroupsbyclientid to get all the server groups that client is in and call servergroupdelclient for each group that client is in.
You could even just call clientdbdelete for every client that hasn't connected in the time period you care about to instantly wipe that client, instead of going through the server groups of the client and removing them from the groups, which would speed up the process even further and doesn't require a server restart to actually get rid of them.
Unlike a plugin this is not limited to a client and can be run in intervals through a cronjob directly on the server, is fully automatic and likely even faster.