View Single Post
SweatyBanana
BANNED
Join Date: Sep 2005
Location: LOL
Old 10-28-2006 , 02:15   Re: Executes Commands When Admin Leave
Reply With Quote #6

Code:
#include <amxmodx>

new cmdFile[100]

public client_disconnect(id)
{
    set_task(10.0,"check_admin")    
    return PLUGIN_CONTINUE
    
}
public check_admin()
{
    if(!get_playersnum()==0)
    {
        for(new i =1;i<get_maxplayers();i++)
        {        
            if(is_user_admin(i))
            {
                return PLUGIN_HANDLED
            }
        }
    }
    executeCmds()
    return PLUGIN_CONTINUE        
}

public executeCmds()
{
    log_amx("There Are No Admin, Executing Commands From cmdfile.txt")
    client_print(0,print_chat,"All admin have left, settings returning to normal...")
    new command[50]
    new numChars = 0
    for(new x = 0;x<file_size(cmdFile,1);x++)
    {
        read_file(cmdFile,x,command,49,numChars)
        log_amx("Executing Command %s From cmdfile.txt",command)
        server_cmd(command)
        server_exec()
    }
}

public plugin_init()
{
    register_plugin("Admin Gone","1.0","mp.cain")
    new configsdir[50]
    get_configsdir(configsdir,49)
    format(cmdFile,99,"%s/cmdfile.txt",configsdir)
    return PLUGIN_CONTINUE
}
Yes it executes on any admin leave (ALL ADMINS MUST BE GONE) If they have any admin access flag.
SweatyBanana is offline
Send a message via AIM to SweatyBanana Send a message via Yahoo to SweatyBanana