//
//
//         This plugin must be the FIRST or at least before the base 
//     or adminmod default plugins in your PLUGIN.INI or it wont work.
//
//
/***********************************************************************
 * plugin_ejl_limitcommands.sma    version 1.4   October 26/2002
 *  By:  Eric Lidman	Alias: Ludwig van      ejlmozart@hotmail.com
 *  Upgrade: http://lidmanmusic.com/cs/plugins.html  
 *
 * This plugin limits commands without modifying the base plugins. It
 *  sets the intervals at which the following commands can be issued
 *  as well as how many times during a map they can be issued:
 *
 *  admin_vote_map   admin_vote_kick
 *  admin_stack      admin_godmode		
 *  admin_llama      admin_noclip
 *  admin_bury       admin_teleport 
 *  admin_slay       admin_matrix
 *  admin_slap       admin_gravity
 *  admin_mslap      admin_lineup
 *
 * The time and count values are set below. You can modify them to your
 *  liking. Times are in seconds. It a time is set for 100000 or more,
 *  that is the same as saying the command is forbidden. The counts can
 *  also be modified to whatever you want.
 * 
 * Admins with immunity as part of their access are exempt from the
 *  limits and also do not use up commands or trigger the timelimits on
 *  commands.
 *
 * With each failed attempt at a command, the time remaining until the 
 *  next allowed command of that type is displayed in the console.
 *
 **********************************************************************/
 
// You may edit these values to your liking: (100000 or more = never)
 
// Amount of time from map start to admin_vote_map allowed (minutes)
// Amount of time between votes by admin_vote_map (seconds) 
#define MAPVOTE_FROMSTART 10
#define MAPVOTE_INTERVAL 150
 
// Amount of time (sec.) between votes by admin_vote_kick   (_INTERVAL)
// Amount of times admin_vote_kick can be used              (_COUNT)  
#define KICKVOTE_INTERVAL 180
#define KICKVOTE_COUNT 2
 
#define ADMINSTACK_INTERVAL 120
#define ADMINSTACK_COUNT 5
 
#define ADMINBURY_INTERVAL 120
#define ADMINBURY_COUNT 6
 
#define ADMINLLAMA_INTERVAL 120
#define ADMINLLAMA_COUNT 4
 
#define ADMINSLAYTEAM_INTERVAL 100000
#define ADMINSLAYTEAM_COUNT 2
 
#define ADMINSLAY_INTERVAL 120
#define ADMINSLAY_COUNT 3
 
#define ADMINSLAP_INTERVAL 30
#define ADMINSLAP_COUNT 15
 
#define ADMINMSLAP_INTERVAL 1
#define ADMINMSLAP_COUNT 4
 
#define ADMINNOCLIP_INTERVAL 10  // covers godmode/noclip/teleport
#define ADMINNOCLIP_COUNT 10
 
#define ADMINGRAVITY_INTERVAL 4 // covers gravity/matrix
#define ADMINGRAVITY_COUNT 10
 
////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////
//                                                                    //
//           Do not modify contents below this line.                  //
//                                                                    //
////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////
 
#include <core>
#include <console>
#include <string>
#include <admin>
#include <adminlib>
 
new STRING_VERSION[MAX_DATA_LENGTH] = "2.51";
 
new iLastVOTEMAP = 0;
new iLastVOTEKICK = 0;
new iLastSTACK = 0;
new iLastBURY = 0;
new iLastLLAMA = 0;
new iLastSLAY = 0;
new iLastSLAYTEAM = 0;
new iLastSLAP = 0;
new iLastMSLAP = 0;
new iLastNOCLIP = 0;
new iLastGRAVITY = 0;
 
new VOTEKICK_COUNT = 0; 
new STACK_COUNT = 0;
new BURY_COUNT = 0;
new LLAMA_COUNT = 0;
new SLAY_COUNT = 0;
new SLAYTEAM_COUNT = 0;
new SLAP_COUNT = 0;
new MSLAP_COUNT = 0;
new NOCLIP_COUNT = 0;
new GRAVITY_COUNT = 0;
 
