bomb.cpp
-----------------------------
Code:
#include <windows.h>
#include <mmsystem.h>
#include "stdafx.h"
#include <string>
#include "bomb.h"
#include "client.h"
#include "stringfinder.h"
static StringFinder findMap;
//enum{AZTEC,CBBLE,CHATEAU,DUST,DUST2,INFERNO,NUKE,PRODIGY,STORM,SURVIVOR,TORN,TRAIN,VEGAS,VERTIGO};
void initMaps()
{
findMap.add("maps/de_aztec.bsp" , 0 );
findMap.add("maps/de_cbble.bsp" , 1 );
findMap.add("maps/de_chateau.bsp" , 2 );
findMap.add("maps/de_dust.bsp" , 3 );
findMap.add("maps/de_dust2.bsp" , 4 );
findMap.add("maps/de_inferno.bsp" , 5 );
findMap.add("maps/de_nuke.bsp" , 6 );
findMap.add("maps/de_prodigy.bsp" , 7 );
findMap.add("maps/de_storm.bsp" , 8 );
findMap.add("maps/de_survivor.bsp", 9 );
findMap.add("maps/de_torn.bsp" , 10 );
findMap.add("maps/de_train.bsp" , 11 );
findMap.add("maps/de_vegas.bsp" , 12 );
findMap.add("maps/de_vertigo.bsp" , 13 );
}
inline float GetDistance(float* pos1,float* pos2)
{
register double a = pos1[0] - pos2[0];
register double b = pos1[1] - pos2[1];
register double c = pos1[2] - pos2[2];
return sqrt(a*a + b*b + c*c);
}
struct BombSites
{
float bombA[3];
float bombB[3];
float radiusA;
float radiusB;
bool deterZ; // can bombsite be determined simply by Z
};
const char* siteA = "The bomb is at site A!";
const char* siteB = "The bomb is at site B!";
// == {{ xA,yA,zA, xB,yB,zB, radiusA, radiusB , deterZ}}
BombSites bombMaps[14] = { { -907, 928, -187, 701,-1573, -187, 100, 100,false }, //de_aztec
{ 967, -940, -91,-2749,-1774, 84, 100, 100,true }, //de_cbble
{ 128, 82, -3, 2, 263, 1261, 100, 100,true }, //de_chateau
{ 1914, 644, 36, 373,-1652, 100, 100, 100,true }, //de_dust
{-1610, 2684, 36, 1151, 2410, 132, 100, 100,false }, //de_dust2
{ 1266, 2794, 196, 2169, 424, 196, 100, 100,false }, //de_inferno
{ 641, -654, -379, 621, -895, -731, 100, 100,true }, //de_nuke
{ 1767,-1276, -443, 1971, -270, -379, 100, 100,true }, //de_prodigy
{-1731, 2161, -124, 1385, 1437, -124, 100, 100,false }, //de_storm
{ -502, -151, 140, 2580, -470, 124, 100, 100,true }, //de_survivor
{-2039, -112, -427, 768, -326, -235, 100, 100,true }, //de_torn
{ 505,-1274, -267, 1055, -157, -130, 100, 100,true }, //de_train
{ 729,-2266,-1019, 1786, 556,-1035, 100, 100,false }, //de_vegas
{-2554, 746, 36, -228, 178, 36, 100, 100,false }};//de_vertigo
const char* HandleBombPlant(const char* levelName,float origin[3])
{
if(findMap.find(levelName))
{
int idx = findMap.num;
float radius = GetDistance((float*)bombMaps[idx].bombA,(float*)bombMaps[idx].bombB) / 3;
if( bombMaps[idx].deterZ )
{
if( abs(bombMaps[idx].bombA[2] - origin[2]) <= 25 )
return siteA;
if( abs(bombMaps[idx].bombB[2] - origin[2]) <= 25 )
return siteB;
}
if( abs(bombMaps[idx].bombA[0] - origin[0]) <= radius && abs(bombMaps[idx].bombA[1] - origin[1]) <= radius)
return siteA;
if( abs(bombMaps[idx].bombB[0] - origin[0]) <= radius && abs(bombMaps[idx].bombB[1] - origin[1]) <= radius)
return siteB;
}
else
{
string ret = "No bombsite data for ";
ret += levelName;
return ret.c_str();
}
return "Map found, bombsite not";
}
bomb.h
--------------------------
Code:
extern const char* HandleBombPlant(const char*,float*);
extern void initMaps();
add this in client.cpp
-----------------------------
under "local_player_info me;" add this
Code:
float bombPos[3] = { 0, 0, 0 };
in "atroundstart" add this
Code:
bombPos[0] = 0;
bombPos[1] = 0;
bombPos[2] = 0;
sound esp code
---------------------
Code:
//Plant detection
if(strstr(sample,"weapons/c4_beep") || strstr(sample,"weapons/c4_click"))
{
VectorCopy(origin,bombPos);
const char* c = HandleBombPlant(gEngfuncs.pfnGetLevelName(),bombPos);
gSetHudMessage3(c,3,5,-1,-1);
}
else
{
if(theMessage.length()>length)
gSetHudMessage5(theMessage.c_str());
}
--------------
client.cpp
float bombPos[3] = { 0, 0, 0 };
char gHudMessage3[256]="";
StopTimer gHudTimer3;
int messageColor = 5;
int colorStart = -1;
int colorEnd = -1;
void gSetHudMessage3(const char* message, int duration,int color = 5,int pos = -1,int end = -1)
{
gHudMessageColor = color;
colorStart = pos;
colorEnd = end;
strcpy(gHudMessage3,message);
gHudTimer3.countdown(duration);
}
char gHudMessage5[4][256] = { "","","","" }; //allow up to four messages
StopTimer gHudTimer5;
int indexRedirect[4] = { 0,1,2,3 }; // a "hack" way to scroll list without copying strings
int duration;
void gSetHudMessage5(const char* message)
{
int dest = indexRedirect[0];
indexRedirect[0] = indexRedirect[1];
indexRedirect[1] = indexRedirect[2];
indexRedirect[2] = indexRedirect[3];
indexRedirect[3] = dest;
strcpy(gHudMessage5[dest],message);
gHudTimer5.countdown(duration);
}
----------------------
pres_dynamicsioud
if(strstr(sample,"player/pl_ladder"))
{
int len = theMessage.length();
theMessage+=" is using ladder!";
if (cvar.actioninfo)
{
gSetHudMessage3(theMessage.c_str(),2,ref.team,0,len);
}
}
//Defuse detection
if(strstr(sample,"weapons/c4_disarm"))
{
theMessage+=" is defusing bomb";
if (cvar.actioninfo)
{
gSetHudMessage3(theMessage.c_str(),2,5,-1,-1);
}
}
//Scout Shooting Detection
if(strstr(sample,"weapons/scout_fire-1"))
{
theMessage+=" is shooting a scout";
if (cvar.actioninfo)
{
gSetHudMessage3(theMessage.c_str(),2,5,-1,-1);
}
}
//Hossie Detection
if(strstr(sample,"hostage/hos1"))
{
theMessage+=" or...someone is rescuing a hossie";
if (cvar.actioninfo)
{
gSetHudMessage3(theMessage.c_str(),2,5,-1,-1);
}
}
//player death detection 1
if(strstr(sample,"player/die1"))
{
theMessage+=" Got Marmalized";
if (cvar.deathinfo)
{
gSetHudMessage3(theMessage.c_str(),2,5,-1,-1);
}
}
//player death detection 2
if(strstr(sample,"player/die2"))
{
theMessage+=" Got Fuckin Wasted";
if (cvar.deathinfo)
{
gSetHudMessage3(theMessage.c_str(),2,5,-1,-1);
}
}
//player death detection 3
if(strstr(sample,"player/die3"))
{
theMessage+=" Just Took A Bullet";
if (cvar.deathinfo)
{
gSetHudMessage3(theMessage.c_str(),2,5,-1,-1);
}
}
//player hit detection (kevlar)
if(strstr(sample,"player/bhit_kevlar-1"))
{
theMessage+=" Got Hit (CHEST)-(Wearing Kevlar)";
if (cvar.hitinfo)
{
gSetHudMessage3(theMessage.c_str(),2,5,-1,-1);
}
}
//player hit detection (helmet)
if(strstr(sample,"player/bhit_helmet-1"))
{
theMessage+=" Got Hit (HEAD)-(Wearing Helmet)";
if (cvar.hitinfo)
{
gSetHudMessage3(theMessage.c_str(),2,5,-1,-1);
}
}
//player hit detection (no kevlar)
if(strstr(sample,"player/bhit_flesh"))
{
theMessage+=" got hit not critical or maybe not wearing kevlar)";
if (cvar.hitinfo)
{
gSetHudMessage3(theMessage.c_str(),2,5,-1,-1);
}
}
//player command (cover me)
if(strstr(sample,"radio/ct_coverme"))
{
theMessage+=" is requesting cover from his team";
if (cvar.commandinfo)
{
gSetHudMessage3(theMessage.c_str(),2,5,-1,-1);
}
}
//Night vision
if(strstr(sample,"items/nvg_on"))
{
theMessage+=" turned his night vision on";
if (cvar.commandinfo)
{
gSetHudMessage3(theMessage.c_str(),2,5,-1,-1);
}
}
//go go go
if(strstr(sample,"radio/com_go"))
{
theMessage+=" says go go go!!!";
if (cvar.commandinfo)
{
gSetHudMessage3(theMessage.c_str(),2,5,-1,-1);
}
}
//Plant detection
if(strstr(sample,"weapons/c4_beep") || strstr(sample,"weapons/c4_click"))
{
VectorCopy(origin,bombPos);
const char* c = HandleBombPlant(gEngfuncs.pfnGetLevelName(),bombPos);
if (cvar.bombtimer)
{
gSetHudMessage3(c,3,5,-1,-1);
}
}
------------
roundstart
bombPos[0] = 0;
bombPos[1] = 0;
bombPos[2] = 0;
if any errors use akuma source