/* This plugin enables non-admin started votes for noclipping, as well as autoresponse and admin_vote_noclip. I will have a website by the next version, which should include choosing the length of NOCLIP_TIME ingame, and an option for turning glow on along with noclip.
* Scripts belong to respective owners, adapted from BenTheMeek's & KrezerJ's script, which borrowed from yensid and jag
* say up every round to get noclip, down to turn it off for you.
* say vote_noclip - starts a vote on noclip mode
* admin_noclipon - toggles noclip mode on and off
* admin_vote_noclip - starts a vote on noclip mode, 1 enables public use of say vote_noclip
* admin_noclipoff - toggles whether or not all users lose noclip when noclipping is turned off. This occurs after NOCLIP_TIME seconds, to give them time to reach safety.
*/
/* $Id: plugin_noclip.sma,v 1.2 4/21/02 by Thor $ */
/* Updated 11/23/02 by Thor */
#include
#include
#include
#include
#include
#define ACCESS_RESTRICT 8192
#define ACCESS_ALL 0
#define ACCESS_NOCLIP 8192
#define ACCESS_VOTE_NOCLIP 8192
new STRING_VERSION[MAX_DATA_LENGTH] = "2.50.0";
/* Change to 1 to have a noclip vote start 450 seconds into a map */
#define AUTO_NOCLIP_VOTE 0
/*Change to 0 to disable admin_noclipon */
#define ENABLE_NOCLIP 1
#define ENABLE_NOCLIP_VOTE 1
#define ENABLE_NOCLIP_STATUS 1
/* Change this to whatever ratio of players need to vote for noclip to change it. */
#define NOCLIP_VOTE_RATIO 51
/* Change this to the number seconds a NON-admin will have to wait to revote noclip. To */
/* vote_noclip again you wait ?? seconds. */
new RVfreq=30;
/* If this is enabled (1), then noclip is turned off for everybody in the server after
NOCLIP_TIME seconds. If it is disabled, then the people who are noclipping continue
to do so until the round ends. */
new NOCLIPOFF=1;
#define NOCLIP_TIME 10
#if ENABLE_NOCLIP_VOTE==1
/* Change this to 1 to disable public use of vote_noclip by default */
new NOCLIPVoteOff=0;
/*Change this to 0 to have noclipping off to start with, 1 for it to be on */
new COn=1;
#endif
/****************************************************/
/***** END OF SWITCHES FOR ALL YE PRYING ADMINS *****/
/****************************************************/
#if ENABLE_NOCLIP_VOTE==1
new vote_NOCLIPAllowed=1;
@NOCLIPVoteTimer() {
vote_NOCLIPAllowed=1;
}
#endif
public CON() {
COn = 1;
}
public COFF() {
if (NOCLIPOFF==1) {
set_timer("Noclip_Timer", 1, NOCLIP_TIME);
}
else {
COn = 0;
}
}
public NOCLIPVote() {
new strDummy[10];
vote("Noclip on?", "Off", "On", "HandleNOCLIPVote",strDummy);
}
public HandleNOCLIPVote(WinningOption,HLData,VoteCount,UserCount) {
new Text[MAX_TEXT_LENGTH];
new strNumber[MAX_NUMBER_LENGTH];
new Ratio = NOCLIP_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 (COn==0) {
snprintf(Text, MAX_TEXT_LENGTH, "Vote over. Noclip will remain off.", strNumber);
} else {
snprintf(Text, MAX_TEXT_LENGTH, "Vote successful. Noclipping has been disabled!!!", strNumber);
COFF();
}
} else {
if (COn==1) {
snprintf(Text, MAX_TEXT_LENGTH, "Vote over. Noclipping will remain.", strNumber);
} else {
snprintf(Text, MAX_TEXT_LENGTH, "Clipping is on now!", strNumber);
CON();
}
}
} else {
numtostr(Ratio*UserCount/100,strNumber);
if (COn==0) {
snprintf(Text, MAX_TEXT_LENGTH, "Noclipping vote succeeded, but not enough votes for change (needed %s)^nNoclipping will remain off.", strNumber);
} else {
snprintf(Text, MAX_TEXT_LENGTH, "Noclipping vote succeeded, but not enough votes for change (needed %s)^nNoclippings 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_NOCLIP_VOTE==1
public admin_vote_noclip(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 noclip voting has been disabled");
NOCLIPVoteOff=1;
return PLUGIN_HANDLED;
}
if (streq(Data, "on")==1) {
selfmessage( "Public noclip voting has been enabled");
NOCLIPVoteOff=0;
return PLUGIN_HANDLED;
}
if (vote_allowed()!=1) {
selfmessage( "Vote not allowed at this time.");
return PLUGIN_HANDLED;
}
vote_NOCLIPAllowed=0;
set_timer("@NOCLIPVoteTimer",RVfreq,1);
NOCLIPVote();
return PLUGIN_HANDLED;
}
#endif
#if ENABLE_NOCLIP_VOTE==1
public admin_noclipon(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 (ENABLE_NOCLIP_VOTE==1) {
if (COn==0) {
snprintf(Text, MAX_TEXT_LENGTH, "ADMIN has set noclipping to on!", 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);
}
}
CON();
}
else {
snprintf(Text, MAX_TEXT_LENGTH, "ADMIN has turned off noclipping.", 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);
}
}
COFF();
}
}
return PLUGIN_HANDLED;
}
#endif
#if ENABLE_NOCLIP_VOTE==1
public admin_noclipoff(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( "Noclip turning off will not be enforced until the next round.");
NOCLIPOFF=0;
return PLUGIN_HANDLED;
}
if (streq(Data, "on")==1) {
selfmessage( "Noclip will be turned off at the end of a vote or admin_noclipon.");
NOCLIPOFF=1;
return PLUGIN_HANDLED;
}
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 (COn==1) {
if (strcasestr(Data, "up")!=-1) {
noclip(User, 1);
}
if (strcasestr(Data, "down")!=-1) {
noclip(User, 0);
}
}
#if ENABLE_NOCLIP_STATUS==1
new Match = FALSE;
if (strcasestr(Data, "cheat")!=-1) {
Match = TRUE;
}
if (strcasestr(Data, "cheats")!=-1) {
Match = TRUE;
}
if (strcasestr(Data, "noclip")!=-1) {
Match = TRUE;
}
if (strcasestr(Data, "noclipping")!=-1) {
Match = TRUE;
}
if (strcasestr(Data, "nocliping")!=-1) {
Match = TRUE;
}
if (strcasestr(Data, "fly")!=-1) {
Match = TRUE;
}
if (strcasestr(Data, "clip")!=-1) {
Match = TRUE;
}
if (strcasestr(Data, "clipping")!=-1) {
Match = TRUE;
}
if (strcasestr(Data, "up")!=-1 && COn!=1) {
Match = TRUE;
}
#endif
/**** Is it on or off? ****/
#if ENABLE_NOCLIP_STATUS==1
if (Match==TRUE) {
if (COn==1) {
centersay ("Noclipping is on. ^n To change say vote_noclip. ^nType up to access.",9,0,255,0);
}
else {
centersay ("Noclipping is off!^nTo change say vote_noclip",12,0,255,0);
}
}
#endif
#if ENABLE_NOCLIP_VOTE==1
if (strcasestr(Data, "vote_noclip")!=-1) {
if (NOCLIPVoteOff==1) {
say("Admin has disable public use of vote_noclip.");
} else {
if (vote_NOCLIPAllowed != 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_NOCLIPAllowed=0;
set_timer("@NOCLIPVoteTimer",RVfreq,1);
NOCLIPVote();
}
}
}
}
#endif
return PLUGIN_CONTINUE;
}
@NOCLIPVote() {
if (vote_allowed()==1) {
NOCLIPVote();
say("[AutoVoteNOCLIP] Vote Started");
} else {
set_timer("@NOCLIPVote",30,1);
say("[AutoVoteNOCLIP] Vote not allowed at this time");
say("Server will retry in 30 secconds");
}
}
public Noclip_Timer(Timer, Repeat, HLUserName, HLParam)
{
new Text[MAX_TEXT_LENGTH];
new User[MAX_NAME_LENGTH];
new Red = random(256);
new Green = random(256);
new Blue = random(256);
convert_string(HLUserName, User, MAX_NAME_LENGTH);
if (Repeat-1 == 0)
{
execute_all("kill");
snprintf(Text, MAX_TEXT_LENGTH, "Noclipping is off.. I hope you aren't stuck!!", User);
COn = 0;
}
else
{
snprintf(Text, MAX_TEXT_LENGTH, "The noclip cheat will turn off in %d more seconds.^nGet into open air!", Repeat-1);
}
typesay(Text, 1, Red, Green, Blue);
}
public execute_all(a[]) {
new userid = 0;
new wonid = 0;
new teamid = 0;
new username[200];
new i=0;
new x = 0;
COn=0;
x = maxplayercount();
for(i=1; i<=x; i=i+1) {
strinit(username);
if(playerinfo(i, username, 200, userid, wonid, teamid)==1) {
noclip (username, 0);
}
}
}
public plugin_init() {
plugin_registerinfo("Noclipping Voting","vote for noclip with autorespond status",STRING_VERSION);
plugin_registercmd("say","HandleSay",ACCESS_ALL);
#if ENABLE_NOCLIP==1
plugin_registercmd("admin_noclipon","admin_noclipon",ACCESS_RESTRICT,"admin_noclipon : Toggles noclipping access on and off.");
#endif
#if ENABLE_NOCLIP_VOTE==1
plugin_registercmd("admin_vote_noclip","admin_vote_noclip",ACCESS_RESTRICT,"admin_vote_noclip : Starts a vote to enable noclipping. off/on changes public use of vote_noclip");
plugin_registerhelp("say",ACCESS_ALL,"say vote_noclip: Will start noclipping vote and give status.");
#endif
#if ENABLE_NOCLIP_STATUS==1
plugin_registerhelp("say",ACCESS_ALL,"say noclip,noclipping,nocliping,fly: Will give noclip status.");
#endif
#if AUTO_NOCLIP_VOTE==1
set_timer("@NOCLIPVote",450,1);
#endif
return PLUGIN_CONTINUE;
}
               (
geocities.com/thor2488/amplugin)                   (
geocities.com/thor2488)