new KICKVOTE_INT = KICKVOTE_INTERVAL;
new STACK_INT = ADMINSTACK_INTERVAL;   
new BURY_INT = ADMINBURY_INTERVAL;
new LLAMA_INT = ADMINLLAMA_INTERVAL;
new SLAY_INT = ADMINSLAY_INTERVAL;
new SLAYTEAM_INT = ADMINSLAYTEAM_INTERVAL;
new SLAP_INT = ADMINSLAP_INTERVAL;
new MSLAP_INT = ADMINMSLAP_INTERVAL;
new NOCLIP_INT = ADMINNOCLIP_INTERVAL;
new GRAVITY_INT = ADMINGRAVITY_INTERVAL;
 
new Allow_de_dust = 0;
new Allow_starwars = 0;
 
// Which commands do we limit?
 
public plugin_init() {
	plugin_registerinfo("EJL LimitCommands Plugin","Limits how often certain commands can be issued.",STRING_VERSION);
	plugin_registercmd("admin_vote_map","LimitMapVote",ACCESS_ALL,"");
	plugin_registercmd("admin_vote_kick","LimitKickVote",ACCESS_ALL,"");
	plugin_registercmd("admin_stack","LimitAdminStack",ACCESS_ALL,"");
	plugin_registercmd("admin_lineup","LimitAdminStack",ACCESS_ALL,"");
	plugin_registercmd("admin_bury","LimitAdminBury",ACCESS_ALL,"");
	plugin_registercmd("admin_unbury","LimitAdminBury",ACCESS_ALL,"");
	plugin_registercmd("admin_llama","LimitAdminLlama",ACCESS_ALL,"");
	plugin_registercmd("admin_unllama","LimitAdminLlama",ACCESS_ALL,"");
	plugin_registercmd("admin_slay","LimitAdminSlay",ACCESS_ALL,"");
	plugin_registercmd("admin_slayteam","LimitAdminSlayteam",ACCESS_ALL,"");
	plugin_registercmd("admin_slap","LimitAdminSlap",ACCESS_ALL,"");
	plugin_registercmd("admin_mslap","LimitAdminMSlap",ACCESS_ALL,"");
	plugin_registercmd("admin_gravity","LimitAdminGravity",ACCESS_ALL,"");
	plugin_registercmd("admin_matrix","LimitAdminGravity",ACCESS_ALL,"");
	plugin_registercmd("admin_noclip","LimitAdminNoclip",ACCESS_ALL,"");
	plugin_registercmd("admin_godmode","LimitAdminNoclip",ACCESS_ALL,"");
	plugin_registercmd("admin_teleport","LimitAdminNoclip",ACCESS_ALL,"");
 
	return PLUGIN_CONTINUE;
}
 
