Make sure you have a global var maxplayers and set its value to get_maxplayers() in plugin init. Also, no need for the new_flags variable, put read_flags directly in set_user_flags..or just use ( ADMIN_BAN | ADMIN_USER ) (assuming flag b is ADMIN_BAN and z is ADMIN_USER). Be sure to call remove_user_flags prior to setting flags since set_user_flags is actually add_user_flags.
remove_user_flags( id );
set_user_flags( id , ADMIN_BAN | ADMIN_USER );