/* This plugin enables non-admin started votes for pistol only,restrict awp buying, low gravity, and also includes auto-responses and more. 
 * Note: you might want to turn your vote_freq down to 15 or 30 in server.cfg if your going to have a lot of voting happening (FF, Grav, other ect.)
 * Must be loaded AFTER plugin_CS. 
 * Scripts belong to respective owners, scripts borrowed from yensid and jag
 */
 
/* $Id: plugin_democracy.sma,v 1.0 4/22/01 by BenTheMeek & KrezerJ $ */
 
#include <core>
#include <console>
#include <string>
#include <admin>
#include <adminlib>
#define ACCESS_RESTRICT 8192
#define ACCESS_VOTE_GV 8192
#define ACCESS_VOTE_FF 8192
new STRING_VERSION[MAX_DATA_LENGTH] = "2.50.0";
 
/* Change to 1 to have a pistols vote start 450 seconds in to a map */
#define AUTO_PL_VOTE 0
/* Change to 1 to have a awp vote start 600 seconds in to a map */
#define AUTO_AW_VOTE 0
/* Change to 1 to have a gravity vote start 300 seconds in to a map */
#define AUTO_GV_VOTE 0
/* Change to 1 to have a Friendly Fire vote start 150 seconds in to a map */
#define AUTO_FF_VOTE 0
 
/* If your using yensid's plugin_ff you will have to either disable it or disable *
 * our enhanced version below by changing ENABLE_FF_VOTE & ENABLE_FF_STATUS to 0  */
 
/* Change to 0 to disable admin_pistols */
#define ENABLE_PL 1
/* Change to 0 to disable admin_awp */
#define ENABLE_AW 1
/* Change to 0 to disable pistol voting */
#define ENABLE_PL_VOTE 1
/* Change to 0 to disable awp voting */
#define ENABLE_AW_VOTE 1
/* Change to 0 to disable gravity voting */
#define ENABLE_GV_VOTE 1
/* Change to 0 to disable friendly fire voting */
#define ENABLE_FF_VOTE 1
/* Change to 0 to disable gravity status autoresponse */
#define ENABLE_GV_STATUS 1
/* Change to 0 to disable gun restriction status autoresponse */
#define ENABLE_GUN_STATUS 1
/* Change to 0 to disable friendly fire status autoresponse */
#define ENABLE_FF_STATUS 1
 
/* Change this to whatever ratio of players need to vote pistols only to change it. */
#define PL_VOTE_RATIO 51
/* Change this to whatever ratio of players need to vote awps on or off to change it */
#define AW_VOTE_RATIO 51
/* Change this to whatever ratio of players need to vote for a gravity setting to change it. */
#define GV_VOTE_RATIO 51
/* Change this to whatever ratio of players need to vote for a friendly fire setting to change it. */
#define FF_VOTE_RATIO 51
 
/* Change this to whatever default gravity you use with your server */
new DefaultGV=800;
/* Change this to whatever you want to be low gravity */
new LowGV=200;
 
/* Here we create the variables that will allow us to give the current state of Pistol and AWP buying. Dont Change */
new NoAWP=0; 
new PistolOnly=0;
 
/* Change this to the number secconds a NON-admin will have to wait to Re-Vote somthing. Like to */
/* vote_pistols again you wait ?? secconds. This stops Vote-Spams. Thanks to Wraith for the idea */
new RVfreq=180;
 
#if ENABLE_PL_VOTE==1
 
/* Change this to 1 to disable public use of vote_pistols by default */
new PLVoteOff=0;
 
#endif
#if ENABLE_AW_VOTE==1
 
/* Change this to 1 to disable public use of vote_awp by default */
new AWVoteOff=0;
 
#endif
#if ENABLE_GV_VOTE==1
 
/* Change this to 1 to disable public use of vote_gravity by default */
new GVVoteOff=0;
 
#endif
#if ENABLE_FF_VOTE==1
 
/* Change this to 1 to disable public use of vote_ff by default */
new FFVoteOff=0;
 
#endif
 
/**************************************/
/***** END OF SWITCHES FOR ADMINS *****/
/**************************************/
 