public LimitMapVote(HLCommand, HLData, HLName, UserIndex){
 
	new Data[MAX_DATA_LENGTH];
	new Text[MAX_TEXT_LENGTH];
	new iTimeLimit;
	new iNextAllow;
	new iHrAllow;
	new iMinAllow;
	new iSecAllow;
	iTimeLimit = getvar("mp_timelimit");
	new iTimeLeft = timeleft(0);
	iTimeLeft /= 60;
 
	convert_string(HLData, Data, MAX_DATA_LENGTH);
// Slows down those infernal dust votes
	if (!strcasecmp(Data, "de_dust")) {
		if(Allow_de_dust == 0){
			selfmessage("Dust!!? You can be more original than that, but if you insist, try again.");
			Allow_de_dust = 1;
			return PLUGIN_HANDLED;
		}
		Allow_de_dust = 0;		
	}
// Im sick of starwars too
	if (!strcasecmp(Data, "starwars")) {
		if(Allow_starwars == 0){
			selfmessage("O please!  Not more starwars, but if you insist, try again.");
			Allow_starwars = 1;
			return PLUGIN_HANDLED;
		}
		Allow_starwars = 0;		
	}
// exempts admins from this plugin if they have immunity
	if (check_auth(ACCESS_MAP)==1) {
		return PLUGIN_CONTINUE;
	}
// checks if we are too close to the start of a map for a mapvote 
	if ((iTimeLimit - iTimeLeft) < MAPVOTE_FROMSTART) {
		snprintf(Text, MAX_TEXT_LENGTH, "admin_vote_map cannot be used until %i minutes after map start.", MAPVOTE_FROMSTART);		
		selfmessage(Text);
		return PLUGIN_HANDLED;
	}
// checks time interval between map votes, if not enough, we tell how long it will be till the next one
	if (systemtime() < iLastVOTEMAP) {
		iNextAllow = (iLastVOTEMAP - systemtime());
		iHrAllow = (iNextAllow / 3600);
		iMinAllow = (iNextAllow / 60);
		iSecAllow = (iNextAllow - (iMinAllow * 60));
		snprintf(Text, MAX_TEXT_LENGTH, "Next admin_vote_map command allowed in %i hours, %i minutes, %i seconds.", iHrAllow, iMinAllow, iSecAllow);
		selfmessage(Text);
		return PLUGIN_HANDLED;
	}
	iLastVOTEMAP = systemtime();
	iLastVOTEMAP += MAPVOTE_INTERVAL;
	return PLUGIN_CONTINUE;
}
 
 
public LimitKickVote(HLCommand, HLData, HLName, UserIndex){
 
	new Text[MAX_TEXT_LENGTH];
	new iNextAllow;
	new iHrAllow;
	new iMinAllow;
	new iSecAllow;
	new iCommandsLeft;
 
	if (check_auth(2)==1) {
		return PLUGIN_CONTINUE;
	}
 
	if (KICKVOTE_INT > 99999){
		selfmessage("We dont use that command on this server. What's the point anyway?");
		return PLUGIN_HANDLED;
	}
	if (VOTEKICK_COUNT == KICKVOTE_COUNT){
		selfmessage("Sorry, we are all out of kick votes.");
		return PLUGIN_HANDLED;
	}
	if (systemtime() < iLastVOTEKICK) {
		iNextAllow = (iLastVOTEKICK - systemtime());
		iHrAllow = (iNextAllow / 3600);
		iMinAllow = (iNextAllow / 60);
		iSecAllow = (iNextAllow - (iMinAllow * 60));
		iCommandsLeft = (KICKVOTE_COUNT + 1 - VOTEKICK_COUNT);
		snprintf(Text, MAX_TEXT_LENGTH, "Next admin_vote_kick allowed in %i hr, %i min, %i sec.  %i vote_kicks left.", iHrAllow, iMinAllow, iSecAllow, iCommandsLeft);
		selfmessage(Text);
		return PLUGIN_HANDLED;
	}
	iLastVOTEKICK = systemtime();
	iLastVOTEKICK += KICKVOTE_INTERVAL;
	iCommandsLeft = (KICKVOTE_COUNT - VOTEKICK_COUNT);
	VOTEKICK_COUNT += 1;
	if(VOTEKICK_COUNT -1 == KICKVOTE_COUNT){
		selfmessage("That was the last admin_vote_kick");
		return PLUGIN_CONTINUE;
	}
	snprintf(Text, MAX_TEXT_LENGTH, "%i admin_vote_kicks remaining, don't waste them.", iCommandsLeft);
	selfmessage(Text);
	return PLUGIN_CONTINUE;
}
 
 
public LimitAdminStack(HLCommand, HLData, HLName, UserIndex){
 
	new Text[MAX_TEXT_LENGTH];
	new iNextAllow;
	new iHrAllow;
	new iMinAllow;
	new iSecAllow;
	new iCommandsLeft;
	new UserName[MAX_NAME_LENGTH];
	convert_string(HLName, UserName, MAX_NAME_LENGTH);
 
	if (check_auth(ACCESS_IMMUNITY)==1) {
		return PLUGIN_CONTINUE;
	}
	if (check_auth(8192)==0) {
		selfmessage("Access denied.");
		return PLUGIN_HANDLED;
	}
	if (STACK_INT > 99999){
		selfmessage("We dont use that command on this server. What's the point anyway?");
		return PLUGIN_HANDLED;
	}
	if (STACK_COUNT > ADMINSTACK_COUNT){
		selfmessage("Sorry, we are all out of admin_stack/admin_lineup");
		return PLUGIN_HANDLED;
	}		
	if (systemtime() < iLastSTACK) {
		iNextAllow = (iLastSTACK - systemtime());
		iHrAllow = (iNextAllow / 3600);
		iMinAllow = (iNextAllow / 60);
		iSecAllow = (iNextAllow - (iMinAllow * 60));
		iCommandsLeft = (ADMINSTACK_COUNT + 1 - STACK_COUNT);
		snprintf(Text, MAX_TEXT_LENGTH, "Next stack/lineup command allowed in %i hours, %i minutes, %i seconds.  %i stack/lineup remaining.", iHrAllow, iMinAllow, iSecAllow, iCommandsLeft);
		selfmessage(Text);
		return PLUGIN_HANDLED;
	}
	iLastSTACK = systemtime();
	iLastSTACK += ADMINSTACK_INTERVAL;
	iCommandsLeft = (ADMINSTACK_COUNT - STACK_COUNT);
	STACK_COUNT += 1;
	if(STACK_COUNT -1 == ADMINSTACK_COUNT){
		selfmessage("That was the last admin_stack/admin_lineup");
		return PLUGIN_CONTINUE;
	}
	snprintf(Text, MAX_TEXT_LENGTH, "%i admin_stacks/admin_lineups remaining, don't waste them.", iCommandsLeft);
	selfmessage(Text);
	return PLUGIN_CONTINUE;
}
 
