also das hier ist das plugin, alles was nun "slay" heisst hiess vorher "kick" kann sich das mal bitte jemand anschaun, denn ACCESS_KICK ist nirgends mehr definiert.
Code:
#include <core>
#include <console>
#include <string>
#include <admin>
#include <adminlib>
/************* THESE VARIABLES ARE GOOD TO EDIT **********************************/
//tells whether to check for campers, enable with admin_campercheck 1 or on and disable
//with admin_campercheck 0
new EnableCamperCheck = 1;
//Check every x seconds for the coordinates.
new CAMPER_TIME=15;
//how many units in any direction they have to have moved in order to not be considered a camper
new CAMPER_TOLERANCE=150;
//number of warnings they have before they get slayed. -1 to disable this feature.
new CAMPER_WARNINGS = 3;
//set to 1 if you want to slap a camper for every time they camp. 0 to disable.
new CAMPER_SLAP=1
//set this to which team is automatically checked. 0 for all, other for team #
new CAMPER_TEAM=0;
//variable to auto start a camper checking vote
#define AUTO_CP_VOTE 0;
//ratio of people who have to vote for camper-checking to turn on/off
#define CP_VOTE_RATIO 30;
/**************** THESE VARIABLES ARE NOT GOOD TO EDIT. REPEAT NOT ****************/
new STRING_VERSION[MAX_DATA_LENGTH] = "2.1 beta";
//PlayerPosition[PLAYERINDEX] [0]=x coordinates, [1]=y coordinates, [2]=z coordinates
new PlayerPosition[MAX_PLAYERS][3];
//Array that holds the number of warnings for each player.
new CamperWarnings[MAX_PLAYERS];
//value that keeps track of the timer
new CamperTimer=0;
new First=1;
public CPVote() {
new strDummy[10];
if(vote_allowed()!=1){
selfmessage("Voting not allowed at this time.");
return PLUGIN_HANDLED;
}
vote("Camper-checking?", "Yes", "No", "HandleCPVote",strDummy);
return PLUGIN_HANDLED;
}
public HandleCPVote(WinningOption,HLData,VoteCount,UserCount) {
new Text[MAX_TEXT_LENGTH];
new strNumber[MAX_NUMBER_LENGTH];
new Ratio = CP_VOTE_RATIO;
new strData[MAX_DATA_LENGTH];
convert_string(HLData, strData,MAX_DATA_LENGTH);
if (VoteCount >= Ratio*UserCount/100) {
if (WinningOption==1) {
if(EnableCamperCheck==1) {
centersay("Vote over. Camper-checking will stay.",18,249,244,0);
} else {
centersay("Vote successful. Camper-checking is on.",18,249,244,0);
EnableCamperCheck=1;
}
} else {
if(EnableCamperCheck==0) {
centersay("Vote over. Camper-checking will remain disabled.",18,63,187,239);
} else {
centersay("Vote over. Camper-checking has been disabled.",18,63,187,239);
EnableCamperCheck=0;
}
}
} else {
numtostr(Ratio*UserCount/100,strNumber);
if(EnableCamperCheck==1) {
snprintf(Text, MAX_TEXT_LENGTH, "Camper vote succeeded, but not enough votes for change (needed %s)^nCamper-checking will stay.", strNumber);
} else {
snprintf(Text, MAX_TEXT_LENGTH, "Camper vote succeeded, but not enough votes for change (needed %s)^nCamper-checking will remain disabled.", strNumber);
}
centersay(Text,18,63,187,239);
}
}
//Use this function for slying campers.
public CamperSlay(Name[]){
new Text[MAX_TEXT_LENGTH];
messageex(Name,"Du wurdest geslayed weil du zu oft gecampt hast.", print_console);
snprintf(Text,MAX_TEXT_LENGTH,"%s konnte das Campen nicht lassen und wurde getoetet.",Name);
say(Text);
slay(Name);
return PLUGIN_CONTINUE;
}
public HandlePositions(iUser,Name[],x,y,z){
new ox,oy,oz;
ox=PlayerPosition[iUser][0];
oy=PlayerPosition[iUser][1];
oz=PlayerPosition[iUser][2];
new Text[MAX_TEXT_LENGTH];
if( ! (ox-x > CAMPER_TOLERANCE || ox-x < - CAMPER_TOLERANCE ||
oy-y > CAMPER_TOLERANCE || oy-y < - CAMPER_TOLERANCE ||
oz-z > CAMPER_TOLERANCE || oz-z < - CAMPER_TOLERANCE) ){
// He's a f*cking camper!
if(CAMPER_SLAP==1)
slap(Name);
if(CAMPER_WARNINGS==-1){
messageex(Name,"Du campst zulange, bitte beweg dich !", print_center);
snprintf(Text,MAX_TEXT_LENGTH,"%s ist am Campen.",Name);
say(Text);
}
else{
if(CamperWarnings[iUser]==0){
CamperSlay(Name);
CamperWarnings[iUser]=CAMPER_WARNINGS;
return PLUGIN_CONTINUE;
}
snprintf(Text,MAX_TEXT_LENGTH,"Du campst zulange, bitte beweg dich !",CamperWarnings[iUser]);
messageex(Name,Text, print_center);
snprintf(Text,MAX_TEXT_LENGTH,"%s ist gerade am campen und hat %i Warnungen", Name, CamperWarnings[iUser]);
CamperWarnings[iUser]=CamperWarnings[iUser]-1;
say(Text);
}
}
//write their position to our records
PlayerPosition[iUser][0]=x;
PlayerPosition[iUser][1]=y;
PlayerPosition[iUser][2]=z;
return PLUGIN_CONTINUE;
}
public RecordPositions(){
new Dead;
new i;
new maxplayers = maxplayercount();
new Name[MAX_NAME_LENGTH];
new SessionID;
new Team;
new WONID;
new x,y,z;
if(EnableCamperCheck==0){
return PLUGIN_CONTINUE;
}
if(First==1){
First=0;
for(i=0;i<maxplayers;i++){
CamperWarnings[i]=CAMPER_WARNINGS;
}
}
for (i=1; i<=maxplayers; i++) {
if( playerinfo(i,Name,MAX_NAME_LENGTH,SessionID,WONID,Team,Dead)!=0){
if(Dead==0) {
if(CAMPER_TEAM==0 || Team==CAMPER_TEAM){
if(check_immunity(Name)==0) {
get_userorigin(Name,x,y,z);
HandlePositions(i,Name,x,y,z);
}
}
}
}
}
return PLUGIN_CONTINUE;
}
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);
new Match = FALSE;
if (strcasestr(Data, "camper-check")!=-1) {
Match = TRUE;
} else if (strcasestr(Data, "camper check")!=-1) {
Match = TRUE;
}
if (Match==TRUE) {
if (EnableCamperCheck == 1){
centersay ("Camper checking is on! ^nDon't camp.",7,0,255,0);
} else {
centersay ("Camper checking is off. ^nJust don't make it stupid ",7,0,255,0);
}
}
if(strcasestr(Data, "vote_camper")!=-1){
CPVote();
}
return PLUGIN_CONTINUE;
}
public admin_vote_camper(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);
CPVote();
return PLUGIN_HANDLED;
}
public admin_camperteam(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 temp_team;
convert_string(HLCommand,Command,MAX_COMMAND_LENGTH);
convert_string(HLData,Data,MAX_DATA_LENGTH);
convert_string(HLUserName,User,MAX_NAME_LENGTH);
if (strlen(Data)==0) {
snprintf(Text,MAX_TEXT_LENGTH,"Camper team: %i",CAMPER_TEAM);
selfmessage(Text);
}else{
temp_team=strtonum(Data);
CAMPER_TEAM=temp_team;
snprintf(Text,MAX_TEXT_LENGTH,"Camper team: %i",CAMPER_TEAM);
selfmessage(Text);
}
say_command(User,Command,Data);
return PLUGIN_HANDLED;
}
public admin_campercheck(HLCommand,HLData,HLUserName,UserIndex) {
new Command[MAX_COMMAND_LENGTH];
new Data[MAX_DATA_LENGTH];
new User[MAX_NAME_LENGTH];
new Text[MAX_TEXT_LENGTH];
convert_string(HLCommand,Command,MAX_COMMAND_LENGTH);
convert_string(HLData,Data,MAX_DATA_LENGTH);
convert_string(HLUserName,User,MAX_NAME_LENGTH);
if (strlen(Data)==0) {
snprintf(Text,MAX_TEXT_LENGTH,"Camper checking: %i",EnableCamperCheck);
selfmessage(Text);
}
else if(check_param(Data)==1) {
selfmessage("Camper checking: 1");
EnableCamperCheck=1;
} else {
selfmessage("Camper checking: 0");
EnableCamperCheck=0;
}
say_command(User,Command,Data);
return PLUGIN_HANDLED;
}
public admin_campert(HLCommand,HLData,HLUserName,UserIndex) {
new Command[MAX_COMMAND_LENGTH];
new Data[MAX_DATA_LENGTH];
new User[MAX_NAME_LENGTH];
new Text[MAX_TEXT_LENGTH];
convert_string(HLCommand,Command,MAX_COMMAND_LENGTH);
convert_string(HLData,Data,MAX_DATA_LENGTH);
convert_string(HLUserName,User,MAX_NAME_LENGTH);
new temp_tol=0;
if (strlen(Data)==0) {
snprintf(Text,MAX_TEXT_LENGTH,"Camper tolerance: %i",CAMPER_TOLERANCE);
selfmessage(Text);
} else{
temp_tol=strtonum(Data);
CAMPER_TOLERANCE=temp_tol;
snprintf(Text,MAX_TEXT_LENGTH,"Camper tolerance: %i",CAMPER_TOLERANCE);
selfmessage(Text);
}
say_command(User,Command,Data);
return PLUGIN_HANDLED;
}
public admin_campertime(HLCommand,HLData,HLUserName,UserIndex) {
new Command[MAX_COMMAND_LENGTH];
new Data[MAX_DATA_LENGTH];
new User[MAX_NAME_LENGTH];
new Text[MAX_TEXT_LENGTH];
convert_string(HLCommand,Command,MAX_COMMAND_LENGTH);
convert_string(HLData,Data,MAX_DATA_LENGTH);
convert_string(HLUserName,User,MAX_NAME_LENGTH);
new temp_time=0;
if (strlen(Data)==0) {
snprintf(Text,MAX_TEXT_LENGTH,"Camper time: %i",CAMPER_TIME);
selfmessage(Text);
} else{
temp_time=strtonum(Data);
CAMPER_TIME=temp_time;
kill_timer(CamperTimer);
CamperTimer=set_timer("RecordPositions",CAMPER_TIME,9999);
snprintf(Text,MAX_TEXT_LENGTH,"Camper time: %i",CAMPER_TIME);
selfmessage(Text);
}
say_command(User,Command,Data);
return PLUGIN_HANDLED;
}
public admin_camperslap(HLCommand,HLData,HLUserName,UserIndex) {
new Command[MAX_COMMAND_LENGTH];
new Data[MAX_DATA_LENGTH];
new User[MAX_NAME_LENGTH];
new Text[MAX_TEXT_LENGTH];
convert_string(HLCommand,Command,MAX_COMMAND_LENGTH);
convert_string(HLData,Data,MAX_DATA_LENGTH);
convert_string(HLUserName,User,MAX_NAME_LENGTH);
if (strlen(Data)==0) {
snprintf(Text,MAX_TEXT_LENGTH,"Camper slap: %i",CAMPER_SLAP);
selfmessage(Text);
} else if(check_param(Data)==1){
CAMPER_SLAP=1;
snprintf(Text,MAX_TEXT_LENGTH,"Camper slap: %i",CAMPER_SLAP);
selfmessage(Text);
}else{
CAMPER_SLAP=0;
snprintf(Text,MAX_TEXT_LENGTH,"Camper slap: %i",CAMPER_SLAP);
selfmessage(Text);
}
say_command(User,Command,Data);
return PLUGIN_HANDLED;
}
public admin_camperwarn(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 i;
convert_string(HLCommand,Command,MAX_COMMAND_LENGTH);
convert_string(HLData,Data,MAX_DATA_LENGTH);
convert_string(HLUserName,User,MAX_NAME_LENGTH);
new temp_tol=0;
if (strlen(Data)==0) {
snprintf(Text,MAX_TEXT_LENGTH,"Camper warnings: %i",CAMPER_WARNINGS);
selfmessage(Text);
} else{
temp_tol=strtonum(Data);
CAMPER_WARNINGS=temp_tol;
snprintf(Text,MAX_TEXT_LENGTH,"Camper warnings: %i",CAMPER_WARNINGS);
selfmessage(Text);
for (i=i;i<=MAX_PLAYERS;++i){
CamperWarnings[i]=CAMPER_WARNINGS;
}
}
say_command(User,Command,Data);
return PLUGIN_HANDLED;
}
public plugin_init() {
//Don't edit below this, please. I put lots of hard work into this plugin.
plugin_registerinfo("milkmans Anti-Camper plugin","Auto detects, announces, warns, slaps, and slays campers.",STRING_VERSION);
plugin_registercmd("admin_campercheck","admin_campercheck",ACCESS_SLAY,"Enables/disables checking for campers.");
plugin_registercmd("admin_campert","admin_campert",ACCESS_SLAY,"admin_campert <tolerance> Sets/displays camper tolerance in units.");
plugin_registercmd("admin_campertime","admin_campertime",ACCESS_SLAY,"admin_campertime <time> Sets/displays camper time check in seconds.");
plugin_registercmd("admin_camperslap","admin_camperslap",ACCESS_SLAY,"admin_camperslap <value> Enables/disables and displays the current setting of camperslap.");
plugin_registercmd("admin_camperwarn","admin_camperwarn",ACCESS_SLAY,"admin_camperwarn <value> Sets/displays number of camper warnings. Resests warnings.");
plugin_registercmd("admin_vote_camper","admin_vote_camper",ACCESS_ALL,"admin_vote_camper: starts a vote for camper-checking.");
plugin_registercmd("admin_camperteam","admin_camperteam",ACCESS_SLAY,"admin_camperteam <team> Sets which team is checked for camping.");
plugin_registercmd("say","HandleSay",ACCESS_ALL);
plugin_registerhelp("say vote_camper",ACCESS_ALL,"Starts a vote for camper-checking.");
CamperTimer=set_timer("RecordPositions", CAMPER_TIME,9999);
return PLUGIN_CONTINUE;
#if AUTO_CP_VOTE==1
set_timer("CPVote",610,1);
#endif
return PLUGIN_CONTINUE;
}