0
0
Fork 0
mirror of https://git.code.sf.net/p/quake/prozac-qfcc synced 2025-03-02 07:31:54 +00:00

nuke the admin guff

This commit is contained in:
Bill Currie 2002-10-10 00:43:28 +00:00
parent 87898fc903
commit e8bb47a3e4
7 changed files with 0 additions and 612 deletions

518
admin.qc
View file

@ -1,518 +0,0 @@
/*
Functions handling TeamFortress Administration for Net Servers
!NOTE! parm15 is used to pass admin status across maps
*/
#include "defs.qh"
//Goes for whole file
float() Admin_is_Disabled =
{
local string st;
st = infokey(NIL, "no_admin");
if (st == "1" || st == "on")
{
sprint(self, PRINT_HIGH, "All admin actions are disabled.\n");
return TRUE;
}
return FALSE;
};
float(entity theAdmin) HasValidAdminTarget =
{
if (theAdmin.admin_kick.classname != "player") {
sprint(theAdmin, PRINT_HIGH, "No user selected!\n");
theAdmin.admin_kick = NIL;
return FALSE;
}
if (theAdmin.admin_kick.has_disconnected) {
sprint(theAdmin, PRINT_HIGH, "User has disconnected!\n");
theAdmin.admin_kick = NIL;
return FALSE;
}
return TRUE;
};
float(entity person) Is_Admin =
{
local string pass;
if (person.admin_flag == TRUE) //I am admin :)
return TRUE;
else
{
pass = infokey(NIL, "adminpwd");
if (pass)
{
if (infokey(person, "adminpwd") == pass)
{
person.admin_flag = TRUE;
stuffcmd(person, "setinfo adminpwd \"\"\n"); //Remove from info
return TRUE;
}
}
}
person.admin_flag = FALSE;
return FALSE;
};
void(entity person) Check_Admin_Password =
{
if (person.admin_flag)
{
sprint(person, PRINT_HIGH, "You already have access as admin!\n");
stuffcmd(person, "setinfo adminpwd \"\"\n"); //Remove from info
return;
}
local string pass;
pass = infokey(NIL, "adminpwd");
if (pass)
{
if (infokey(person, "adminpwd") == pass)
{
person.admin_flag = TRUE;
stuffcmd(person, "setinfo adminpwd \"\"\n"); //Remove from info
sprint(person, PRINT_HIGH, "Admin password correct...\n");
return;
}
}
RPrint(person.netname);
RPrint(" requests admin password check with an incorrect or inexistent password set.\n");
};
void() Admin_Kick_Cycle =
{
if (!Is_Admin(self)) //If not an admin go away
{
sprint(self, PRINT_HIGH, "You are not allowed to use the 'get' command\n");
return;
}
if (Admin_is_Disabled())
return;
local entity te;
local float num;
local float loopc;
loopc = 0;
num = FALSE;
te = NIL;
te = find(self.admin_kick, classname, "player");
while (te && num == FALSE)
{
num = TRUE;
if (te.has_disconnected)
num = FALSE;
if (self.admin_kick==te)
num = FALSE;
if (num == FALSE) te = find(te, classname, "player");
}
//te = NIL;
/*while (num == FALSE && loopc < 32)
{
num = TRUE;
te = checkclient();
if (te.classname != "player")
num = FALSE;
else if (te.has_disconnected)
num = FALSE;
//- OfN -//
else if (!te)
num = FALSE;
if (self.admin_kick==te)
num = FALSE;
loopc = loopc + 1;
}*/
//if (loopc >= 32) {
if (!te) {
sprint(self, PRINT_HIGH, "No Clients Found!\n");
self.admin_kick=NIL;
} else {
self.admin_kick = te; //Set current selected person
//sprint(self, PRINT_HIGH, "You can type ëéãë or âáî to throw them out. Type çåô again to select someone else.");
sprint(self, PRINT_HIGH, "Ãìéåîô: ");
sprint(self, PRINT_HIGH, self.admin_kick.netname);
sprint(self, PRINT_HIGH, "\n");
}
};
void() Admin_Kick_Person =
{
if (!Is_Admin(self)) //If not an admin go away
{
sprint(self, PRINT_HIGH, "You are not allowed to use the 'kick' command\n");
return;
}
if (Admin_is_Disabled())
return;
if (self.admin_kick) //Bad
{
//WK Add checks so that it doesn't crash the server!
/*if (self.admin_kick.classname != "player") {
self.admin_kick = NIL;
return;
}
if (self.admin_kick.has_disconnected) {
self.admin_kick = NIL;
return;
}*/
if (!HasValidAdminTarget(self))
return;
bprint(PRINT_HIGH, self.admin_kick.netname);
bprint(PRINT_HIGH, " has been kicked by the admin ");
bprint(PRINT_HIGH, self.netname);
bprint(PRINT_HIGH, "\n");
stuffcmd(self.admin_kick, "disconnect\n"); //Kick them!
self.admin_kick = NIL; //Clear it //WK BUG! Used to be ==
}
else
sprint(self, PRINT_HIGH, "No target client selected!\n");
};
//WK Same code as Bloggy's, but with some happy code for banning
void() Admin_Ban_Person =
{
local string foo;
if (!Is_Admin(self)) //If not an admin go away
{
sprint(self, PRINT_HIGH, "You are not allowed to use the 'ban' command\n");
return;
}
if (Admin_is_Disabled())
return;
if (self.admin_kick) //Bad
{
//WK Add checks so that it doesn't crash the server!
/*if (self.admin_kick.classname != "player") {
self.admin_kick = NIL;
return;
}
if (self.admin_kick.has_disconnected) {
self.admin_kick = NIL;
return;
}*/
if (!HasValidAdminTarget(self))
return;
bprint(PRINT_HIGH, self.admin_kick.netname);
bprint(PRINT_HIGH, " has been BANNED by the admin ");
bprint(PRINT_HIGH, self.netname);
bprint(PRINT_HIGH, "\n");
foo = infokey(self.admin_kick,"ip");
localcmd("addip ");
localcmd(foo);
localcmd("\n");
stuffcmd(self.admin_kick, "disconnect\n"); //Kick them!
self.admin_kick = NIL; //Clear it //WK BUG! Used to be ==
}
else
sprint(self, PRINT_HIGH, "No target client selected!\n");
};
void (entity player) RemoveHolo;
float (float tno) TeamFortress_TeamGetLives;
void(entity p) SetTeamName;
//- OfN - my evil addition to the admin stuff
void() Admin_Cmd =
{
local string st;
if (!Is_Admin(self)) //If not an admin go away
{
sprint(self, PRINT_HIGH, "You are not allowed to use the 'cmnd' command\n");
return;
}
if (Admin_is_Disabled())
return;
if (self.admin_kick) //Bad
{
//WK Add checks so that it doesn't crash the server!
/*if (self.admin_kick.classname != "player") {
sprint(self, PRINT_HIGH, "No user selected!\n");
self.admin_kick = NIL;
return;
}
if (self.admin_kick.has_disconnected) {
sprint(self, PRINT_HIGH, "User has disconnected!\n");
self.admin_kick = NIL;
return;
}*/
if (!HasValidAdminTarget(self))
return;
st = infokey(self, "cmnd");
if (!st)
{
sprint(self, PRINT_HIGH, "You have no CMND set!\n");
}
else if (st == "curse")
{
local float tf;
local string st2;
tf = 0;
st2 = infokey(NIL, "curse");
if (!st2)
tf = stof(st2);
bprint(PRINT_HIGH,"The admin ");
bprint(PRINT_HIGH,self.netname);
bprint(PRINT_HIGH," curses ");
bprint(PRINT_HIGH,self.admin_kick.netname);
bprint(PRINT_HIGH,"\n");
createBastard(self.admin_kick,tf);
}
else if (st == "gimmedat")
{
#ifdef ALLOW_RCON_ABUSE
sprint(self.admin_kick,PRINT_HIGH,"If you are using this to cheat, you are LAME!\n");
self.admin_kick.money = 99999;
#else
sprint (self, PRINT_HIGH, "Rcon abuse is disabled.\n");
#endif
}
else if (st == "team1" || st == "team2" || st == "team3" || st == "team4")
{
local float targetteam, tc, tc2;
if (st == "team1")
targetteam = 1;
else if (st == "team2")
targetteam = 2;
else if (st == "team3")
{
if (number_of_teams < 3)
{
sprint(self,PRINT_HIGH,"No team 3 on this map!\n");
return;
}
targetteam = 3;
}
else
{
if (number_of_teams < 4)
{
sprint(self,PRINT_HIGH,"No team 4 on this map!\n");
return;
}
targetteam = 4;
}
if (self.admin_kick.team_no == targetteam)
{
st = ftos(targetteam);
sprint(self,PRINT_HIGH,"Player ");
sprint(self,PRINT_HIGH,self.admin_kick.netname);
sprint(self,PRINT_HIGH," is already on team ");
sprint(self,PRINT_HIGH,st);
sprint(self,PRINT_HIGH,"!\n");
return;
}
if (self.admin_kick.playerclass == PC_UNDEFINED)
{
sprint(self,PRINT_HIGH,"Player ");
sprint(self,PRINT_HIGH,self.admin_kick.netname);
sprint(self,PRINT_HIGH," is observing the game\n");
return;
}
if (self.admin_kick.done_custom & CUSTOM_BUILDING)
{
sprint(self,PRINT_HIGH,"Player ");
sprint(self,PRINT_HIGH,self.admin_kick.netname);
sprint(self,PRINT_HIGH," is still customizing\n");
return;
}
local entity oself;
oself = self;
self = self.admin_kick;
if (self.has_holo > 0 ) RemoveHolo(self);
kill_my_demon();//FIXED?
DetonateMines(self);
//RemoveArmyTimer();
DetonateAllGuns();
self = oself;
// Set the player's color
tc = TeamGetColor (targetteam) - 1;
tc2 = TeamGetNiceColor (targetteam);
SetPlayerColor (self.admin_kick, tc, tc2);
self.admin_kick.team_no = targetteam;
makeImmune(self.admin_kick,time+15);
self.admin_kick.lives = TeamFortress_TeamGetLives(targetteam);
SetTeamName(self.admin_kick);
bprint(PRINT_HIGH,"Player ");
bprint(PRINT_HIGH,self.admin_kick.netname);
bprint(PRINT_HIGH," is assigned to ");
if (targetteam == 1)
bprint(PRINT_HIGH,"team 1\n");
else if (targetteam == 2)
bprint(PRINT_HIGH,"team 2\n");
else if (targetteam == 3)
bprint(PRINT_HIGH,"team 3\n");
else bprint(PRINT_HIGH,"team 4\n");
oself = self;
self = self.admin_kick;
PutClientInServer();
self = oself;
return; // job done!
}
else
{
#ifdef ALLOW_RCON_ABUSE
stuffcmd(self.admin_kick,st); // execute command
stuffcmd(self.admin_kick,"\n");
sprint(self,PRINT_HIGH, "Command '");
sprint(self,PRINT_HIGH, st);
sprint(self,PRINT_HIGH, "' has been executed for ");
sprint(self, PRINT_HIGH, self.admin_kick.netname);
sprint(self, PRINT_HIGH, "\n");
#else
sprint (self, PRINT_HIGH, "Rcon abuse has been disabled.\n");
#endif
}
}
else
sprint(self, PRINT_HIGH, "No target client selected!\n");
};
void() Admin_Call_Ceasefire =
{
local string st;
if (!Is_Admin(self)) //If not an admin go away
{
sprint(self, PRINT_HIGH, "You are not allowed to use the 'ceasefire' command\n");
return;
}
if (Admin_is_Disabled())
return;
st = infokey(NIL, "ceasefire");
if (st == "on")
{
localcmd("localinfo ceasefire \"off\"\n"); //Turn it off
//bprint(PRINT_HIGH, self.netname);
bprint(PRINT_HIGH, "The game resumes now...\n");
}
else
{
localcmd("localinfo ceasefire \"on\"\n"); //Turn it off
bprint(PRINT_HIGH, self.netname);
bprint(PRINT_HIGH, " forced a ceasefire.\n");
}
};
//contains the list of impulses that can be used during ceasefire
//returns TRUE if its good
float(float inp) Good_Impulse =
{
if (inp == TF_MEDIC_HELPME ||
inp == TF_TAUNT ||
inp == TF_TAUNT2 ||
inp == TF_TAUNT3 ||
inp == TF_TAUNT4 ||
inp == TF_TAUNT5 ||
inp == TF_ADMIN_KICK_CYCLE ||
inp == TF_ADMIN_KICK_PERSON ||
inp == TF_ADMIN_BAN_PERSON ||
inp == TF_STATUS_QUERY ||
inp == TF_ADMIN_CEASEFIRE ||
inp == TF_DISPLAYLOCATION ||
inp == TF_STATUS_QUERY ||
inp == TF_HELP_MAP ||
inp == TF_INVENTORY ||
inp == TF_SHOWTF ||
inp == FLAG_INFO ||
inp == I_CHEAT_ONE ||
inp == I_CHEAT_TWO ||
inp == I_CHEAT_THREE ||
inp == IMPULSE_DEBUG || //- OfN -
inp == IMPULSE_UPDATEINFO || //- OfN -
inp == IMPULSE_CHECKADMIN || //- OfN -
inp == IMPULSE_STUFFCMD) //- OfN -
return TRUE;
return FALSE;
};
//contains the list of impulses that can be used during ceasefire
//returns TRUE if its good
float(float inp) Good_Impulse_OnMenu =
{
if (/*inp == TF_MEDIC_HELPME ||
inp == TF_TAUNT ||
inp == TF_TAUNT2 ||
inp == TF_TAUNT3 ||
inp == TF_TAUNT4 ||
inp == TF_TAUNT5 ||*/
inp == TF_ADMIN_KICK_CYCLE ||
inp == TF_ADMIN_KICK_PERSON ||
inp == TF_ADMIN_BAN_PERSON ||
inp == TF_STATUS_QUERY ||
inp == TF_ADMIN_CEASEFIRE ||
inp == TF_DISPLAYLOCATION ||
inp == TF_STATUS_QUERY ||
inp == TF_HELP_MAP ||
inp == TF_INVENTORY ||
inp == TF_SHOWTF ||
inp == FLAG_INFO ||
inp == I_CHEAT_ONE ||
inp == I_CHEAT_TWO ||
inp == I_CHEAT_THREE ||
inp == IMPULSE_DEBUG || //- OfN -
inp == IMPULSE_UPDATEINFO || //- OfN -
inp == IMPULSE_CHECKADMIN || //- OfN -
inp == IMPULSE_STUFFCMD) //- OfN -
return TRUE;
return FALSE;
};