public LimitAdminBury(HLCommand, HLData, HLName, UserIndex){
 
	new Text[MAX_TEXT_LENGTH];
	new iNextAllow;
	new iHrAllow;
	new iMinAllow;
	new iSecAllow;
	new iCommandsLeft;
 
	if (check_auth(ACCESS_IMMUNITY)==1) {
		return PLUGIN_CONTINUE;
	}
	if (check_auth(8192)==0) {
		selfmessage("Access denied.");
		return PLUGIN_HANDLED;
	}
	if (BURY_INT > 99999){
		selfmessage("We dont use that command on this server. What's the point anyway?");
		return PLUGIN_HANDLED;
	}
 
	if (BURY_COUNT > ADMINBURY_COUNT){
		selfmessage("Sorry, we are all out of admin_bury");
		return PLUGIN_HANDLED;
	}
	if (systemtime() < iLastBURY) {
		iNextAllow = (iLastBURY - systemtime());
		iHrAllow = (iNextAllow / 3600);
		iMinAllow = (iNextAllow / 60);
		iSecAllow = (iNextAllow - (iMinAllow * 60));
		iCommandsLeft = (ADMINBURY_COUNT + 1 - BURY_COUNT);
		snprintf(Text, MAX_TEXT_LENGTH, "Next admin_bury command allowed in %i hours, %i minutes, %i seconds.  %i admin_burys remaining.", iHrAllow, iMinAllow, iSecAllow, iCommandsLeft);
		selfmessage(Text);
		return PLUGIN_HANDLED;
	}
	iLastBURY = systemtime();
	iLastBURY += ADMINBURY_INTERVAL;
	iCommandsLeft = (ADMINBURY_COUNT - BURY_COUNT);
	BURY_COUNT += 1;
	if(BURY_COUNT -1 == ADMINBURY_COUNT){
		selfmessage("That was the last admin_bury");
		return PLUGIN_CONTINUE;
	}
	snprintf(Text, MAX_TEXT_LENGTH, "%i admin_burys remaining, don't waste them.", iCommandsLeft);
	selfmessage(Text);
	return PLUGIN_CONTINUE;
}
 
