/* * Admin Mod Script Made By: -TaR-Sharpsniper * This Plugin Will Enable You To Vote Ban Someone! * Usage: admin_vote_ban <name|uniqueid> <time> (default * time 0)-Bans For Life */ #include <core> #include <console> #include <string> #include <admin> #include <adminlib> new STRING_VERSION[MAX_DATA_LENGTH] = "2.50.0"; public admin_vote_ban(HLCommand,HLData,HLUserName,UserIndex) { new Command[MAX_COMMAND_LENGTH]; new Data[MAX_DATA_LENGTH]; new Text[MAX_TEXT_LENGTH]; new User[MAX_NAME_LENGTH]; new Target[MAX_NAME_LENGTH]; new strAuthID[MAX_AUTHID_LENGTH]; new strTime[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); strbreak(Data,Target,strTime, MAX_DATA_LENGTH); if(strlen(strTime) == 0) strcpy(strTime, "0", 1); if (check_user(Target) == 1) { new real_user[MAX_NAME_LENGTH]; get_username(Target,real_user,MAX_NAME_LENGTH); say_command(User,Command,Data); if(check_immunity(real_user)!=0) { snprintf(Text, MAX_TEXT_LENGTH, "You Cant Vote Ban %n You Fool!.", real_user ); say(Text); } else { snprintf(Text, MAX_TEXT_LENGTH, "Ban %s for %s minutes?", real_user, strTime); if(getvar("sv_lan")==1) { snprintf(Data, MAX_TEXT_LENGTH, "^"%s^" %s", real_user, strTime); } else { get_userAuthID(real_user,strAuthID); snprintf(Data, MAX_TEXT_LENGTH, "^"%s^" %s", strAuthID, strTime); } vote(Text,"Ban Him","Dont Ban Him","HandleBanVote", Data); } } else { selfmessage("Unrecognized user name "); selfmessage(Data); } return PLUGIN_HANDLED; } public HandleBanVote(WinningOption,HLUser,VoteCount,UserCount) { new strNumber[MAX_NUMBER_LENGTH]; new Text[MAX_TEXT_LENGTH]; new VoteUser[MAX_DATA_LENGTH]; new strTime[MAX_NAME_LENGTH]; new BanTime = 0; convert_string(HLUser,VoteUser,MAX_DATA_LENGTH); if (WinningOption == 1) { new Ratio = getvar("kick_ratio"); if (VoteCount >= Ratio*UserCount/100) { strbreak(VoteUser,VoteUser,strTime, MAX_DATA_LENGTH); if(strlen(strTime) == 0) BanTime = strtonum(strTime); snprintf(Text, MAX_TEXT_LENGTH, "%s was banned for %s minutes due to a vote.", VoteUser, strTime); say(Text); snprintf(Text, MAX_TEXT_LENGTH, "You have been banned for %s minutes due to a vote.", strTime); message(VoteUser,Text); ban(VoteUser,BanTime); } else { numtostr(Ratio*UserCount/100,strNumber); snprintf(Text, MAX_TEXT_LENGTH, "Ban vote succeeded, but not enough votes to Ban %s (needed %s)", VoteUser ,strNumber); say(Text); } } else { say("The Ban Vote Was A Failiure."); } } public plugin_init() { plugin_registerinfo("Admin Ban Vote Plugin","Be A Ban Voter! LOL!.",STRING_VERSION); plugin_registercmd("admin_vote_ban","admin_vote_ban",ACCESS_KICK,"admin_vote_ban <name|uniqueid> <time> : Starts a vote to ban target for 0 minutes."); return PLUGIN_CONTINUE; }