prozac-qfcc/haxxx.qc
2001-07-25 21:10:26 +00:00

1345 lines
43 KiB
C++
Raw Blame History

This file contains invisible Unicode characters

This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

#include "defs.qh"
#include "menu.qh"
/*=======================================================//
// haxxx.QC - CustomTF 3.2.OfN - 30/1/2001 - //
// Idea and base code by SB-1 tech, rewritten by often //
//=======================================================//
// Hacker related stuff //
//=======================================================*/
void(float input) SBInitiateInterface;
string(entity thebuilding) GetBuildingName;
float(float input) IntToExp;
float (entity hacked) GetICELevel;
float() CheckHaxxx;
void(entity ignore, string st, string st2, string st3, string st4, string st5, string st6) teamsprint6;
void () Menu_Friend_Hax =
{
if (self.demon_two == world) // safety
{
sprint(self,PRINT_HIGH,"You have lost the connection!\n");
ResetMenu();
return;
}
local string st,st2,st3,st4,st5,st6,st7;
st6="\n\nCom­Link åóôáâìéóèåä";
st7=" Áãôéïî: \n\n";
st5="\n\nš.. Hack-Repair Û8 secÝ\n\n.. Îïôèéîç ";
st4="";
st2="\n.. Add ìåöåì “ ICE Û20 secÝ";
if (!visible2x(self,self.demon_two)) st6="\n\nLost connection with target!\n";
/* else
{
local float dist;
dist = vlen(self.origin - self.demon_two.origin);
if (dist > HAX_UNSTABLEDIST)
{
st6="\n\nUnstable connection with target!\n";
}
}*/
if (Teammate(self.demon_two.real_owner.team_no, self.team_no))
{
if (self.demon_two.classname == "building_dispenser")
{
st7="Targetº Friendly Dispenser\n\n";
st=".. Improve capacity Û15 secÝ"; // DONE
st3="\n•.. Enhance armour Û10 secÝ"; // DONE
}
else if (self.demon_two.classname == "building_sentrygun")
{
st7="Targetº Friendly Sentry Gun\n\n";
st=".. Improve capacity Û10 secÝ"; // DONE - increase shells only
st3="\n•.. Enhance armour Û25 secÝ";
st4="\n.. Enhance circuits Û30 secÝ"; // DONE
}
else if (self.demon_two.classname == "building_tesla")
{
st7="Targetº Friendly Tesla Sentry\n\n";
st=".. Improve capacity Û10 secÝ"; // DONE
st3="\n•.. Enhance armour Û25 secÝ"; // DONE
st4="\n.. Enhance circuits Û30 secÝ"; //\n—.. Add TractorBeam Û20 secÝ");
}
else if (self.demon_two.classname == "building_camera")
{
st7="Targetº Friendly Camera\n\n";
st=".. Improve sensors Û20 secÝ"; // DONE
st3="\n•.. Enhance armour Û20 secÝ"; // DONE
}
else if (self.demon_two.classname == "building_sensor")
{
st7="Targetº Friendly Motion Sensor\n\n";
st=".. Improve range Û20 secÝ"; // DONE
st3="\n•.. Enhance armour Û10 secÝ"; // DONE
st4="\n.. Add spy revealer Û25 secÝ"; // DONE
}
else if (self.demon_two.classname == "building_teleporter")
{
st7="Targetº Friendly Teleporter\n\n";
st=".. Improve capacity Û5 secÝ"; // DONE
st3="\n•.. Enhance armour Û20 secÝ"; // DONE
st4="\n.. Increase range Û30 secÝ"; // DONE
}
else if (self.demon_two.classname == "building_fieldgen")
{
st7="Targetº Friendly Field Generator\n\n";
st= ".. Improve capacity Û10 secÝ"; // DONE
st3="\n•.. Enhance armour Û15 secÝ"; // DONE
st4="\n.. Increase range Û20 secÝ"; // DONE
}
}
if (self.demon_two.num_mines & IMPROVED_ONE)
{
st="";
}
if (self.demon_two.num_mines & IMPROVED_TWO)
{
st2="\n.. Add ìåöåì ” ICE Û25 secÝ";
if (self.demon_two.num_mines & IMPROVED_FIVE)
{
st2="\n.. Add ìåöåì • ICE Û30 secÝ";
if (self.demon_two.num_mines & IMPROVED_SIX)
st2="\n";
}
}
if (self.demon_two.num_mines & IMPROVED_THREE)
{
st3="\n";
}
if (self.demon_two.classname != "building_sensor")
{
if (self.demon_two.num_mines & IMPROVED_FOUR)
{
st4="\n";
}
}
else
{
if (self.demon_two.num_mines & IMPROVED_FOUR)
{
if (self.demon_two.num_mines & IMPROVED_SEVEN)
st4="\n";
else
st4="\n.. Thief revealer Û25 secÝ";
}
}
CenterPrint7(self,st7,st,st2,st3,st4,st5,st6);
};
void(float inp) Menu_FriendHax_Inp =
{
if (self.classname != "player" || self.demon_two == world)
return;
if (inp == 10)
{
self.impulse=0;
self.demon_two=world;
ResetMenu();
return;
}
if (inp == 8)
{
self.impulse=0;
SBInitiateInterface(inp);
ResetMenu();
return;
}
if (inp < 5 && inp > 0)
{
if (inp == 4)
{
if (self.demon_two.classname == "building_sensor")
{
if (self.demon_two.num_mines & IMPROVED_FOUR)
inp = 7; // already has spy revealer so go for thief, check if it already has thief revealer below..
}
else if (self.demon_two.classname == "building_dispenser" || self.demon_two.classname == "building_camera")
/*self.demon_two.classname != "building_sentrygun" &&
self.demon_two.classname != "building_sensor" &&
self.demon_two.classname != "building_teleporter" &&
self.demon_two.classname != "building_tesla")*/
return;
}
if (inp == 2 && self.demon_two.num_mines & IMPROVED_SIX)
return; // device completelly iced, so do nothing
if (self.demon_two.num_mines & IntToExp(inp) && inp != 2) // exclude ICE's
return; // device already has this hack done, so do nothing
SBInitiateInterface(inp);
ResetMenu();
self.impulse = 0;
}
};
void(float inp) Menu_EnemyHax_Inp =
{
if (self.classname != "player" || self.demon_two == world)
return;
if (inp == 10)
{
self.impulse=0;
self.demon_two=world;
ResetMenu();
return;
}
if (inp < 5 && inp > 0)
{
if (self.demon_two.is_malfunctioning & IntToExp(inp))
return;
SBInitiateInterface(inp);
ResetMenu();
self.impulse = 0;
}
};
void () Menu_Enemy_Hax =
{
if (self.demon_two == world) // safety
{
sprint(self,PRINT_HIGH,"You have lost the connection!\n");
ResetMenu();
return;
}
local string st,st2,st3,st4,st5,st6,st7;
st6="\n\nCom­Link åóôáâìéóèåä";
st5="\n\n.. Îïôèéîç ";
st7=" Áãôéïî: \n\n";
if (!visible2x(self,self.demon_two)) st6="\n\nLost connection with target!\n";
else
{
local float dist;
dist = vlen(self.origin - self.demon_two.origin);
if (dist > HAX_UNSTABLEDIST)
{
st6="\n\nUnstable connection with target!\n";
}
}
if (!Teammate(self.demon_two.real_owner.team_no, self.team_no))
{
if (self.demon_two.classname == "building_dispenser")
{
st7="Ôáòçåô: Åîåíù Dispenser\n\n";
st=".. Disable Û3 secÝ";
st2="\n.. Booby trap Û6 secÝ";
st3="\n•.. No production Û3 secÝ";
st4="\n.. Subtle bomb Û4 secÝ";
}
else if (self.demon_two.classname == "building_sentrygun")
{
st7="Ôáòçåô: Åîåíù Sentry Gun\n\n";
st=".. Incapacitate Û3 secÝ";
st2="\n.. Reduce accuracy Û5 secÝ";
st3="\n•.. RL malfunction Û4 secÝ";
st4="\n.. Hostile takeover Û12 secÝ";
}
else if (self.demon_two.classname == "building_tesla")
{
st7="Ôáòçåô: Åîåíù Tesla Sentry\n\n";
st=".. Incapacitate Û8 secÝ";
st2="\n.. Reduce output Û6 secÝ";
st3="\n•.. Overload Û7 secÝ";
st4="\n.. Hostile takeover Û15 secÝ";
}
else if (self.demon_two.classname == "building_camera")
{
st7="Ôáòçåô: Åîåíù Camera\n\n";
st=".. Disable comms Û5 secÝ";
st2="\n.. Disable speaker Û2 secÝ";
st3="\n•.. Sensor ghosts Û6 secÝ";
st4="\n.. Hostile takeover Û5 secÝ";
}
else if (self.demon_two.classname == "building_sensor")
{
st7="Ôáòçåô: Åîåíù Motion Sensor\n\n";
st=".. Disable sound Û5 secÝ";
st2="\n.. Disable light Û5 secÝ";
st3="\n•.. Deactivate Û5 secÝ";
st4="\n.. Hostile takeover Û5 secÝ";
}
else if (self.demon_two.classname == "building_teleporter")
{
st7="Ôáòçåô: Åîåíù Teleporter\n\n";
st=".. Item stripper Û3 secÝ";
st2="\n.. Void location Û7 secÝ";
st3="\n•.. Target builder Û5 secÝ";
st4="\n.. Disable Û2 secÝ";
}
else if (self.demon_two.classname == "building_fieldgen")
{
st7="Ôáòçåô: Åîåíù Field Generator\n\n";
st=".. Corrupt Generator Û3 secÝ";
st2="\n.. Engineer Trap Û7 secÝ";
st3="\n•.. Reduce Output Û5 secÝ";
st4="\n.. Disable Û2 secÝ";
}
}
if (self.demon_two.is_malfunctioning & SCREWUP_ONE)
{
st="";
}
if (self.demon_two.is_malfunctioning & SCREWUP_TWO)
{
st2="\n";
}
if (self.demon_two.is_malfunctioning & SCREWUP_THREE)
{
st3="\n";
}
if (self.demon_two.is_malfunctioning & SCREWUP_FOUR)
{
st4="\n";
}
CenterPrint7(self,st7,st,st2,st3,st4,st5,st6);
};
/*
===============
SBFireInterface
Uses the Cyber Interface on whatever you're looking at.
OfN - Rewritten
===============
*/
void() SBFireInterface =
{
if (CheckHaxxx() == FALSE) return;
local entity oself;
local entity targ;
local float hackThis;
targ = self.martyr_enemy;
hackThis = self.has_camera;
oself = self;
self = self.owner;
oself.think = SUB_Remove;
oself.nextthink = 0.1;
dremove(oself);
self.is_haxxxoring = 0;
self.tfstate = self.tfstate - (self.tfstate & TFSTATE_CANT_MOVE);
TeamFortress_SetSpeed(self);
if (hackThis == -2)
{
sprint(self, PRINT_HIGH, "Hack aborted.\n");
return;
}
if (targ.classname == "player" && (targ.cutf_items & CUTF_CYBERAUG))
{
if (!Teammate(targ.team_no, self.team_no))
{
targ.is_malfunctioning = 1;
sprint(targ, PRINT_HIGH, "Oh no! Your cybernetic augmentations are malfunctioning!\n");
sprint(self, PRINT_HIGH, "You tamper with ", targ.netname, "'s cybernetic augmentations.\n");
}
else if (Teammate(targ.team_no,self.team_no) && targ.is_malfunctioning)
{
targ.is_malfunctioning = 0;
sprint(targ, PRINT_HIGH, self.netname, " adjusts your cybernetics to work properly again.\n");
sprint(self, PRINT_HIGH, "You readjust ", targ.netname, "'s CyberAugs to work properly again.\n");
}
}
else if (IsBuilding(targ))
{
if (!Teammate(targ.real_owner.team_no, self.team_no) && GetICELevel(targ)==1 && random() < 0.2)
{
sprint(self, PRINT_HIGH, "This device has a level 1 ICE, it's not easy to hack!\n");
//sprint(targ.real_owner, PRINT_HIGH,"Somebody tried to hack your stuff...\n");
return;
}
if (!Teammate(targ.real_owner.team_no, self.team_no) && GetICELevel(targ)==2)
{
sprint(self, PRINT_HIGH, "This device is hack-protected.\n");
sprint(targ.real_owner, PRINT_HIGH,"Somebody just tried to hack your stuff...\n");
return;
}
if (!Teammate(targ.real_owner.team_no, self.team_no) && GetICELevel(targ)==3)
{
sprint(self, PRINT_HIGH, "This device is hack-protected with a level 3 ICE!\n");
deathmsg=DMSG_ANTIHACK;
TF_T_Damage(self, self, targ, self.health + 50, TF_TD_IGNOREARMOUR, TF_TD_OTHER);
sound (self, CHAN_MISC, "effects/crunch.wav", 1, ATTN_NONE);
return;
}
else if (!Teammate(targ.real_owner.team_no, self.team_no))
{
sprint(self, PRINT_HIGH, "You make a few adjustments...\n");
if (hackThis == SCREWUP_ONE)
{
targ.is_malfunctioning = targ.is_malfunctioning | SCREWUP_ONE;
if (targ.classname == "building_sentrygun") //
sprint(self, PRINT_HIGH, "The sentrygun is now incapacitated.\n");
else if (targ.classname == "building_tesla")
sprint(self, PRINT_HIGH, "The tesla won't shoot any more.\n");
else if (targ.classname == "building_sensor")
sprint(self, PRINT_HIGH, "Better when it doesn't make so much noise.\n");
else if (targ.classname == "building_dispenser")
sprint(self, PRINT_HIGH, "This is one dispenser that won't dispense any more.\n");
else if (targ.classname == "building_camera")
sprint(self, PRINT_HIGH, "The camera won't be reporting to its owner any longer, but to all outward appearances remains the same.\n");
else if (targ.classname == "building_teleporter")
sprint(self, PRINT_HIGH, "The teleporter will now strip the items off all who enter...\n");
else if (targ.classname == "building_fieldgen")
sprint(self, PRINT_HIGH, "The field generator is now rigged to hurt teammates...\n");
}
else if (hackThis == SCREWUP_TWO)
{
targ.is_malfunctioning = targ.is_malfunctioning | SCREWUP_TWO;
if (targ.classname == "building_sentrygun")
sprint(self, PRINT_HIGH, "The sentrygun's accuracy is now reduced.\n");
else if (targ.classname == "building_tesla")
sprint(self, PRINT_HIGH, "This tesla won't put out enough amperage to hurt a fly.\n");
else if (targ.classname == "building_camera")
sprint(self, PRINT_HIGH, "The camera is silenced.\n");
else if (targ.classname == "building_sensor")
sprint(self, PRINT_HIGH, "That glow was always pretty annoying anyway.\n");
else if (targ.classname == "building_dispenser")
{
sprint(self, PRINT_HIGH, "The dispenser is now rigged to explode!\n");
targ.martyr_enemy = self;
}
else if (targ.classname == "building_teleporter")
{
sprint(self, PRINT_HIGH, "Entering this teleporter could be unhealthy...\n");
targ.martyr_enemy = self;
}
else if (targ.classname == "building_fieldgen")
{
sprint(self, PRINT_HIGH, "Better not use spanner on this one...\n");
targ.martyr_enemy = self;
}
}
else if (hackThis == SCREWUP_THREE)
{
targ.is_malfunctioning = targ.is_malfunctioning | SCREWUP_THREE;
if (targ.classname == "building_sentrygun")
sprint(self, PRINT_HIGH, "The sentrygun rocket launcher will now malfunction...\n");
else if (targ.classname == "building_tesla")
sprint(self, PRINT_HIGH, "The tesla may experience some technical difficulties the next time it fires...\n");
else if (targ.classname == "building_camera")
sprint(self, PRINT_HIGH, "This camera will be reading ghosts now...\n");
else if (targ.classname == "building_dispenser")
sprint(self, PRINT_HIGH, "The dispenser will no longer regenerate ammo.\n");
else if (targ.classname == "building_teleporter")
sprint(self, PRINT_HIGH, "The teleporter will now teleport directly to its builder!\n");
else if (targ.classname == "building_sensor")
sprint(self, PRINT_HIGH, "The sensor is now off.\n");
else if (targ.classname == "building_fieldgen")
sprint(self, PRINT_HIGH, "The field generator won't hurt too much now.\n");
}
else if (hackThis == SCREWUP_FOUR)
{
if (targ.classname != "building_dispenser" && targ.classname != "building_teleporter" && targ.classname != "building_fieldgen")
{
local string st;
st=GetBuildingName(targ);
sprint(targ.real_owner, PRINT_HIGH,"You've lost the control of your ");
sprint(targ.real_owner, PRINT_HIGH, st);
sprint(targ.real_owner, PRINT_HIGH, "!!\n");
sprint (self, PRINT_HIGH, "The ");
sprint (self, PRINT_HIGH, st);
sprint (self,PRINT_HIGH," is now yours!\n");
teamprefixsprint(self.team_no,self);
teamsprint6(self,self.netname," hacked ",targ.real_owner.netname,"'s ",st,", now it's ours!\n");
teamprefixsprint(targ.real_owner.team_no,targ.real_owner);
teamsprint6(targ.real_owner,targ.real_owner.netname," has lost the control of his ",st,"!\n","","");
if (targ.classname == "building_sentrygun")
{
targ.real_owner.has_sentry = FALSE;
self.has_sentry = TRUE;
}
else if (targ.classname == "building_tesla")
{
targ.real_owner.has_tesla = FALSE;
self.has_tesla = TRUE;
}
else if (targ.classname == "building_camera")
{
targ.real_owner.has_camera = FALSE;
self.has_camera = TRUE;
}
else if (targ.classname == "building_sensor")
{
targ.real_owner.has_sensor = FALSE;
self.has_sensor = TRUE;
}
targ.real_owner = self;
targ.team_no = self.team_no;
}
else if (targ.classname == "building_fieldgen")
{
sprint(self, PRINT_HIGH, "The field generator is now disabled.\n");
targ.is_malfunctioning = SCREWUP_FOUR;
}
else if (targ.classname == "building_teleporter")
{
sprint(self, PRINT_HIGH, "The teleporter is now broken.\n");
targ.is_malfunctioning = SCREWUP_FOUR;
}
else if (targ.classname == "building_dispenser")
{
sprint(self, PRINT_HIGH, "The dispenser will explode when someone attempts to withdraw armour!\n");
targ.martyr_enemy = self;
targ.is_malfunctioning = SCREWUP_FOUR;
}
}
else
{
sprint(self, PRINT_HIGH, "Your attempt at hacking fails.\n");
}
}
else if (Teammate(targ.team_no,self.team_no) && hackThis == -1)
{
if (targ.is_malfunctioning)
{
targ.is_malfunctioning = 0;
sprint(self, PRINT_HIGH, "You correct the machine's malfunction.\n");
local string st;
st=GetBuildingName(targ);
if (self!=targ.real_owner)
{
sprint(targ.real_owner, PRINT_HIGH, "your ");
sprint(targ.real_owner, PRINT_HIGH, st);
sprint(targ.real_owner, PRINT_HIGH," has been fixed by ");
sprint(targ.real_owner, PRINT_HIGH, self.netname);
sprint(targ.real_owner, PRINT_HIGH, "\n");
teamprefixsprintbi(self.team_no,self,targ.real_owner);
teamsprintbi(self,targ.real_owner,targ.real_owner.netname,"'s malfunctioning ",st," has been fixed by ",self.netname,"\n");
}
else
{
teamprefixsprint(self.team_no,self);
teamsprint6(self,self.netname, " fixes his malfuntioning ",st,"\n","","");
}
}
else
{
sprint(self, PRINT_HIGH, "There is nothing wrong with this machine.\n");
}
}
else if (Teammate(targ.team_no,self.team_no))
{
//FRIENDLY IMPROVEMENTS
targ.num_mines = targ.num_mines | hackThis;
local string st;
st=GetBuildingName(targ);
sprint(self, PRINT_HIGH, "You make a few adjustments...\n");
if (hackThis == IMPROVED_ONE)
{
if (targ.classname=="building_sensor")
{
sprint(self, PRINT_HIGH, "The sensor has greater detection range now.\n");
if (self != targ.real_owner)
{
sprint(targ.real_owner, PRINT_HIGH,"your motion sensor has greater detection range thanks to ");
sprint(targ.real_owner, PRINT_HIGH, self.netname);
sprint(targ.real_owner, PRINT_HIGH, ".\n");
}
}
else if (targ.classname=="building_camera")
{
sprint(self, PRINT_HIGH, "The camera has greater range of view now.\n");
if (self != targ.real_owner)
{
sprint(targ.real_owner, PRINT_HIGH, self.netname);
sprint(targ.real_owner, PRINT_HIGH," hacked your camera, it has better sensors now.\n");
}
}
else if (targ.classname=="building_tesla")
{
targ.maxammo_cells=targ.maxammo_cells*2;
sprint(self, PRINT_HIGH, "The tesla has extra cells capacity now.\n");
if (self != targ.real_owner)
{
sprint(targ.real_owner, PRINT_HIGH, self.netname);
sprint(targ.real_owner, PRINT_HIGH," hacked your tesla, it has extra capacity for cells now.\n");
}
}
else if (targ.classname=="building_sentrygun")
{
targ.maxammo_shells=targ.maxammo_shells*2;
sprint(self, PRINT_HIGH, "The sentry gun has greater ammo capacity for shells now.\n");
if (self != targ.real_owner)
{
sprint(targ.real_owner, PRINT_HIGH, self.netname);
sprint(targ.real_owner, PRINT_HIGH," hacked your sentry gun, it has extra capacity for shells now.\n");
}
}
else if (targ.classname=="building_dispenser")
{
sprint(self, PRINT_HIGH, "The dispenser capacity was increased.\n");
if (self != targ.real_owner)
{
sprint(targ.real_owner, PRINT_HIGH, self.netname);
sprint(targ.real_owner, PRINT_HIGH," hacked your dispenser to increase its capacity.\n");
}
}
else if (targ.classname=="building_teleporter")
{
targ.maxammo_cells=targ.maxammo_cells*2;
sprint(self, PRINT_HIGH, "The teleporter cells capacity was increased.\n");
if (self != targ.real_owner)
{
sprint(targ.real_owner, PRINT_HIGH, self.netname);
sprint(targ.real_owner, PRINT_HIGH," hacked your teleporter to increase its cells capacity.\n");
}
}
else if (targ.classname=="building_fieldgen")
{
targ.maxammo_cells=targ.maxammo_cells*2;
sprint(self, PRINT_HIGH, "The field generator cells capacity was increased.\n");
if (self != targ.real_owner)
{
sprint(targ.real_owner, PRINT_HIGH, self.netname);
sprint(targ.real_owner, PRINT_HIGH," hacked your field generator to increase its cells capacity.\n");
}
}
}
else if (hackThis == IMPROVED_TWO) //- ICE level 1
{
sprint(self, PRINT_HIGH, "You add a ìåöåì “ ICE to the ");
sprint(self, PRINT_HIGH, st);
sprint(self, PRINT_HIGH,".\n");
if (self!=targ.real_owner)
{
sprint(targ.real_owner, PRINT_HIGH, self.netname);
sprint(targ.real_owner, PRINT_HIGH," adds a ìåöåì “ ICE to your ");
sprint(targ.real_owner, PRINT_HIGH, st);
sprint(targ.real_owner, PRINT_HIGH, ".\n");
}
}
else if (hackThis == IMPROVED_FIVE) //- ICE level 2
{
sprint(self, PRINT_HIGH, "You add a ìåöåì ” ICE to the ");
sprint(self, PRINT_HIGH, st);
sprint(self, PRINT_HIGH,".\n");
if (self!=targ.real_owner)
{
sprint(targ.real_owner, PRINT_HIGH, self.netname);
sprint(targ.real_owner, PRINT_HIGH," adds a ìåöåì ” ICE to your ");
sprint(targ.real_owner, PRINT_HIGH, st);
sprint(targ.real_owner, PRINT_HIGH, ".\n");
}
}
else if (hackThis == IMPROVED_SIX) //- ICE level 3
{
sprint(self, PRINT_HIGH, "You add a ìåöåì • ICE to the ");
sprint(self, PRINT_HIGH, st);
sprint(self, PRINT_HIGH,".\n");
if (self!=targ.real_owner)
{
sprint(targ.real_owner, PRINT_HIGH, self.netname);
sprint(targ.real_owner, PRINT_HIGH," adds a ìåöåì • ICE to your ");
sprint(targ.real_owner, PRINT_HIGH, st);
sprint(targ.real_owner, PRINT_HIGH, ".\n");
}
}
else if (hackThis == IMPROVED_THREE)
{
sprint(self, PRINT_HIGH, "You enhance the armour of the ");
sprint(self, PRINT_HIGH, st);
sprint(self, PRINT_HIGH,".\n");
if (self!=targ.real_owner)
{
sprint(targ.real_owner, PRINT_HIGH, self.netname);
sprint(targ.real_owner, PRINT_HIGH," enhances the armour of your ");
sprint(targ.real_owner, PRINT_HIGH, st);
sprint(targ.real_owner, PRINT_HIGH, ".\n");
}
local float num;
num=targ.health/targ.max_health;
targ.max_health=targ.max_health*2;
targ.health=num*targ.max_health;
}
else if (hackThis == IMPROVED_SEVEN)
{
if (targ.classname=="building_sensor")
{
sprint(self, PRINT_HIGH, "The sensor will be able to uncover thieves now.\n");
if (self!=targ.real_owner)
{
sprint(targ.real_owner, PRINT_HIGH, "your motion sensor can now uncover thieves after ");
sprint(targ.real_owner, PRINT_HIGH, self.netname);
sprint(targ.real_owner, PRINT_HIGH, "'s hack.\n");
}
}
}
else if (hackThis == IMPROVED_FOUR)
{
if (targ.classname=="building_sensor")
{
sprint(self, PRINT_HIGH, "The sensor will be able to uncover spies now.\n");
if (self!=targ.real_owner)
{
sprint(targ.real_owner, PRINT_HIGH, "your motion sensor can now detect spies after ");
sprint(targ.real_owner, PRINT_HIGH, self.netname);
sprint(targ.real_owner, PRINT_HIGH, "'s hack.\n");
}
}
else if (targ.classname=="building_teleporter")
{
sprint(self, PRINT_HIGH, "The teleporter had its range increased.\n");
if (self!=targ.real_owner)
{
sprint(targ.real_owner, PRINT_HIGH, "your teleporter had its range increased by ");
sprint(targ.real_owner, PRINT_HIGH, self.netname);
sprint(targ.real_owner, PRINT_HIGH, "'s hack.\n");
}
}
else if (targ.classname=="building_fieldgen")
{
sprint(self, PRINT_HIGH, "The field generator had its range increased.\n");
if (self!=targ.real_owner)
{
sprint(targ.real_owner, PRINT_HIGH, "your field generator had its range increased by ");
sprint(targ.real_owner, PRINT_HIGH, self.netname);
sprint(targ.real_owner, PRINT_HIGH, "'s hack.\n");
}
}
else if (targ.classname=="building_tesla")
{
sprint(self, PRINT_HIGH, "The tesla has a better chip-set now.\n");
if (self!=targ.real_owner)
{
sprint(targ.real_owner, PRINT_HIGH, self.netname);
sprint(targ.real_owner, PRINT_HIGH, " enhances your tesla main circuits.\n");
}
}
else if (targ.classname=="building_sentrygun")
{
sprint(self, PRINT_HIGH, "The sentry gun has a better chip-set now.\n");
if (self!=targ.real_owner)
{
sprint(targ.real_owner, PRINT_HIGH, self.netname);
sprint(targ.real_owner, PRINT_HIGH, " enhances your sentry gun main circuits.\n");
}
}
}
else
{
sprint(self, PRINT_HIGH, "OfteN: BUG! unknown hack value BUG! (wtf u hacked)\n");
RPrint(self.netname);
RPrint(" just made an unknown hack. (bug)");
}
}
}
//else
// sprint(self, PRINT_HIGH, "There is nothing there to hack!\n");
};
float(float input) IntToExp =
{
if (input == 1) return 1;
if (input == 2) return 2;
if (input == 3) return 4;
if (input == 4) return 8;
if (input == 5) return 16;
if (input == 6) return 32;
if (input == 7) return 64;
//if (input == 8) return 128;
return 0;
};
float(entity hacked, float r) ReturnFHackDelay;
// SB hax0r tool - Cyber Interface
// OfN - Rewritten
void(float input) SBInitiateInterface =
{
local entity te;
if (!visible2x(self,self.demon_two))
{
sprint(self, PRINT_HIGH, "You are not connected to the target.\n");
self.demon_two=world;
return;
}
// DOUBLE CHECK, THIS ONE AFTER MENU, THE OTHER ON JOB_HACKER //
if (self.is_feigning)
{
sprint(self, PRINT_HIGH, "You cannot hack while feigning.\n");
return;
}
if (self.is_detpacking || self.is_toffingadet)
{
sprint(self, PRINT_HIGH, "You can't hack something while setting a detpack.\n");
return;
}
if (self.is_building)
{
sprint(self, PRINT_HIGH, "You can't hack while building!\n");
return;
}
// DOUBLE CHECK, THIS ONE AFTER MENU, THE OTHER ON JOB_HACKER //
self.is_haxxxoring = 1;
te = spawn();
te.owner = self;
te.classname = "timer";
te.origin = self.demon_two.origin;
te.nextthink = time + 1;
te.has_holo = self.demon_two.team_no; // checked on think to break hacking if changes of team
te.has_camera = IntToExp(input);
if (!Teammate(self.demon_two.team_no,self.team_no))
{
te.heat = ReturnHackDelay(self.demon_two, input);
if (GetICELevel(self.demon_two)==1) // if it has a level1 ice add more delay to the hack
te.heat=te.heat*2.5;
local string st;
st=GetBuildingName(self.demon_two);
teamprefixsprint(self.team_no,self);
teamsprint6(self,self.netname," started to hack ",self.demon_two.real_owner.netname,"'s ",st,"\n");
local float dist;
dist = vlen(self.origin - self.demon_two.origin);
if (dist > HAX_UNSTABLEDIST)
{
sprint(self,PRINT_HIGH,"Connection unstable, it will take longer...");
te.heat=te.heat*2;
}
}
else
{
te.heat = ReturnFHackDelay(self.demon_two, input);
if (input==2 && self.demon_two.num_mines & IMPROVED_TWO)
{
te.has_camera=IMPROVED_FIVE;
if (self.demon_two.num_mines & IMPROVED_FIVE)
te.has_camera=IMPROVED_SIX;
}
if (input==8) te.has_camera=-1;
}
te.martyr_enemy = self.demon_two;
te.think = SBHackDotTimerThink;
self.tfstate = self.tfstate | TFSTATE_CANT_MOVE;
TeamFortress_SetSpeed(self);
sprint (self, PRINT_HIGH, "You immerse yourself in the cybernet...\n");
makeImmune(self,time + te.heat); //- OfN - WORKS? yup
te.ltime = te.heat;
self.demon_two=te;
};
float (entity hacked) GetICELevel =
{
local float retval;
retval=0;
if (hacked.num_mines & IMPROVED_TWO)
retval=1;
if (hacked.num_mines & IMPROVED_FIVE)
retval=2;
if (hacked.num_mines & IMPROVED_SIX)
retval=3;
return retval;
};
float(entity hacked, float r) ReturnHackDelay =
{
if (hacked.classname == "player")
return 5; // cyberaug hack
else if (hacked.classname == "building_dispenser")
{
if (r == 1)
return 3;
else if (r == 2)
return 6;
else if (r == 3)
return 3;
else
return 4;
}
else if (hacked.classname == "building_sentrygun")
{
if (r == 1)
return 3;
else if (r == 2)
return 5;
else if (r == 3)
return 4;
else
return 12;
}
else if (hacked.classname == "building_tesla")
{
if (r == 1)
return 8;
else if (r == 2)
return 6;
else if (r == 3)
return 7;
else
return 15;
}
else if (hacked.classname == "building_sensor")
return 5;
else if (hacked.classname == "building_camera")
{
if (r == 1)
return 5;
else if (r == 2)
return 2;
else if (r == 3)
return 6;
else
return 5;
}
else if (hacked.classname == "building_teleporter")
{
if (r == 1)
return 3;
else if (r == 2)
return 7;
else if (r == 3)
return 5;
else
return 2;
}
else if (hacked.classname == "building_fieldgen")
{
if (r == 1)
return 3;
else if (r == 2)
return 7;
else if (r == 3)
return 5;
else
return 2;
}
};
float(entity hacked, float r) ReturnFHackDelay =
{
if (hacked.classname == "player")
return 5; // cyberaug hack
else if (r == 8) return 8; // repairing..
else if (r == 2 && IsBuilding(hacked))
{
if (!(hacked.num_mines & IMPROVED_TWO))
return 20; // level 1 ICE lasts for 20 seconds always
if (!(hacked.num_mines & IMPROVED_FIVE))
return 25; // level 2 ICE lasts for 25 seconds always
if (!(hacked.num_mines & IMPROVED_SIX))
return 30;
}
else if (hacked.classname == "building_dispenser")
{
if (r == 1)
return 15;
// else if (r == 2)
// return 30;
else //if (r == 3)
return 10;
//else
// return 8;
}
else if (hacked.classname == "building_sentrygun")
{
if (r == 1)
return 10;
// else if (r == 2)
// return 30;
else if (r == 3)
return 25;
else
return 30;
}
else if (hacked.classname == "building_tesla")
{
if (r == 1)
return 10;
// else if (r == 2)
// return 30;
else if (r == 3)
return 25;
else
return 30;
}
else if (hacked.classname == "building_sensor")
{
if (r == 1)
return 20;
// else if (r == 2)
// return 30;
else if (r == 3)
return 10;
else //if (r == 4)
return 25;
//else
// return 8;
}
else if (hacked.classname == "building_camera")
{
if (r == 1)
return 20;
// else if (r == 2)
// return 30;
else // if (r == 3)
return 20;
//else
// return 8;
}
else if (hacked.classname == "building_teleporter")
{
if (r == 1)
return 5;
// else if (r == 2)
// return 30;
else if (r == 3)
return 20;
else// if (r == 4)
return 30;
//else
// return 8;
}
else if (hacked.classname == "building_fieldgen")
{
if (r == 1)
return 10;
// else if (r == 2)
// return 30;
else if (r == 3)
return 15;
else// if (r == 4)
return 20;
//else
// return 8;
}
return 999; // hehe, punishment to the bug generator :)
};
float() CheckHaxxx =
{
local float retval;
retval = TRUE;
if (self.martyr_enemy == world) // BUG!
retval = FALSE;
else if (!(IsBuilding(self.martyr_enemy))) // BUG! 2
retval = FALSE;
else if (self.martyr_enemy.health <= 0)
{
sprint (self.owner, PRINT_HIGH, "Your target has been destroyed!\n");
if (self.has_camera != -2)
{
deathmsg=DMSG_CYBERNET;
TF_T_Damage(self.owner, self.owner, self.martyr_enemy, self.owner.health + 10, TF_TD_IGNOREARMOUR, TF_TD_OTHER);
sound (self.owner, CHAN_MISC, "effects/crunch.wav", 1, ATTN_NONE);
}
retval = FALSE;
}
else if (self.martyr_enemy.team_no != self.has_holo) // target switched team? if so.. abort
{
sprint (self.owner, PRINT_HIGH, "The communication has been lost!\n");
retval = FALSE;
}
else if (self.has_camera == -2)
{
retval = TRUE;
}
else if (Teammate(self.martyr_enemy.team_no,self.owner.team_no) && self.martyr_enemy.num_mines & self.has_camera && self.has_camera != -1)
{
sprint (self.owner, PRINT_HIGH, "Somebody improved that first.\n");
retval = FALSE;
}
else if (!Teammate(self.martyr_enemy.team_no,self.owner.team_no) && self.martyr_enemy.is_malfunctioning & self.has_camera)
{
sprint (self.owner, PRINT_HIGH, "Somebody screwed that up first! heh\n");
retval = FALSE;
}
if (!retval)
{
self.owner.is_haxxxoring = 0;
self.owner.tfstate = self.tfstate - (self.tfstate & TFSTATE_CANT_MOVE);
TeamFortress_SetSpeed(self.owner);
self.think = SUB_Remove;
self.nextthink = time + 0.1;
dremove(self);
}
return retval;
};
void() SBHackDotTimerThink =
{
if (CheckHaxxx() == FALSE) return;
local vector org;
if (random() < 0.4) //-ofn was 0.3
{
org = self.martyr_enemy.origin;
if (self.martyr_enemy.classname == "building_tesla" && self.martyr_enemy.tf_items & NIT_TURRET)
org_z = org_z - 7; // - 32;
else if (self.martyr_enemy.classname == "building_tesla")
org_z = org_z + 7; // + 32;
else if (self.martyr_enemy.classname == "building_sentrygun" && self.martyr_enemy.tf_items & NIT_TURRET)
org_z = org_z - 16;
else if (self.martyr_enemy.classname == "building_sentrygun")
org_z = org_z + 16;
else if (self.martyr_enemy.classname == "building_dispenser")
org_z = org_z + 16;
else if (self.martyr_enemy.classname == "building_fieldgen")
org_z = org_z + 32;
WriteByte (MSG_BROADCAST, SVC_TEMPENTITY);
WriteByte (MSG_BROADCAST, TE_GUNSHOT);
WriteByte (MSG_MULTICAST, 3);
WriteCoord (MSG_BROADCAST, org_x);
WriteCoord (MSG_BROADCAST, org_y);
WriteCoord (MSG_BROADCAST, org_z);
multicast (org, MULTICAST_PVS);
}
self.heat = self.heat - 1;
if (self.heat <= 0)
{
SBFireInterface();
return;
}
self.nextthink = time + 1;
};
void() JobHacker =
{
local entity te;
local float r, hackThis;
local vector source;
if (self.is_haxxxoring)
{
if (self.demon_two.has_camera == -2) return; // if we ralready aborting a hack...
sprint(self, PRINT_HIGH, "Aborting hack...\n");
self.demon_two.heat = 1 + 2 * random();
self.demon_two.has_camera = -2;
return;
}
if (self.is_feigning)
{
sprint(self, PRINT_HIGH, "You cannot hack while feigning.\n");
return;
}
if (self.is_detpacking || self.is_toffingadet)
{
sprint(self, PRINT_HIGH, "You can't hack something while setting a detpack.\n");
return;
}
if (self.is_building)
{
sprint(self, PRINT_HIGH, "You can't hack while building!\n");
return;
}
source = self.origin + '0 0 16';
traceline (source, source + v_forward*500, FALSE, self);
if ( (IsBuilding(trace_ent) && trace_ent.classname != "building_sentrygun_base") || trace_ent.classname == "player")
{
if (!Teammate(trace_ent.team_no,self.team_no))
{
if (trace_ent.is_malfunctioning == SCREWUP_ONE + SCREWUP_TWO + SCREWUP_THREE + SCREWUP_FOUR)
{
sprint(self, PRINT_HIGH, "You couldn't possibly screw that up more than it already is.\n");
return;
}
else if (IsBuilding(trace_ent) && trace_ent.classname != "building_sentrygun_base")
{
self.current_menu = MENU_E_HACK;
self.menu_count = MENU_REFRESH_RATE;
}
}
else if (IsBuilding(trace_ent) && trace_ent.classname != "building_sentrygun_base")
{
self.current_menu = MENU_F_HACK;
self.menu_count = MENU_REFRESH_RATE;
}
self.demon_two = trace_ent;
if (trace_ent.classname=="player")
{
if (!(trace_ent.cutf_items & CUTF_CYBERAUG))
{
sprint(self, PRINT_HIGH, "You can't hack him.\n");
ResetMenu();
self.demon_two=world;
return;
}
sprint (self, PRINT_HIGH, "\nScanning for cyberaug equipment...\n");
SBInitiateInterface(0);
ResetMenu();
}
else
{
sprint (self, PRINT_HIGH, "\nEstablishing connection...\n");
local string st;
st=GetBuildingName(self.demon_two);
sprint (self, PRINT_HIGH, "Target ôùðå: ");
sprint (self, PRINT_HIGH, st);
sprint (self, PRINT_HIGH, "\nTarget ï÷îåò: ");
sprint (self, PRINT_HIGH, self.demon_two.real_owner.netname);
if (Teammate(self.team_no,self.demon_two.team_no))
sprint (self, PRINT_HIGH, "\nFriendly device.\n");
else
sprint (self, PRINT_HIGH, "\nÅîåíù device!\n");
}
}
else
{
sprint (self, PRINT_HIGH, "There is nothing there to hack!\n");
return;
}
};
//==================================================================
// NEEDED?
//_--------------
// called on any DIE routine for buildings to ensure nobody
// hacks unexistent machine, or eng tries to fix the building
// i think this can fix some strange crashes
/*
void(entity thebuilding) UpdateBuildingMenus =
{
local entity te;
// find all players
te = find(world, classname, "player");
while (te)
{
if (te.job & JOB_HACKER) // a hacker?
if (!te.is_haxxxoring) // currently hacking? if so.. do nothing, he could be killed by building
if (te.demon_two == thebuilding) // this is our target?
if (te.current_menu == MENU_E_HACK || te.current_menu == MENU_F_HACK) // and we have the hack menu?
{ // then reset his menu
te.demon_two = world;
if (te.StatusBarSize == 0)
CenterPrint(te, "\n");
else
te.StatusRefreshTime = time + 0.1;
te.menu_count = MENU_REFRESH_RATE;
te.current_menu = MENU_DEFAULT;
}
if (te.building == thebuilding) // put the eng building to wolrd, and player_menu will reset it
te.building = world;
te = find(te, classname, "player");
}
};
*/