#if ENABLE_PL_VOTE==1
new vote_PLAllowed=1;
@PLVoteTimer() {vote_PLAllowed=1;}
#endif
 
#if ENABLE_AW_VOTE==1
new vote_AWAllowed=1;
@AWVoteTimer() {vote_AWAllowed=1;}
#endif
 
#if ENABLE_GV_VOTE==1
new vote_GVAllowed=1;
@GVVoteTimer() {vote_GVAllowed=1;}
#endif
 
#if ENABLE_FF_VOTE==1
new vote_FFAllowed=1;
@FFVoteTimer() {vote_FFAllowed=1;}
#endif
 
public PistolON() {
	plugin_exec("admin_unrestrict","all");
	plugin_exec("admin_restrict","menu 2"); 
	plugin_exec("admin_restrict","menu 3"); 
	plugin_exec("admin_restrict","menu 4"); 
	plugin_exec("admin_restrict","menu 5"); 
	PistolOnly=1; 
	NoAWP=0;
}
public AllON() {
	plugin_exec("admin_unrestrict","all");
	NoAWP=0;
	PistolOnly=0;
}
public AwpON() {
	plugin_exec("admin_unrestrict","all");
	plugin_exec("admin_restrict","awp"); 
	NoAWP=1; 
	PistolOnly=0;
}
 
 
public PLVote() {
	new strDummy[10];
	vote("Pistols only?", "All weapons", "Pistols Only", "HandlePLVote",strDummy);
}
 
public HandlePLVote(WinningOption,HLData,VoteCount,UserCount) {
	new Text[MAX_TEXT_LENGTH];
	new strNumber[MAX_NUMBER_LENGTH];
	new Ratio = PL_VOTE_RATIO;
	new strData[MAX_DATA_LENGTH];
	new i;
	new maxplayers = maxplayercount();
	new SessionID;
	new Target[MAX_NAME_LENGTH];
	new Team;
	new WONID;
	convert_string(HLData, strData,MAX_DATA_LENGTH);
 
	if (VoteCount >= Ratio*UserCount/100) {	
		if (WinningOption==1) {
			if (PistolOnly==0) { 
				snprintf(Text, MAX_TEXT_LENGTH, "Vote over.  All weapons will remain enabled.", strNumber);
			} else {
				snprintf(Text, MAX_TEXT_LENGTH, "Vote successful. Enabled all weapons^nSpend that money...!!!", strNumber);
				AllON();
			}
		} else {
			if (PistolOnly==0) { 
				snprintf(Text, MAX_TEXT_LENGTH, "OK Ok...You got your way!^n Pistols buying only is enabled until voted otherwise^nIf you are still carrying another weapon from previos round toss it^n Play fair or get vote kicked !", strNumber);
				PistolON();
			} else {
				snprintf(Text, MAX_TEXT_LENGTH, "Vote over.  Pistols buying only will remain.", strNumber);
			}
		}
	} else {
		numtostr(Ratio*UserCount/100,strNumber);
		if (PistolOnly==0) { 
			snprintf(Text, MAX_TEXT_LENGTH, "Pistols vote succeeded, but not enough votes for change (needed %s)^nAll Weapons will remain.", strNumber);
		} else {
			snprintf(Text, MAX_TEXT_LENGTH, "Pistols vote succeeded, but not enough votes for change (needed %s)^nPistols Only will remain.", strNumber);
		}
	}
	centersay(Text,18,63,187,239);
	for(i=1; i<=maxplayers; i++) {
		strinit(Target);
		if(playerinfo(i,Target,MAX_NAME_LENGTH,SessionID,WONID,Team)==1) {
			messageex(Target,Text,print_console);
		}
	}
}
#if ENABLE_PL_VOTE==1
public admin_vote_pistols(HLCommand,HLData,HLUserName,UserIndex) {
	new Command[MAX_COMMAND_LENGTH];
	new Data[MAX_DATA_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);
	say_command(User,Command,Data);
 
	if (streq(Data, "off")==1) {
		selfmessage( "Public Pistols voting has been disabled");
		PLVoteOff=1;
		return PLUGIN_HANDLED;
	}
	if (streq(Data, "on")==1) {
		selfmessage( "Public Pistols voting has been enabled");
		PLVoteOff=0;
		return PLUGIN_HANDLED;
	}
 
	if (vote_allowed()!=1) {
		selfmessage( "Vote not allowed at this time.");
		return PLUGIN_HANDLED;
	}
 
	vote_PLAllowed=0;
	set_timer("@PLVoteTimer",RVfreq,1);
	PLVote();
 
	return PLUGIN_HANDLED;
}
#endif
 