public LimitAdminLlama(HLCommand, HLData, HLName, UserIndex){
 
	new Text[MAX_TEXT_LENGTH];
	new iNextAllow;
	new iHrAllow;
	new iMinAllow;
	new iSecAllow;
	new iCommandsLeft;
 
	if (check_auth(ACCESS_IMMUNITY)==1) {
		return PLUGIN_CONTINUE;
	}
	if (check_auth(8192)==0) {
		selfmessage("Access denied.");
		return PLUGIN_HANDLED;
	}
	if (LLAMA_INT > 99999){
		selfmessage("We dont use that command on this server. What's the point anyway?");
		return PLUGIN_HANDLED;
	}
 
	if (LLAMA_COUNT > ADMINLLAMA_COUNT){
		selfmessage("Sorry, we are all out of admin_llama");
		return PLUGIN_HANDLED;
	}
	if (systemtime() < iLastLLAMA) {
		iNextAllow = (iLastLLAMA - systemtime());
		iHrAllow = (iNextAllow / 3600);
		iMinAllow = (iNextAllow / 60);
		iSecAllow = (iNextAllow - (iMinAllow * 60));
		iCommandsLeft = (ADMINLLAMA_COUNT + 1 - LLAMA_COUNT);
		snprintf(Text, MAX_TEXT_LENGTH, "Next admin_llama command allowed in %i hours, %i minutes, %i seconds.  %i admin_llamas remaining.", iHrAllow, iMinAllow, iSecAllow, iCommandsLeft);
		selfmessage(Text);
		return PLUGIN_HANDLED;
	}
	iLastLLAMA = systemtime();
	iLastLLAMA += ADMINLLAMA_INTERVAL;
	iCommandsLeft = (ADMINLLAMA_COUNT - LLAMA_COUNT);
	LLAMA_COUNT += 1;
	if(LLAMA_COUNT -1 == ADMINLLAMA_COUNT){
		selfmessage("That was the last admin_bury");
		return PLUGIN_CONTINUE;
	}
	snprintf(Text, MAX_TEXT_LENGTH, "%i admin_llamas remaining, don't waste them.", iCommandsLeft);
	selfmessage(Text);
	return PLUGIN_CONTINUE;
}
 
public LimitAdminSlay(HLCommand, HLData, HLName, UserIndex){
 
	new Text[MAX_TEXT_LENGTH];
	new iNextAllow;
	new iHrAllow;
	new iMinAllow;
	new iSecAllow;
	new iCommandsLeft;
 
	if (check_auth(ACCESS_IMMUNITY)==1) {
		return PLUGIN_CONTINUE;
	}
	if (check_auth(128)==0) {
		selfmessage("Access denied.");
		return PLUGIN_HANDLED;
	}
	if (SLAY_INT > 99999){
		selfmessage("We dont use that command on this server. What's the point anyway?");
		return PLUGIN_HANDLED;
	}
 
	if (SLAY_COUNT > ADMINSLAY_COUNT){
		selfmessage("Sorry, we are all out of admin_slay");
		return PLUGIN_HANDLED;
	}
	if (systemtime() < iLastSLAY) {
		iNextAllow = (iLastSLAY - systemtime());
		iHrAllow = (iNextAllow / 3600);
		iMinAllow = (iNextAllow / 60);
		iSecAllow = (iNextAllow - (iMinAllow * 60));
		iCommandsLeft = (ADMINSLAY_COUNT + 1 - SLAY_COUNT);
		snprintf(Text, MAX_TEXT_LENGTH, "Next admin_slay command allowed in %i hours, %i minutes, %i seconds.  %i admin_slay remaining.", iHrAllow, iMinAllow, iSecAllow, iCommandsLeft);
		selfmessage(Text);
		return PLUGIN_HANDLED;
	}
	iLastSLAY = systemtime();
	iLastSLAY += ADMINSLAY_INTERVAL;
	iCommandsLeft = (ADMINSLAY_COUNT - SLAY_COUNT);
	SLAY_COUNT += 1;
	if(SLAY_COUNT -1 == ADMINSLAY_COUNT){
		selfmessage("That was the last admin_slay");
		return PLUGIN_CONTINUE;
	}
	snprintf(Text, MAX_TEXT_LENGTH, "%i admin_slays remaining, don't waste them.", iCommandsLeft);
	selfmessage(Text);
	return PLUGIN_CONTINUE;
}
 
