/*This plugin requires the clan_chat plugin from adminmod.org for the admin notify funtion but it doesnt have to have it. You can add as many maps as you wish, just use the format i used for it to funtion properly. Now with vote_freq and fixed non-dedicated server bug Made by: Bryan Clay */ /* Made compatible to steam. Functionality not tested! [WING] Black Knight */ #include <core> #include <console> #include <string> #include <admin> #include <adminlib> // Enable vote freq decides whether the plugin will wait for the vote freq to say its ok (1=on,0=off) #define ACCESS_VOTE_PRISON 0 #define VOTE_PRISON_RATIO 51 #define ENABLE_VOTE_FREQ 0 new STRING_VERSION[MAX_DATA_LENGTH] = "2.50.1"; public admin_vote_prison(HLCommand,HLData,HLUser,UserIndex) { new Command[MAX_COMMAND_LENGTH]; new Data[MAX_DATA_LENGTH]; new User[MAX_NAME_LENGTH]; new Text[MAX_TEXT_LENGTH]; new Host[MAX_NAME_LENGTH]; new strAuthID[MAX_AUTHID_LENGTH]; new strVoteFreq[MAX_NUMBER_LENGTH]; numtostr(ENABLE_VOTE_FREQ,strVoteFreq); getstrvar("hostname",Host,MAX_NAME_LENGTH); convert_string(HLCommand,Command,MAX_COMMAND_LENGTH); convert_string(HLData,Data,MAX_DATA_LENGTH); convert_string(HLUser,User,MAX_NAME_LENGTH); if(strcmp(strVoteFreq,"1")==0) { if(vote_allowed()==1) { selfmessage("Vote is not allowed right now"); return PLUGIN_HANDLED; } } if(strcmp(Data,Host)==0) { selfmessage("This is not an ANARCHY...behave yourself"); return PLUGIN_HANDLED; } if(strcmp(Data,User)==0) { selfmessage("Do you really hate yourself that much?"); return PLUGIN_HANDLED; } if (check_user(Data) == 1) { new real_user[MAX_NAME_LENGTH]; get_username(Data,real_user,MAX_NAME_LENGTH); if(check_immunity(real_user)!=0) { snprintf(Text, MAX_TEXT_LENGTH, "Laf. You cant put %s in prison.", real_user); selfmessage(Text); snprintf(Text,MAX_TEXT_LENGTH,"%s tried to put %s in prison",User,real_user); plugin_exec("admin_clanchat",Text); } else { snprintf(Text, MAX_TEXT_LENGTH, "Put %s in prison?", real_user); if(getvar("sv_lan")==1) { vote(Text,"Lock him up!","Hes innocent","HandlePrisonVote",real_user); } else { get_userAuthID(real_user,strAuthID); vote(Text,"Lock him up!","Hes innocent","HandlePrisonVote",strAuthID); } } } else { selfmessage("Unrecognized user name "); selfmessage(Data); } return PLUGIN_HANDLED; } public HandlePrisonVote(WinningOption,HLUser,VoteCount,UserCount) { new Current[MAX_DATA_LENGTH]; new strNumber[MAX_NUMBER_LENGTH]; new Text[MAX_TEXT_LENGTH]; new Ratio = VOTE_PRISON_RATIO; new VoteTarget[MAX_NAME_LENGTH]; new host[MAX_NAME_LENGTH]; getstrvar("hostname",host,MAX_TEXT_LENGTH); convert_string(HLUser,VoteTarget,MAX_NAME_LENGTH); new x=0,y=0,z=0; currentmap(Current,MAX_DATA_LENGTH); if(strcmp(Current,"2fort")==0) { x = -27; y=106; z=-456; } if(strcmp(Current,"well")==0) { x=-117; y=1851; z=1323; } if(strcmp(Current,"casbah")==0) { x=506; y=2515; z=174; } if(strcmp(Current,"totalwar")==0) { x=872; y=72; z=-651; } if(strcmp(Current,"rock2")==0) { x=1458; y=2391; z=650; } if(strcmp(Current,"dustbowl")==0) { x=497; y=2542; z=-12; } if(strcmp(Current,"2fortsniper")==0) { x=-84; y=1897; z=-329; } if(strcmp(Current,"cz2")==0) { x=514; y=24; z=-76; } if(strcmp(Current,"hunted")==0) { x=309; y=1971; z=-2269; } if(strcmp(Current,"push")==0) { x=16; y=-1014; z=80; } if(strcmp(Current,"badlands")==0) { x=1686; y=3140; z=691; } if(strcmp(Current,"turkeyburgers")==0) { x=314; y=1613; z=489; } if(strcmp(Current,"epicenter")==0) { x=518; y=4; z=193; } if(strcmp(Current,"warpath")==0) { x=167; y=165; z=439; } if (WinningOption == 1) { if (VoteCount >= Ratio*UserCount/100) { snprintf(Text, MAX_TEXT_LENGTH, "%s is now inprisoned, watch him at %s,%s,%s", VoteTarget,x,y,z); say(Text); snprintf(Text,MAX_TEXT_LENGTH,"This is your cell at^n%s",host); messageex(VoteTarget,Text,print_center); teleport(VoteTarget,x,y,z); execclient(VoteTarget,"snapshot"); } else { numtostr(Ratio*UserCount/100,strNumber); snprintf(Text, MAX_TEXT_LENGTH, "Prison vote succeded but not enough for conviction (needed %s)",strNumber); say(Text); } } else { say("Prison vote failed."); } } public plugin_init() { plugin_registerinfo("Prison Vote Plugin","Enables a vote to send a player to prison.",STRING_VERSION); plugin_registercmd("admin_vote_prison","admin_vote_prison",ACCESS_VOTE_PRISON,"admin_vote_prison <name|uniqueid> : Opens a vote to imprison a player"); return PLUGIN_CONTINUE; }