public AWVote() {
	new strDummy[10];
	vote("Restrict buying of AWP/AWM?", "Enable AWP", "Disable AWP", "HandleAWVote",strDummy);
}
 
public HandleAWVote(WinningOption,HLData,VoteCount,UserCount) {
	new Text[MAX_TEXT_LENGTH];
	new strNumber[MAX_NUMBER_LENGTH];
	new Ratio = PL_VOTE_RATIO;
	new strData[MAX_DATA_LENGTH];
	new i;
	new maxplayers = maxplayercount();
	new SessionID;
	new Target[MAX_NAME_LENGTH];
	new Team;
	new WONID;
	convert_string(HLData, strData,MAX_DATA_LENGTH);
 
	if (VoteCount >= Ratio*UserCount/100) {	
		if (WinningOption==1) {
			if (NoAWP==0) { 
				snprintf(Text, MAX_TEXT_LENGTH, "Vote over.  AWP buying will remain enabled.", strNumber);
			} else {
				snprintf(Text, MAX_TEXT_LENGTH, "Vote successful. Enabled AWP and all other buying ^nBring out the sniper in you...!!!", strNumber);
				AllON();
			}
		} else {
			if (NoAWP==0) { 
				snprintf(Text, MAX_TEXT_LENGTH, "OK Ok...You got your way!^n AWP buying is restricted until voted otherwise^nIf you are still carrying an AWP from previos round toss it^n Play fair or get vote kicked !", strNumber);
				AwpON();
			} else {
				snprintf(Text, MAX_TEXT_LENGTH, "Vote over.  Restricted AWP buying will remain.", strNumber);
			}
		}
	} else {
		numtostr(Ratio*UserCount/100,strNumber);
		if (NoAWP==0) { 
			snprintf(Text, MAX_TEXT_LENGTH, "AWP vote succeeded, but not enough votes for change (needed %s)^nAWP buying will remain.", strNumber);
		} else {
			snprintf(Text, MAX_TEXT_LENGTH, "AWP vote succeeded, but not enough votes for change (needed %s)^nDisabled buying of AWP will remain.", strNumber);
		}
	}
	centersay(Text,18,63,187,239);
	for(i=1; i<=maxplayers; i++) {
		strinit(Target);
		if(playerinfo(i,Target,MAX_NAME_LENGTH,SessionID,WONID,Team)==1) {
			messageex(Target,Text,print_console);
		}
	}
}
#if ENABLE_AW_VOTE==1
public admin_vote_awp(HLCommand,HLData,HLUserName,UserIndex) {
	new Command[MAX_COMMAND_LENGTH];
	new Data[MAX_DATA_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);
	say_command(User,Command,Data);
 
	if (streq(Data, "off")==1) {
		selfmessage( "Public AWP voting has been disabled");
		AWVoteOff=1;
		return PLUGIN_HANDLED;
	}
	if (streq(Data, "on")==1) {
		selfmessage( "Public AWP voting has been enabled");
		AWVoteOff=0;
		return PLUGIN_HANDLED;
	}
 
	if (vote_allowed()!=1) {
		selfmessage( "Vote not allowed at this time.");
		return PLUGIN_HANDLED;
	}
 
	vote_AWAllowed=0;
	set_timer("@AWVoteTimer",RVfreq,1);
	AWVote();
 
	return PLUGIN_HANDLED;
}
#endif
 
public GVVote() {
	new strDummy[10];
	vote("What Gravity?", "Normal Gravity", "Low Gravity", "HandleGVVote",strDummy);
}
 