public LimitAdminSlayteam(HLCommand, HLData, HLName, UserIndex){
 
	new Text[MAX_TEXT_LENGTH];
	new iNextAllow;
	new iHrAllow;
	new iMinAllow;
	new iSecAllow;
	new iCommandsLeft;
 
	if (check_auth(ACCESS_IMMUNITY)==1) {
		return PLUGIN_CONTINUE;
	}
	if (check_auth(128)==0) {
		selfmessage("Access denied.");
		return PLUGIN_HANDLED;
	}
	if (SLAYTEAM_INT > 99999){
		selfmessage("We dont use that command on this server. What's the point anyway?");
		return PLUGIN_HANDLED;
	}
	if (SLAYTEAM_COUNT > ADMINSLAYTEAM_COUNT){
		selfmessage("Sorry, we are all out of admin_slayteam");
		return PLUGIN_HANDLED;
	}
	if (systemtime() < iLastSLAYTEAM) {
		iNextAllow = (iLastSLAYTEAM - systemtime());
		iHrAllow = (iNextAllow / 3600);
		iMinAllow = (iNextAllow / 60);
		iSecAllow = (iNextAllow - (iMinAllow * 60));
		iCommandsLeft = (ADMINSLAYTEAM_COUNT + 1 - SLAYTEAM_COUNT);
		snprintf(Text, MAX_TEXT_LENGTH, "Next admin_slayteam command allowed in %i hours, %i minutes, %i seconds.  %i admin_slayteams remaining.", iHrAllow, iMinAllow, iSecAllow, iCommandsLeft);
		selfmessage(Text);
		return PLUGIN_HANDLED;
	}
	iLastSLAYTEAM = systemtime();
	iLastSLAYTEAM += ADMINSLAYTEAM_INTERVAL;
	iCommandsLeft = (ADMINSLAYTEAM_COUNT - SLAYTEAM_COUNT);
	SLAYTEAM_COUNT += 1;
	if(SLAYTEAM_COUNT -1 == ADMINSLAYTEAM_COUNT){
		selfmessage("That was the last admin_slayteam");
		return PLUGIN_CONTINUE;
	}
	snprintf(Text, MAX_TEXT_LENGTH, "%i admin_slayteams remaining, don't waste them.", iCommandsLeft);
	selfmessage(Text);
	return PLUGIN_CONTINUE;
}
 
