You can either write a GSC script for it or (recommended) use IW4MAdmin.
It's a server manager that does a lot of useful things, allows you to track players (player count, players connected, max players connected etc.), kick, tempban, ban etc. and with all the features it has it has a built-in and easy to use auto messages feature
https://github.com/RaidMax/IW4M-Admin
https://github.com/RaidMax/IW4M-Admin/releases