public HandleGVVote(WinningOption,HLData,VoteCount,UserCount) {
	new Text[MAX_TEXT_LENGTH];
	new TextB[MAX_TEXT_LENGTH];
	new strNumber[MAX_NUMBER_LENGTH];
	new strNumberB[MAX_NUMBER_LENGTH];
	new Ratio = GV_VOTE_RATIO;
	new strData[MAX_DATA_LENGTH];
	new i;
	new maxplayers = maxplayercount();
	new SessionID;
	new Target[MAX_NAME_LENGTH];
	new Team;
	new WONID;
	convert_string(HLData, strData,MAX_DATA_LENGTH);
 
	if (VoteCount >= Ratio*UserCount/100) {	
		if (WinningOption==1) {
			if(getvar("sv_gravity")==DefaultGV) {
				snprintf(Text, MAX_TEXT_LENGTH, "Vote over.  Normal Gravity will stay as is.", strNumber);
			} else {
				snprintf(Text, MAX_TEXT_LENGTH, "Vote successful. Changed to Normal Gravity ^nSo Just don't fall!!!", strNumber);
				numtostr(DefaultGV,strNumberB);
				snprintf(TextB, MAX_TEXT_LENGTH, "sv_gravity %s", strNumberB);
				exec(TextB);
			}
		} else {
			if(getvar("sv_gravity")==DefaultGV) {
				snprintf(Text, MAX_TEXT_LENGTH, "OK Ok...You got your way!^nLow Gravity is On...^nJump away!", strNumber);
				numtostr(LowGV,strNumberB);
				snprintf(TextB, MAX_TEXT_LENGTH, "sv_gravity %s", strNumberB);
				exec(TextB);
			} else {
				snprintf(Text, MAX_TEXT_LENGTH, "Vote over.  Low gravity will remain.", strNumber);
			}
		}
	} else {
		numtostr(Ratio*UserCount/100,strNumber);
		if(getvar("sv_gravity")==DefaultGV) {
			snprintf(Text, MAX_TEXT_LENGTH, "Gravity vote succeeded, but not enough votes for change (needed %s)^nNormal Gravity will remain.", strNumber);
		} else {
			snprintf(Text, MAX_TEXT_LENGTH, "Gravity vote succeeded, but not enough votes for change (needed %s)^nLowGravity will remain.", strNumber);
		}
	}
	centersay(Text,18,63,187,239);
	for(i=1; i<=maxplayers; i++) {
		strinit(Target);
		if(playerinfo(i,Target,MAX_NAME_LENGTH,SessionID,WONID,Team)==1) {
			messageex(Target,Text,print_console);
		}
	}
}
#if ENABLE_GV_VOTE==1
public admin_vote_gravity(HLCommand,HLData,HLUserName,UserIndex) {
	new Command[MAX_COMMAND_LENGTH];
	new Data[MAX_DATA_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);
	say_command(User,Command,Data);
 
	if (streq(Data, "off")==1) {
		selfmessage( "Public Gravity voting has been disabled");
		GVVoteOff=1;
		return PLUGIN_HANDLED;
	}
	if (streq(Data, "on")==1) {
		selfmessage( "Public Gravity voting has been enabled");
		GVVoteOff=0;
		return PLUGIN_HANDLED;
	}
 
	if (vote_allowed()!=1) {
		selfmessage( "Vote not allowed at this time.");
		return PLUGIN_HANDLED;
	}
 
	vote_GVAllowed=0;
	set_timer("@GVVoteTimer",RVfreq,1);		
	GVVote();
 
	return PLUGIN_HANDLED;
}
#endif
 
public FFVote() {
	new strDummy[10];
	vote("Friendly Fire on?", "Yes", "No", "HandleFFVote",strDummy);
}
 
