/* This plugin enables Voting For Fun Mode Based On Yensid's FF vote plugin, thanks mainly go to him */ /* $Id: plugin_vote_funmode.sma,v 1.0 15/04/2001 [JP]MrLOL $ */ #include <core> #include <console> #include <string> #include <admin> #include <adminlib> /* Change this to whatever ratio of players need to vote for a setting to change it. */ #define FUNMODE_VOTE_RATIO 50 /* The Access Level For Voting To Enable Fun Mode */ #define ACCESS_VOTE_FUNMODE 1 new STRING_VERSION[MAX_DATA_LENGTH] = "2.50.0"; public FunModeVote() { new strDummy[10]; vote("Enable Fun Mode? Allows glowing and disco mode.", "Yes", "No", "HandleFunModeVote",strDummy); } public HandleFunModeVote(WinningOption,HLData,VoteCount,UserCount) { new Text[MAX_TEXT_LENGTH]; new strNumber[MAX_NUMBER_LENGTH]; new Ratio = FUNMODE_VOTE_RATIO; new strData[MAX_DATA_LENGTH]; convert_string(HLData, strData,MAX_DATA_LENGTH); if (VoteCount >= Ratio*UserCount/100) { if (WinningOption==1) { if(getvar("admin_fun_mode")==1) { centersay("Vote over. Fun Mode will remain enabled.",18,0,255,255); } else { centersay("Fun Mode Changed To Enabled.^nSay glow colour to make yourself glow colour.",18,0,255,255); exec("admin_fun_mode 1"); } } else { if(getvar("admin_fun_mode")==1) { centersay("You Spoil Sports. Fun Mode Now Disabled",18,255,255,0); exec("admin_fun_mode 0"); } else { centersay("Vote over. Fun Mode Will Remain Disabled.",18,255,255,0); } } } else { numtostr(Ratio*UserCount/100,strNumber); if(getvar("admin_fun_mode")==1) { snprintf(Text, MAX_TEXT_LENGTH, "Fun Mode vote succeeded, but not enough votes for change (needed %s)^nFun Mode will remain enabled.", strNumber); } else { snprintf(Text, MAX_TEXT_LENGTH, "Fun Mode vote succeeded, but not enough votes for change (needed %s)^nFun Mode will remain disabled.", strNumber); } centersay(Text,18,255,255,255); } } public admin_vote_funmode(HLCommand,HLData,HLUserName,UserIndex) { new Command[MAX_COMMAND_LENGTH]; new Data[MAX_DATA_LENGTH]; new User[MAX_NAME_LENGTH]; if (vote_allowed()!=1) { selfmessage( "Vote not allowed at this time."); return PLUGIN_HANDLED; } 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); FunModeVote(); return PLUGIN_HANDLED; } public plugin_init() { plugin_registerinfo("Fun Mode Voting Plugin","Starts A Vote To Enable Fun Mode By [JP]MrLOL",STRING_VERSION); plugin_registercmd("admin_vote_funmode","admin_vote_funmode",ACCESS_VOTE_FUNMODE,"admin_vote_funmode : Starts a vote to enable/disable fun mode."); return PLUGIN_CONTINUE; }