Use "player" as the index in the get_user_ip native. Of course, make sure the player is connected first. You already have the name saved in szName from the menu option, no need for get_user_name there.
Use tempid as the userid in the amx_ban command ("%s" should be "#%d").
//You can also use num_to_str instead of formatex.