public HandleFFVote(WinningOption,HLData,VoteCount,UserCount) {
	new Text[MAX_TEXT_LENGTH];
	new strNumber[MAX_NUMBER_LENGTH];
	new Ratio = PL_VOTE_RATIO;
	new strData[MAX_DATA_LENGTH];
	new i;
	new maxplayers = maxplayercount();
	new SessionID;
	new Target[MAX_NAME_LENGTH];
	new Team;
	new WONID;
	convert_string(HLData, strData,MAX_DATA_LENGTH);
 
	if (VoteCount >= Ratio*UserCount/100) {	
		if (WinningOption==1) {
			if(getvar("mp_friendlyfire")==1) {
				snprintf(Text, MAX_TEXT_LENGTH, "Vote over.  Friendly fire will remain enabled.", strNumber);
			} else {
				snprintf(Text, MAX_TEXT_LENGTH, "Vote successful. Friendly fire changed to enabled.^nSo it is now a really BAD time to shoot your teammates!!!", strNumber);
				exec("mp_friendlyfire 1");
			}
		} else {
			if(getvar("mp_friendlyfire")==1) {
				snprintf(Text, MAX_TEXT_LENGTH, "OK Ok...You got your way!^nFriendly Fire Is OFF...^nShoot whomever you please!", strNumber);
				exec("mp_friendlyfire 0");
			} else {
				snprintf(Text, MAX_TEXT_LENGTH, "Vote over.  Friendly fire will remain disabled.", strNumber);
			}
		}
	} else {
		numtostr(Ratio*UserCount/100,strNumber);
		if(getvar("mp_friendlyfire")==1) {
			snprintf(Text, MAX_TEXT_LENGTH, "Friendly Fire vote succeeded, but not enough votes for change (needed %s)^nFriendly fire will remain enabled.", strNumber);
		} else {
			snprintf(Text, MAX_TEXT_LENGTH, "Friendly Fire vote succeeded, but not enough votes for change (needed %s)^nFriendly fire will remain disabled.", strNumber);
		}
	}
	centersay(Text,18,63,187,239);
	for(i=1; i<=maxplayers; i++) {
		strinit(Target);
		if(playerinfo(i,Target,MAX_NAME_LENGTH,SessionID,WONID,Team)==1) {
			messageex(Target,Text,print_console);
		}
	}
}
#if ENABLE_FF_VOTE==1
public admin_vote_ff(HLCommand,HLData,HLUserName,UserIndex) {
	new Command[MAX_COMMAND_LENGTH];
	new Data[MAX_DATA_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);
	say_command(User,Command,Data);
 
	if (streq(Data, "off")==1) {
		selfmessage( "Public Friendly Fire voting has been disabled");
		FFVoteOff=1;
		return PLUGIN_HANDLED;
	}
	if (streq(Data, "on")==1) {
		selfmessage( "Public Friendly Fire voting has been enabled");
		FFVoteOff=0;
		return PLUGIN_HANDLED;
	}
 
	if (vote_allowed()!=1) {
		selfmessage( "Vote not allowed at this time.");
		return PLUGIN_HANDLED;
	}
 
	vote_FFAllowed=0;
	set_timer("@FFVoteTimer",RVfreq,1);
	FFVote();
 
	return PLUGIN_HANDLED;
}
#endif
 
