/* This was my first real AdminMod plugin =) I redid it because the code was really newb-likely but i guess its still visible ;) */ #include <core> #include <console> #include <string> #include <admin> #include <adminlib> #define ACCESS_PRACTICE 16 new STRING_VERSION[MAX_DATA_LENGTH] = "1.1"; new Password[MAX_DATA_LENGTH]; new ClanTag[MAX_NAME_LENGTH]; public admin_startpractice(HLCommand,HLData,HLUserName,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(HLUserName,User,MAX_NAME_LENGTH); strbreak(Data,ClanTag,Data, MAX_NAME_LENGTH); if (strlen(ClanTag) == 0) { selfmessage("Password/Clan tag missing..."); return PLUGIN_HANDLED; } strbreak(Data,Password,Data,MAX_NAME_LENGTH); if (strlen(Password) == 0) { selfmessage("Password/Clan tag missing..."); return PLUGIN_HANDLED; } snprintf(Text, MAX_TEXT_LENGTH, "Clan Meeting / Practice is about to start - All non-member will be kicked in 15 seconds"); centersay(Text,10,255,0,0); say_command(User,Command,Data); set_timer("ConsolePrint", 15, 0); return PLUGIN_HANDLED; } public ConsolePrint() { new maxplayers = maxplayercount(); new Target[MAX_NAME_LENGTH]; new i = 0; for(i=1; i<=maxplayers; i++) { if(playerinfo(i,Target,MAX_NAME_LENGTH)==1) { if (strstr(Target, ClanTag) == -1) { if(check_immunity(Target)==0) { message(Target, "+ Private clan Meeting / Practice is about to start"); message(Target, "+ We are sorry but all non-members will be kicked"); message(Target, "+ Practice will last 1-2 hours"); message(Target, "+ Please come on back then. Sorry for any inconvience!"); } } } } set_timer("KickThem", 1, 0); } public KickThem() { new maxplayers = maxplayercount(); new Target[MAX_NAME_LENGTH]; new i = 0; new Text[MAX_TEXT_LENGTH]; for(i=1; i<=maxplayers; i++) { if(playerinfo(i,Target,MAX_NAME_LENGTH)==1) { if (strstr(Target, ClanTag) == -1) { if(check_immunity(Target)==0) { kick(Target); } } } } setstrvar("sv_password",Password); snprintf(Text, MAX_TEXT_LENGTH, "Practice has started, non-members kicked and server password set!"); centersay(Text,10,255,0,0); } public admin_endpractice(HLCommand,HLData,HLUserName,UserIndex) { new Command[MAX_COMMAND_LENGTH]; new Data[MAX_DATA_LENGTH]; new Text[MAX_TEXT_LENGTH]; new User[MAX_NAME_LENGTH]; convert_string(HLCommand,Command,MAX_COMMAND_LENGTH); convert_string(HLData,Data,MAX_DATA_LENGTH); convert_string(HLUserName,User,MAX_NAME_LENGTH); setstrvar("sv_password","none"); snprintf(Text, MAX_TEXT_LENGTH, "Practice has ended and the server password has been removed", Data); centersay(Text,10,255,0,0); say_command(User,Command,Data); return PLUGIN_HANDLED; } public plugin_init() { plugin_registerinfo("Clan Practice Plugin","Kicks everyone without a specific clan tag and sets a password on the server.",STRING_VERSION); plugin_registercmd("admin_startpractice","admin_startpractice",ACCESS_PRACTICE,"admin_startpractice <ClanTag> <Password>: Kicks everyone without proper <ClanTag> and sets the server's password"); plugin_registercmd("admin_endpractice","admin_endpractice",ACCESS_PRACTICE,"admin_endpractice: Removes the server's password and tell the clan members that the practice has ended"); return PLUGIN_CONTINUE; }