/************************************************************************************************ * * * PLUGIN NAME: Clan vs All Plugin * * * * AUTHOR: Mark Mclean * * CONTACT: bg_27@yahoo.com * * DATE: December 6, 2002 * * ABOUT: This plugin is so that you can setup a CLAN vs ALL setup on your server. * * When this plugin is started, it will switch all users with the clan tag to the * * specified team, it will then switch all non-clan members to the oposite team. It * * sets mp_autoteambalance to 0, disables the ability to change teams. Also when new * * players join the server when the plugin is activated they are put on the * * appropriate team, clan members on the specified team and non-clan members on the * * opposite team, when joining you do not have a choice of which team you choose. * * * * COMMANDS: admin_clanvsall <ct|t> * * * * HOW TO USE: Run the admin_clanvsall command and specify a team you want YOUR clan to be * * on. If you toggle the same command with or without a speicified clan, it * * diables the plugin. * * * * CONFIGURATION: To configure, edit the ACCESS_CLANVSALL and specify the user access level * * that is allowed to access this command. Then edit the CLAN variable, in the * * quotations replace "YOUR_CLAN_TAG_HERE" with your clan tag. EXACT CASE MUST * * MATCH! In your server.cfg * * * * IMPORTANT NOTE: In your adminmod configuration file allow_client_exec MUST be * * set to 1, or this plugin will not work! * ************************************************************************************************/ #include <core> #include <console> #include <string> #include <admin> #include <adminlib> //************* CONFIGURATION VARIABLES - READ THE TEXT ABOVE ON HOW TO CONFIGURE *************** #define ACCESS_CLANVSALL 8192 //This is the admin access level required to use this command new CLAN[MAX_TEXT_LENGTH] = "YOUR_CLAN_TAG_HERE"; //Replace YOUR_CLAN_TAG_HERE with your Clan Tag (EXACT CASE!) //*********************************************************************************************** //*************************** DO NOT EDIT BELOW THIS LINE!!! ************************************ //*********************************************************************************************** new ChooseteamRestrict = 0; new ClanTeamSelected = 0; new STRING_VERSION[MAX_DATA_LENGTH] = "1.0.0"; public admin_clanvsall(HLCommand,HLData,HLUserName,UserIndex) { new Text[MAX_TEXT_LENGTH]; new Command[MAX_COMMAND_LENGTH]; new Data[MAX_DATA_LENGTH]; new User[MAX_NAME_LENGTH]; new ClanTeam[MAX_NAME_LENGTH]; new maxplayers = maxplayercount(); new Target[MAX_NAME_LENGTH]; new i = 0; new SessionID; new WONID; new Team; new disableMessage[MAX_TEXT_LENGTH] = ""; new enableMessage[MAX_TEXT_LENGTH] = ""; new switchToT[MAX_TEXT_LENGTH] = ""; new switchToCT[MAX_TEXT_LENGTH] = ""; snprintf(disableMessage,MAX_TEXT_LENGTH,"The admin has DISABLED - %s vs ALL",CLAN); snprintf(enableMessage,MAX_TEXT_LENGTH,"The admin has ENABLED - %s vs ALL",CLAN); snprintf(switchToT,MAX_TEXT_LENGTH,"The Admin has switched your team to the Terrorists - %s vs ALL now in progress!",CLAN); snprintf(switchToCT,MAX_TEXT_LENGTH,"The Admin has switched your team to the Counter-Terrorists - %s vs ALL now in progress!",CLAN); convert_string(HLCommand,Command,MAX_COMMAND_LENGTH); convert_string(HLData,Data,MAX_DATA_LENGTH); convert_string(HLUserName,User,MAX_NAME_LENGTH); strbreak(Data, ClanTeam, Data, MAX_NAME_LENGTH); if (strlen(ClanTeam) == 0) { selfmessage("Clan Team missing - Please select the team which you want YOUR clan to be on (CT or T)"); snprintf(Text, MAX_TEXT_LENGTH, disableMessage); centersay(Text,10,255,255,0); exec("mp_autoteambalance 1"); ChooseteamRestrict = 0; selfmessage("You have deactivated the Clan vs All plugin. - Clan vs all is now OFF!"); return PLUGIN_HANDLED; } else { if(ChooseteamRestrict == 0) { setstrvar("mp_autoteambalance","0"); snprintf(Text, MAX_TEXT_LENGTH, enableMessage); centersay(Text,10,255,255,0); if(streq(ClanTeam,"ct") == 1) { ClanTeamSelected = 2; } else if(streq(ClanTeam,"t") == 1) { ClanTeamSelected = 1; } for(i=1; i<=maxplayers; i++) { if(playerinfo(i,Target,MAX_NAME_LENGTH,SessionID,WONID,Team)==1) { if (strstr(Target, CLAN) == -1) { if(check_immunity(Target)==0 && i != UserIndex) { if(streq(ClanTeam,"ct") == 1 && Team == 2 && ChooseteamRestrict == 0) { execclient(Target, "chooseteam; menuselect 1; menuselect 5;"); messageex(Target, switchToT, print_center); message(Target, switchToT); } else if(streq(ClanTeam,"t") == 1 && Team == 1 && ChooseteamRestrict == 0) { execclient(Target, "chooseteam; menuselect 2; menuselect 5;"); messageex(Target, switchToCT, print_center); message(Target, switchToCT); } } } else { if(streq(ClanTeam,"ct") == 1 && Team == 1 && ChooseteamRestrict == 0) { execclient(Target, "chooseteam; menuselect 2; menuselect 5;"); messageex(Target, switchToCT, print_center); message(Target, switchToCT); } else if(streq(ClanTeam,"t") == 1 && Team == 2 && ChooseteamRestrict == 0) { execclient(Target, "chooseteam; menuselect 1; menuselect 5;"); messageex(Target, switchToT, print_center); message(Target, switchToT); } } }//end of if }//end of for set_timer("restrict_timer",5,1,""); }//end of if else if(ChooseteamRestrict == 1) { snprintf(Text, MAX_TEXT_LENGTH, disableMessage); centersay(Text,10,255,255,0); exec("mp_autoteambalance 1"); ChooseteamRestrict = 0; selfmessage("You have deactivated the Clan vs All plugin. - Clan vs all is now OFF!"); return PLUGIN_HANDLED; }//end of else if }//end of else return PLUGIN_HANDLED; } public HandleJoins (HLCommand, HLData, HLUserName, UserIndex) { new Target[MAX_NAME_LENGTH]; convert_string(HLUserName,Target,MAX_NAME_LENGTH); if (UserIndex<1 || UserIndex>= MAX_PLAYERS) { return PLUGIN_CONTINUE; } if (ChooseteamRestrict == 1 && strstr(Target, CLAN) == -1) { if(ClanTeamSelected == 2) { execclient(Target, "chooseteam; menuselect 1; menuselect 5;"); messageex(Target, "You can only select the Terrorists.", print_center); return PLUGIN_HANDLED; } else if(ClanTeamSelected == 1) { execclient(Target, "chooseteam; menuselect 2; menuselect 5;"); messageex(Target, "You can only select the Counter-Terrorists.", print_center); return PLUGIN_HANDLED; } }//end of if else if(ChooseteamRestrict == 1 && strstr(Target,CLAN) != -1) { if(ClanTeamSelected == 1) { execclient(Target, "chooseteam; menuselect 1; menuselect 5;"); messageex(Target, "You can only select the Terrorists.", print_center); return PLUGIN_HANDLED; } else if(ClanTeamSelected == 2) { execclient(Target, "chooseteam; menuselect 2; menuselect 5;"); messageex(Target, "You can only select the Counter-Terrorists.", print_center); return PLUGIN_HANDLED; } } return PLUGIN_CONTINUE; } public restrict_timer(Timer,Repeat,HLName,HLParam) { ChooseteamRestrict = 1; selfmessage("You have activated the Clan vs All plugin. - Clan vs all is now ON!"); } public CheckMenu(HLCommand,HLData,HLUserName,UserIndex) { if(ChooseteamRestrict == 1) { new Target[MAX_NAME_LENGTH]; convert_string(HLUserName,Target,MAX_NAME_LENGTH); new checkMenuMessage[MAX_TEXT_LENGTH] = ""; snprintf(checkMenuMessage,MAX_TEXT_LENGTH,"Changing teams is currently disabled. - %s vs ALL now in progress!",CLAN); centersay(checkMenuMessage,5,255,255,0); message(Target,checkMenuMessage); return PLUGIN_HANDLED; } return PLUGIN_CONTINUE; } public plugin_init() { plugin_registerinfo("Clan vs All Plugin","Has the ability to have a Clan vs everyone else.",STRING_VERSION); plugin_registercmd("admin_clanvsall","admin_clanvsall",ACCESS_CLANVSALL,"admin_clanvsall: Have Clan vs All."); plugin_registercmd("chooseteam","CheckMenu",ACCESS_ALL); plugin_registercmd("specmode", "HandleJoins", ACCESS_ALL); return PLUGIN_CONTINUE; }