#if ENABLE_PL==1
public admin_pistols(HLCommand,HLData,HLUserName,UserIndex) {
	new Command[MAX_COMMAND_LENGTH];
	new Data[MAX_DATA_LENGTH];
	new User[MAX_NAME_LENGTH];
	new Text[MAX_TEXT_LENGTH];
	new strNumber[MAX_NUMBER_LENGTH];
	new maxplayers = maxplayercount();
	new SessionID;
	new Target[MAX_NAME_LENGTH];
	new Team;
	new WONID;
	new i;
	convert_string(HLCommand,Command,MAX_COMMAND_LENGTH);
	convert_string(HLData,Data,MAX_DATA_LENGTH);
	convert_string(HLUserName,User,MAX_NAME_LENGTH);
 
	if (PistolOnly==0) {
		snprintf(Text, MAX_TEXT_LENGTH, "ADMIN has set Pistols-only buying", strNumber);
		centersay(Text,10,0,255,0);
		for(i=1; i<=maxplayers; i++) {
			strinit(Target);
			if(playerinfo(i,Target,MAX_NAME_LENGTH,SessionID,WONID,Team)==1) {
				messageex(Target,Text,print_console);
			}
		}
		PistolON();
	} else {
		snprintf(Text, MAX_TEXT_LENGTH, "ADMIN has enabled ALL WEAPONS", strNumber);
		centersay(Text,10,0,255,0);
		for(i=1; i<=maxplayers; i++) {
			strinit(Target);
			if(playerinfo(i,Target,MAX_NAME_LENGTH,SessionID,WONID,Team)==1) {
				messageex(Target,Text,print_console);
			}
		}
		AllON();
	}
	return PLUGIN_HANDLED;
}
#endif
#if ENABLE_AW==1
public admin_awp(HLCommand,HLData,HLUserName,UserIndex) {
	new Command[MAX_COMMAND_LENGTH];
	new Data[MAX_DATA_LENGTH];
	new User[MAX_NAME_LENGTH];
	new Text[MAX_TEXT_LENGTH];
	new strNumber[MAX_NUMBER_LENGTH];
	new maxplayers = maxplayercount();
	new SessionID;
	new Target[MAX_NAME_LENGTH];
	new Team;
	new WONID;
	new i;
	convert_string(HLCommand,Command,MAX_COMMAND_LENGTH);
	convert_string(HLData,Data,MAX_DATA_LENGTH);
	convert_string(HLUserName,User,MAX_NAME_LENGTH);
	if (NoAWP==0) {
		snprintf(Text, MAX_TEXT_LENGTH, "ADMIN has restricted awp buying", strNumber);
		centersay(Text,10,0,255,0);
		for(i=1; i<=maxplayers; i++) {
			strinit(Target);
			if(playerinfo(i,Target,MAX_NAME_LENGTH,SessionID,WONID,Team)==1) {
				messageex(Target,Text,print_console);
			}
		}
		AwpON();
	} else {
		snprintf(Text, MAX_TEXT_LENGTH, "ADMIN has enabled ALL WEAPONS", strNumber);
		centersay(Text,10,0,255,0);
		for(i=1; i<=maxplayers; i++) {
			strinit(Target);
			if(playerinfo(i,Target,MAX_NAME_LENGTH,SessionID,WONID,Team)==1) {
				messageex(Target,Text,print_console);
			}
		}
		AllON();
	}
	return PLUGIN_HANDLED;
}
#endif
public HandleSay(HLCommand,HLData,HLUserName,UserIndex) {
	new Command[MAX_COMMAND_LENGTH];
	new Data[MAX_DATA_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);
 
	strstripquotes(Data);
 
#if ENABLE_GUN_STATUS==1
	new Match = FALSE;
	if (strcasestr(Data, "gun")!=-1) {
		Match = TRUE;
	}
	if (strcasestr(Data, "buy")!=-1) {
		Match = TRUE;
	}
	if (strcasestr(Data, "pistol")!=-1) {
		Match = TRUE;
	}
	if (strcasestr(Data, "awp")!=-1) {
		Match = TRUE;
	}
	if (strcasestr(Data, "awm")!=-1) {
		Match = TRUE;
	}
	if (strcasestr(Data, "vote_awp")!=-1) {
		Match = FALSE;
	}
	if (strcasestr(Data, "vote_pistols")!=-1) {
		Match = FALSE;
	}
#endif
#if ENABLE_GV_STATUS==1
	new GVMatch = FALSE;
	if (strcasestr(Data, "gravity")!=-1) {
		GVMatch = TRUE;
	}
	if (strcasestr(Data, "vote_gravity")!=-1) {
		GVMatch = FALSE;
	}
#endif
#if ENABLE_FF_STATUS==1
	new FFMatch = FALSE;
	if (strcasestr(Data, "ff on")!=-1) {
		FFMatch = TRUE;
	}
	if (strcasestr(Data, "friendly fire")!=-1) {
		FFMatch = TRUE;
	}
#endif
 
/****     What is Restricted??     ****/
#if ENABLE_GUN_STATUS==1
	if (Match==TRUE) {
		if (PistolOnly==1) { 
			centersay ("Pistols Only Buying. ^n To change say vote_pistols. ",9,0,255,0);
		} else {
			if (NoAWP==1) { 
				centersay ("AWP's Restricted Buying. ^n To change say vote_awp. ",9,0,255,0);
			} else {
				centersay ("All WEAPON Buying is currently enabled!^nTo change say vote_pistols or vote_awp",12,0,255,0); 
			}
		}
	}
#endif
#if ENABLE_GV_STATUS==1
	if (GVMatch==TRUE) {
		if (getvar("sv_gravity") == DefaultGV){ 
			centersay ("Normal Gravity! Don't Fall! ^n To change say vote_gravity!",7,0,255,0); 
		} else {
			new strNumber[MAX_NUMBER_LENGTH];
			new Text[MAX_TEXT_LENGTH];
			numtostr(getvar("sv_gravity"),strNumber);
			snprintf(Text, MAX_TEXT_LENGTH, "Low Gravity is on (%s). ^n To change say vote_gravity.", strNumber);
			centersay (Text,7,0,255,0);
		}
	}
#endif
#if ENABLE_FF_STATUS==1
	if (FFMatch==TRUE) {
		if (getvar("mp_friendlyfire") == 1){ 
			centersay ("Friendly fire is ON! Watch your fire! ^n Your teammates are counting on you to actually aim!^n To change say vote_ff",9,0,255,0); 
		} else {
			centersay ("Friendly fire is OFF. ^n Go ahead, shoot your partner. To change say vote_ff",9,0,255,0);
		}
	}
#endif
 
	if (strcasestr(Data, "plugin_democracy")!=-1) {
		centersay ("This Server is using Plugin_Democracy v1.0^nWritten by KrezerJ & BenTheMeek",9,0,255,0);if (RVfreq==1) {}
	}
 
#if ENABLE_PL_VOTE==1
	if (strcasestr(Data, "vote_pistols")!=-1) {
		if (PLVoteOff==1) {
			say("Admin has disable public use of vote_pistols.");
		} else {
			if (vote_PLAllowed != 1){
				say("A vote has just been completed, sorry if you didn't like the results.");
			} else {
				if (vote_allowed()!=1) {
					say("Vote not allowed at this time.");
				} else {
					vote_PLAllowed=0;
					set_timer("@PLVoteTimer",RVfreq,1);
					PLVote();
				}
			}
		}
	}
#endif
#if ENABLE_AW_VOTE==1
	if (strcasestr(Data, "vote_awp")!=-1) {
		if (AWVoteOff==1) {
			say("Admin has disable public use of vote_awp.");
		} else {
			if (vote_AWAllowed != 1){
				say("A vote has just been completed, sorry if you didn't like the results.");
			} else {
				if (vote_allowed()!=1) {
					say("Vote not allowed at this time.");
				} else {	
					vote_AWAllowed=0;
					set_timer("@AWVoteTimer",RVfreq,1);
					AWVote();
				}
			}
		}
	}
#endif
#if ENABLE_GV_VOTE==1
	if (strcasestr(Data, "vote_gravity")!=-1) {
		if (GVVoteOff==1) {
			say("Admin has disable public use of vote_gravity.");
		} else {
			if (vote_GVAllowed != 1){
				say("A vote has just been completed, sorry if you didn't like the results.");
			} else {
				if (vote_allowed()!=1) {
					say("Vote not allowed at this time.");
				} else {	
					vote_GVAllowed=0;
					set_timer("@GVVoteTimer",RVfreq,1);
					GVVote();
				}
			}
		}
	}
#endif
#if ENABLE_FF_VOTE==1
	if (strcasestr(Data, "vote_ff")!=-1) {
		if (FFVoteOff==1) {
			say("Admin has disable public use of vote_ff.");
		} else {
			if (vote_FFAllowed != 1){
				say("A vote has just been completed, sorry if you didn't like the results.");
			} else {
				if (vote_allowed()!=1) {
					say("Vote not allowed at this time.");
				} else {
					vote_FFAllowed=0;
					set_timer("@FFVoteTimer",RVfreq,1);
					FFVote();
				}
			}
		}
	}
#endif
	return PLUGIN_CONTINUE;
}
 
