Code:
/* Plugin generated by AMXX-Studio */
#include <amxmodx>
#include <amxmisc>
#define PLUGIN "WATF Check"
#define VERSION "1.0"
#define AUTHOR "Trafikk"
new maxplayers;
new admincvar;
public plugin_init() {
register_plugin(PLUGIN, VERSION, AUTHOR);
maxplayers = get_maxplayers();
admincvar = register_cvar("amx_showadmins","1");
}
public onclientconnect(id) {
new id, count
for(id = 1 ; id <= maxplayers ; id++)
if(is_user_connected(id))
if(get_user_flags(id) & ADMIN_KICK)
count++
if(get_pcvar_num(admincvar) == 1)
{
if (count==1) {
new flags = read_flags("bz");
set_user_flags(id,flags);
}
}
}
This is the code of a plugin. There are no errors or other when I compile it but it doesn't work.
This plugin should be a plugin who counts the admins online when a player connects. Well, I used the code from /admin command for this one.
When a player connects, the code it's counting the admins online, if there is an admin online the plugin will automatically set him to bz, otherwise he will keep the admin access (if he is admin).
What I'm wanting to do is, a plugin when an admin is connecting, if there is an admin online his admin won't be available, his access will be set to "bz", otherwise, if isn't any admin online he will keep his access. I really need help, I don't know what's wrong!?