Anyway i've done that a while ago to ban with the reason so i can help you.
Here is the simple example of Kick and Ban by IP (not the whole plugin)
Code:
new ip[16]
get_user_ip(id, ip, 15, 1)
server_cmd("kick #%d ^"You have been banned for flooding the server.^"", get_user_userid(id))
server_exec()
server_cmd("addip 5 ^"%s^"", ip)