@PLVote() {
	if (vote_allowed()==1) {
		PLVote();
		say("[AutoVotePistols] Vote Started");
	} else {
		set_timer("@PLVote",30,1);
		say("[AutoVotePistols] Vote not allowed at this time");
		say("Server will retry in 30 secconds");
	}
}
@AWVote() {
	if (vote_allowed()==1) {
		AWVote();
		say("[AutoVoteAWP] Vote Started");
	} else {
		set_timer("@AWVote",30,1);
		say("[AutoVoteAWP] Vote not allowed at this time");
		say("Server will retry in 30 secconds");
	}
}
@GVVote() {
	if (vote_allowed()==1) {
		GVVote();
		say("[AutoVoteGravity] Vote Started");
	} else {
		set_timer("@GVVote",30,1);
		say("[AutoVoteGravity] Vote not allowed at this time");
		say("Server will retry in 30 secconds");
	}
}
@FFVote() {
	if (vote_allowed()==1) {
		FFVote();
		say("[AutoVoteFF] Vote Started");
	} else {
		set_timer("@FFVote",30,1);
		say("[AutoVoteFF] Vote not allowed at this time");
		say("Server will retry in 30 secconds");
	}
}
 
public plugin_init() {
	plugin_registerinfo("Democracy Plugin","vote for Low Gravity/FF/Pistols Only/Disable AWPs with autorespond status",STRING_VERSION);
	plugin_registercmd("say","HandleSay",ACCESS_ALL);
#if ENABLE_PL==1
	plugin_registercmd("admin_pistols","admin_pistols",ACCESS_RESTRICT,"admin_pistols : toggles pistols only only buying on and off.");
#endif
#if ENABLE_AW==1
	plugin_registercmd("admin_awp","admin_awp",ACCESS_RESTRICT,"admin_awp : toggles AWP restricted buying on and off.");
#endif
#if ENABLE_PL_VOTE==1
	plugin_registercmd("admin_vote_pistols","admin_vote_pistols",ACCESS_RESTRICT,"admin_vote_pistols : Starts a vote to enable buying of pistols only. off/on changes public use of vote_awp");
	plugin_registerhelp("say",ACCESS_ALL,"say vote_pistols: Will start pistols only vote and give status.");
#endif
#if ENABLE_AW_VOTE==1
	plugin_registercmd("admin_vote_awp","admin_vote_awp",ACCESS_RESTRICT,"admin_vote_awp : Starts a vote to disable buying of awp. off/on changes public use of vote_awp");
	plugin_registerhelp("say",ACCESS_ALL,"say vote_awp: Will start awp restriction vote and give status.");
#endif
#if ENABLE_GV_VOTE==1
	plugin_registercmd("admin_vote_gravity","admin_vote_gravity",ACCESS_VOTE_GV,"admin_vote_gravity : Starts a vote to enable normal/low gravity. off/on changes public use of vote_gravity");
	plugin_registerhelp("say",ACCESS_ALL,"say vote_gravity: Will start gravity vote.");
#endif
#if ENABLE_FF_VOTE==1
	plugin_registercmd("admin_vote_ff","admin_vote_ff",ACCESS_VOTE_FF,"admin_vote_ff : Starts a vote to enable ff. off/on changes public use of vote_ff");
	plugin_registerhelp("say",ACCESS_ALL,"say vote_ff: Will start ff vote.");
#endif
#if ENABLE_GUN_STATUS==1
	plugin_registerhelp("say",ACCESS_ALL,"say gun,buy,pistol,awp,awm: Will give gun buying status.");
#endif
#if ENABLE_GV_STATUS==1
	plugin_registerhelp("say",ACCESS_ALL,"say gravity: Will give gravity status, Clients say vote_gravity will start vote.");
#endif
#if ENABLE_FF_STATUS==1
	plugin_registerhelp("say",ACCESS_ALL,"say ff on, friendly fire: Will give ff status, Clients say vote_ff will start vote.");
#endif
 
 
#if AUTO_PL_VOTE==1	
	set_timer("@PLVote",450,1);
#endif
#if AUTO_AW_VOTE==1	
	set_timer("@AWVote",600,1);
#endif
#if AUTO_GV_VOTE==1	
	set_timer("@GVVote",300,1);
#endif
#if AUTO_FF_VOTE==1	
	set_timer("@FFVote",150,1);
#endif
 
	return PLUGIN_CONTINUE;
}