How to put a maximum real-time users limit

I think you will more likely receive responses to your question if you provide a bit more information, at the moment your question is very vague so it’s not clear what you are trying to achieve.

From the little information you’ve provided it sounds like you want to limit how many people can access your site simultaneously. If this is desired from a performance perspective, for instance as a way to keep your site running well then this is something you’d need to do lower down in the server stack.

A user would have to come to your site and access content running on WordPress in order for a plugin to be triggered, but by that time you’ve already used a lot of resources to achieve that. Limiting user access within the web server software such as Apache or Nginx would be preferable for this.