/* This plugin is for voting for fun mode on/off */ /* Plugin ID: plugin_votefun.sma */ /* Plugin Made By: Sharpsniper Plugin Made: 2001,October 9, 11:53 p.m */ #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_FUN 1 new STRING_VERSION[MAX_DATA_LENGTH] = "2.50.0"; public FunModeVote() { new strDummy[10]; vote("Fun Mode On??", "Yea! Fun Mode!", "No! Im No Fun!", "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) { typesay("Voting Over And ^n Fun Mode Stays On!",18,0,255,255); } else { typesay("Voting Over And ^n Fun Mode Turned On!",18,0,255,255); exec("admin_fun_mode 1"); } } else { if(getvar("admin_fun_mode")==1) { typesay("Voting Over And ^n Fun Mode Turned Off!",18,255,255,0); exec("admin_fun_mode 0"); } else { typesay("Voting Over And ^n Fun Mode Stays Off!",18,255,255,0); } } } else { numtostr(Ratio*UserCount/100,strNumber); if(getvar("admin_fun_mode")==1) { snprintf(Text, MAX_TEXT_LENGTH, "Fun Vote Was Sucessful But Not Enough (needed %s) Fun Mode On!", strNumber); } else { snprintf(Text, MAX_TEXT_LENGTH, "Fun Vote Was Sucessful But Not Enought (needed %s) Fun Mode Off!", strNumber); } typesay(Text,18,255,255,255); } } public admin_votefun(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("Vote for Fun On/Off","Opens a vote for Fun On/Off",STRING_VERSION); plugin_registercmd("admin_votefun","admin_votefun",ACCESS_VOTE_FUN,"admin_votefun : Opens a vote for Fun On/Off!"); return PLUGIN_CONTINUE; }