public LimitAdminSlap(HLCommand, HLData, HLName, UserIndex){
 
	new Text[MAX_TEXT_LENGTH];
	new iNextAllow;
	new iHrAllow;
	new iMinAllow;
	new iSecAllow;
	new iCommandsLeft;
 
	if (check_auth(ACCESS_IMMUNITY)==1) {
		return PLUGIN_CONTINUE;
	}
	if (check_auth(128)==0) {
		selfmessage("Access denied.");
		return PLUGIN_HANDLED;
	}
	if (SLAP_INT > 99999){
		selfmessage("We dont use that command on this server. What's the point anyway?");
		return PLUGIN_HANDLED;
	}
 
	if (SLAP_COUNT > ADMINSLAP_COUNT){
		selfmessage("Sorry, we are all out of admin_slap");
		return PLUGIN_HANDLED;
	}
	if (systemtime() < iLastSLAP) {
		iNextAllow = (iLastSLAP - systemtime());
		iHrAllow = (iNextAllow / 3600);
		iMinAllow = (iNextAllow / 60);
		iSecAllow = (iNextAllow - (iMinAllow * 60));
		iCommandsLeft = (ADMINSLAP_COUNT + 1 - SLAP_COUNT);
		snprintf(Text, MAX_TEXT_LENGTH, "Next admin_slap command allowed in %i hours, %i minutes, %i seconds.  %i admin_slap remaining.", iHrAllow, iMinAllow, iSecAllow, iCommandsLeft);
		selfmessage(Text);
		return PLUGIN_HANDLED;
	}
	iLastSLAP = systemtime();
	iLastSLAP += ADMINSLAP_INTERVAL;
	iCommandsLeft = (ADMINSLAP_COUNT - SLAP_COUNT);
	SLAP_COUNT += 1;
	if(SLAP_COUNT -1 == ADMINSLAP_COUNT){
		selfmessage("That was the last admin_slap");
		return PLUGIN_CONTINUE;
	}
	snprintf(Text, MAX_TEXT_LENGTH, "%i admin_slaps remaining, don't waste them.", iCommandsLeft);
	selfmessage(Text);
	return PLUGIN_CONTINUE;
}
 
public LimitAdminMSlap(HLCommand, HLData, HLName, UserIndex){
 
	new Text[MAX_TEXT_LENGTH];
	new iNextAllow;
	new iHrAllow;
	new iMinAllow;
	new iSecAllow;
	new iCommandsLeft;
 
	if (check_auth(ACCESS_IMMUNITY)==1) {
		return PLUGIN_CONTINUE;
	}
	if (check_auth(128)==0) {
		selfmessage("Access denied.");
		return PLUGIN_HANDLED;
	}
	if (MSLAP_INT > 99999){
		selfmessage("We dont use that command on this server. What's the point anyway?");
		return PLUGIN_HANDLED;
	}
 
	if (MSLAP_COUNT > ADMINMSLAP_COUNT){
		selfmessage("Sorry, we are all out of admin_mslap");
		return PLUGIN_HANDLED;
	}
	if (systemtime() < iLastMSLAP) {
		iNextAllow = (iLastMSLAP - systemtime());
		iHrAllow = (iNextAllow / 3600);
		iMinAllow = (iNextAllow / 60);
		iSecAllow = (iNextAllow - (iMinAllow * 60));
		iCommandsLeft = (ADMINMSLAP_COUNT + 1 - MSLAP_COUNT);
		snprintf(Text, MAX_TEXT_LENGTH, "Next admin_mslap command allowed in %i hours, %i minutes, %i seconds.  %i admin_mslap remaining.", iHrAllow, iMinAllow, iSecAllow, iCommandsLeft);
		selfmessage(Text);
		return PLUGIN_HANDLED;
	}
	iLastMSLAP = systemtime();
	iLastMSLAP += ADMINMSLAP_INTERVAL;
	iCommandsLeft = (ADMINMSLAP_COUNT - MSLAP_COUNT);
	MSLAP_COUNT += 1;
	if(MSLAP_COUNT -1 == ADMINMSLAP_COUNT){
		selfmessage("That was the last admin_mslap");
		return PLUGIN_CONTINUE;
	}
	snprintf(Text, MAX_TEXT_LENGTH, "%i admin_mslaps remaining, don't waste them.", iCommandsLeft);
	selfmessage(Text);
	return PLUGIN_CONTINUE;
}
 