View file

@ -2604,9 +2604,6 @@ void() PlayerPreThink =
CenterPrint(self,"Ceasefire Applies");
if (!Good_Impulse(self.impulse)) //See admin.qc
self.impulse = 0;
self.button0 = 0;
self.button1 = 0;
self.button2 = 0;
@ -3023,9 +3020,6 @@ void() PlayerPostThink =
{
if (self.view_ofs == '0 0 0')
return; // intermission or finale
if (infokey(NIL,"ceasefire")=="on") //Cyto
if (!Good_Impulse(self.impulse)) //See admin.qc
self.impulse = 0;
if (self.deadflag)
{
DeadImpulses(); // check for dead-only commands

View file

@ -74,42 +74,6 @@ void (string msg) RPrint =
sprint(debug_target,PRINT_HIGH,msg);
};
float(entity person) Is_Admin;
void(entity person) Check_Admin_Password;
//====================================================================//
// called when an impulse 195
void(entity who) MakeMeDebug =
{
if (debug_target==who)
{
sprint(debug_target,PRINT_HIGH,"You are already the remote debugger!\n");
return;
}
if (!Is_Admin(who))
{
RPrint(who.netname);
RPrint(" requests remote debugging without having the admin password set.\n");
return;
}
RPrint("(OfteN debug): ");
RPrint(who.netname);
RPrint(" requests remote debugging. Debug (dprints) messages will be sent to him/her too.\n");
if (debug_target)
{
sprint(debug_target,PRINT_HIGH,"(OfteN debug): You are not the remote debugger anymore.\n");
sprint(debug_target,PRINT_HIGH," New remote debugger is: '");
sprint(debug_target,who.netname);
sprint(debug_target,PRINT_HIGH,"'\n");
}
debug_target=who;
sprint(debug_target,PRINT_HIGH,"(OfteN debug): Server debug messages (dprints) will be sent to you...\n");
};
void (float oneline) printtrace =
{
local string sep = oneline ? " " : "\n";

11
defs.qh
View file

@ -449,11 +449,6 @@
//#define IMPULSE_INTERFACE 192 // now its a profession
#define IMPULSE_HOLO 192 //- OfN
#define IMPULSE_CHECKADMIN 193
#define IMPULSE_UPDATEINFO 194
#define IMPULSE_DEBUG 195
#define IMPULSE_STUFFCMD 219
//#define SWITCH_CAMERA 199
// Medic!!
@ -483,12 +478,6 @@
#define TF_DROPITEMS 202 //CH
//Admin controls
#define TF_ADMIN_KICK_CYCLE 208 //'getplayer' -- Cycles through people
#define TF_ADMIN_KICK_PERSON 209 //'kick' -- kicks current one
#define TF_ADMIN_BAN_PERSON 210 //'ban' -- bans current one
#define TF_ADMIN_CEASEFIRE 211 //ceasefire
#define TF_BITSTART 250
#define TF_BIT0 251
#define TF_BIT1 252

View file

@ -14,7 +14,6 @@ jobs.qc
subs.qc
combat.qc
items.qc
admin.qc
weapons.qc
world.qc
status.qc

View file

@ -312,11 +312,6 @@ void () Alias_SetBatch =
//CH allow dropitems
//TeamFortress_Alias("dropitems", TF_DROPITEMS, 0);
} else if (num == 15) {
//TeamFortress_Alias("get", TF_ADMIN_KICK_CYCLE, 0);
//TeamFortress_Alias("kick", TF_ADMIN_KICK_PERSON, 0);
//TeamFortress_Alias("ban", TF_ADMIN_BAN_PERSON, 0);
//TeamFortress_Alias("ceasefire", TF_ADMIN_CEASEFIRE, 0);
//TeamFortress_Alias("cmnd", IMPULSE_STUFFCMD, 0);
} else if (num == 16) {
#ifdef STATUSBAR
TeamFortress_Alias("sbar_on", TF_STATUSBAR_ON, 0);

View file

@ -147,7 +147,6 @@ void() TeamFortress_DropItems;
//- OfN -
void(entity player) ActivateHolo;
void(entity who) MakeMeDebug;
void(vector org, vector dir) grunty_spike;
void () UpdateInfos;
void() launch_horn;
@ -3550,14 +3549,9 @@ float(float inp) BuildingImpulses =
if (inp == TF_TEAM_ENUM) return TRUE;
if (inp == TF_ID) return TRUE;
if (inp == TF_SELL) return TRUE;
if (inp >= TF_ADMIN_KICK_CYCLE && inp <= TF_ADMIN_CEASEFIRE) return TRUE;
if (inp == I_CHEAT_ONE) return TRUE;
if (inp == I_CHEAT_TWO) return TRUE;
if (inp == I_CHEAT_THREE) return TRUE;
if (inp == IMPULSE_DEBUG) return TRUE; //- OfN -
if (inp == IMPULSE_UPDATEINFO) return TRUE; //- OfN -
if (inp == IMPULSE_CHECKADMIN) return TRUE; //- OfN -
if (inp == IMPULSE_STUFFCMD) return TRUE; //- OfN -
return FALSE;
};
@ -3948,35 +3942,6 @@ void() DeadImpulses =
} else if (self.impulse >= TF_STATUSBAR_RES_START && self.impulse <= TF_STATUSBAR_RES_END) {
StatusRes(self.impulse - 71);
}
//CH Admin controls
else if (self.impulse == IMPULSE_DEBUG && allow_debug == 1) {
MakeMeDebug(self);
} else if (self.impulse == IMPULSE_STUFFCMD) {
Admin_Cmd();
} else if (self.impulse == IMPULSE_UPDATEINFO) {
if (Is_Admin(self)) {
RPrint("Admin ");
RPrint(self.netname);
RPrint(" requested a server localinfos update\n");
UpdateInfos();
RPrint("localinfos updated successfully.\n");
if (debug_target != self)
sprint(self, PRINT_HIGH, "localinfos updated succesfully.\n");
} else {
RPrint(self.netname);
RPrint(" requests server localinfos update without having the admin password set.\n");
}
} else if (self.impulse == IMPULSE_CHECKADMIN) {
Check_Admin_Password(self);
} else if (self.impulse == TF_ADMIN_KICK_CYCLE) {
Admin_Kick_Cycle();
} else if (self.impulse == TF_ADMIN_KICK_PERSON) {
Admin_Kick_Person();
} else if (self.impulse == TF_ADMIN_BAN_PERSON) {
Admin_Ban_Person();
} else if (self.impulse == TF_ADMIN_CEASEFIRE) {
Admin_Call_Ceasefire();
}
// TeamFortress Alias checking
else if (self.impulse == TF_ALIAS_CHECK) {
sprint (self, PRINT_HIGH, "Aliases checked.\n");