#include <core>
#include <console>
#include <string>
#include <admin>
#include <adminlib>
 
#define ACCESS_SLAYALL 1
 
new STRING_VERSION[MAX_DATA_LENGTH] = "2.50.0";
new LogFile[]="Logs.txt";
 
public execute_all(a[]) {
    new username[200];
    new i=0;
    new x = 0;
 
    x = maxplayercount();
    for(i=1; i<=x; i=i+1) {
        strinit(username);
        if(playerinfo(i, username, 200)==1) {
            execclient(username, a);
        }
    }
}
 
public admin_slayall(HLCommand,HLData,HLUser,UserIndex) {
    new Command[MAX_COMMAND_LENGTH];
    new Data[MAX_DATA_LENGTH];
    new User[MAX_NAME_LENGTH];
    new Text[MAX_TEXT_LENGTH];
 
    convert_string(HLCommand,Command,MAX_COMMAND_LENGTH);
    convert_string(HLData,Data,MAX_DATA_LENGTH);
    convert_string(HLUser,User,MAX_NAME_LENGTH);
 
    getvar("kill");
    execute_all("kill");
    snprintf(Text, MAX_TEXT_LENGTH, "Everyone was struck down by: %s's wrath.", User);
    snprintf(Text, MAX_TEXT_LENGTH, "[ADMIN] %s used %s.", User, Command);
    writefile(LogFile, Text);
 
    return PLUGIN_HANDLED;
}
 
public plugin_init() {
    plugin_registerinfo("Sharp's Slay all plugin","Slay everyone at once.",STRING_VERSION);
 
    plugin_registercmd("admin_slayall","admin_slayall",ACCESS_SLAYALL,"admin_slayall : Slays everyone at once.");
    return PLUGIN_CONTINUE;
}