public LimitAdminGravity(HLCommand, HLData, HLName, UserIndex){
 
	new Text[MAX_TEXT_LENGTH];
	new iNextAllow;
	new iHrAllow;
	new iMinAllow;
	new iSecAllow;
	new iCommandsLeft;
 
	if (check_auth(ACCESS_IMMUNITY)==1) {
		return PLUGIN_CONTINUE;
	}
	if (check_auth(32)==0) {
		selfmessage("Access denied.");
		return PLUGIN_HANDLED;
	}
	if (GRAVITY_INT > 99999){
		selfmessage("We dont use that command on this server. What's the point anyway?");
		return PLUGIN_HANDLED;
	}
 
	if (GRAVITY_COUNT > ADMINGRAVITY_COUNT){
		selfmessage("Sorry, we are all out of admin_gravity and admin_matrix");
		return PLUGIN_HANDLED;
	}
	if (systemtime() < iLastGRAVITY) {
		iNextAllow = (iLastGRAVITY - systemtime());
		iHrAllow = (iNextAllow / 3600);
		iMinAllow = (iNextAllow / 60);
		iSecAllow = (iNextAllow - (iMinAllow * 60));
		iCommandsLeft = (ADMINGRAVITY_COUNT + 1 - GRAVITY_COUNT);
		snprintf(Text, MAX_TEXT_LENGTH, "Next gravity/matrix command allowed in %i hours, %i minutes, %i seconds.  %i gravity/matrix remaining.", iHrAllow, iMinAllow, iSecAllow, iCommandsLeft);
		selfmessage(Text);
		return PLUGIN_HANDLED;
	}
	iLastGRAVITY = systemtime();
	iLastGRAVITY += ADMINGRAVITY_INTERVAL;
	iCommandsLeft = (ADMINGRAVITY_COUNT - GRAVITY_COUNT);
	GRAVITY_COUNT += 1;
	if(GRAVITY_COUNT -1 == ADMINGRAVITY_COUNT){
		selfmessage("That was the last admin_mslap and admin_matrix");
		return PLUGIN_CONTINUE;
	}
	snprintf(Text, MAX_TEXT_LENGTH, "%i admin_mslaps and admin_matrixs remaining, don't waste them.", iCommandsLeft);
	selfmessage(Text);
	return PLUGIN_CONTINUE;
}
 
public LimitAdminNoclip(HLCommand, HLData, HLName, UserIndex){
 
	new Text[MAX_TEXT_LENGTH];
	new iNextAllow;
	new iHrAllow;
	new iMinAllow;
	new iSecAllow;
	new iCommandsLeft;
 
	if (check_auth(ACCESS_IMMUNITY)==1) {
		return PLUGIN_CONTINUE;
	}
	if (check_auth(8192)==0) {
		selfmessage("Access denied.");
		return PLUGIN_HANDLED;
	}
	if (NOCLIP_INT > 99999){
		selfmessage("We dont use that command on this server. What's the point anyway?");
		return PLUGIN_HANDLED;
	}
 
	if (NOCLIP_COUNT > ADMINNOCLIP_COUNT){
		selfmessage("Sorry, we are all out of noclip, teleport, and godmode");
		return PLUGIN_HANDLED;
	}
	if (systemtime() < iLastNOCLIP) {
		iNextAllow = (iLastNOCLIP - systemtime());
		iHrAllow = (iNextAllow / 3600);
		iMinAllow = (iNextAllow / 60);
		iSecAllow = (iNextAllow - (iMinAllow * 60));
		iCommandsLeft = (ADMINNOCLIP_COUNT + 1 - NOCLIP_COUNT);
		snprintf(Text, MAX_TEXT_LENGTH, "Next cheat command allowed in %i hours, %i minutes, %i seconds.  %i cheats remaining.", iHrAllow, iMinAllow, iSecAllow, iCommandsLeft);
		selfmessage(Text);
		return PLUGIN_HANDLED;
	}
	iLastNOCLIP = systemtime();
	iLastNOCLIP += ADMINNOCLIP_INTERVAL;
	iCommandsLeft = (ADMINNOCLIP_COUNT - NOCLIP_COUNT);
	NOCLIP_COUNT += 1;
	if(NOCLIP_COUNT -1 == ADMINNOCLIP_COUNT){
		selfmessage("That was the last cheat");
		return PLUGIN_CONTINUE;
	}
	snprintf(Text, MAX_TEXT_LENGTH, "%i cheats remaining, don't waste them.", iCommandsLeft);
	selfmessage(Text);
	return PLUGIN_CONTINUE;
}