На нашем форуме вы сможете найти самые свежие и рабочие Читы для CrossFire, Читы для Point Blank, Читы для SAMP, Читы для cs 1.6, Читы для World Of Tanks, WOW Читы, Вконтакте Баги, Черный Рынок.


Всем хай вот код для вставки аима в тренер да в тренер
Код: выделить все
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using System.Runtime.InteropServices;
using System.Threading;
//Our DirectX libs
using Microsoft.DirectX;
using Microsoft.DirectX.Direct3D;
using ProcessMemoryReaderLib;
using System.Diagnostics;

namespace External_ESP_Aimbot
{
public partial class DirectXOverlayFRM : Form
{

//the variables that decide our crosshair information
string WindowName;

bool _StopThread; //used to stop the crosshair thread from outside
public bool threadOver;
int _Scale = 0;

//ESP Vars
float ScreenX, ScreenY;
int[] resolution;
int[] screencenter;
float[] fov;
Vect3d viewAngles;
Vect3d vForward, vRight, vUpward;
ProcessMemoryReader Mem;
IntPtr handle;//Window handle
RECT windowRectangle; // stores our window's data
int _ScaleESP = 1;// Draw all ESP's at medium size

//Aimbot m Esp Vars
//Used to ensure we stay focused on an enemy as long as we hold the HOT KEY, if we let go of it then when pressing again we find a new enemy
bool FocusingOnEnemy = false;
int FocusTarget = -1;
int EspChoice;
const int MAXPLAYERS = 64;


public DirectXOverlayFRM(string windowName, int espChoice, ProcessMemoryReader mem)
{
Mem = mem;
//grab our information
threadOver = false;
_StopThread = false;
WindowName = windowName;
EspChoice = espChoice;
SetupVars();
InitializeComponent();
SetupDX();
}

private void SetupVars()
{
resolution = new int[2];
screencenter = new int[2];
fov = new float[2];
viewAngles = new Vect3d();
vForward = new Vect3d();
vRight = new Vect3d();
vUpward = new Vect3d();

//FIND WINDOW SIZES ETC,. CORE

//Find the resolution from our game, you can also use something like 
//resolution[0] = 1280
//resolution[1] = 720
//Although if you can find the values from memory then you can adapt to any res
resolution[0] = Mem.ReadInt(0xD573F34);
resolution[1] = Mem.ReadInt(0xD573F38);

screencenter[0] = resolution[0] / 2;
screencenter[1] = resolution[1] / 2;

handle = FindWindow(null, WindowName); //Call of duty 4 Multiplayer
//only draw if our window is valid
if (handle != IntPtr.Zero)
{
windowRectangle = GetWindowRect(handle);
}

}

private void SetupDX()
{
//Make the window's border completely transparant
SetWindowLong(this.Handle, GWL_EXSTYLE,
(IntPtr)(GetWindowLong(this.Handle, GWL_EXSTYLE) ^ WS_EX_LAYERED ^ WS_EX_TRANSPARENT));

//Set the Alpha on the Whole Window to 255 (solid)
SetLayeredWindowAttributes(this.Handle, 0, 255, LWA_ALPHA);

//Init DirectX
//This initializes the DirectX device. It needs to be done once.
//The alpha channel in the backbuffer is critical.
PresentParameters presentParameters = new PresentParameters();
presentParameters.Windowed = true;
presentParameters.SwapEffect = SwapEffect.Discard;
presentParameters.BackBufferFormat = Format.A8R8G8B8;

this.device = new Device(0, DeviceType.Hardware, this.Handle,
CreateFlags.HardwareVertexProcessing, presentParameters);

Thread dx = new Thread(new ThreadStart(this.dxThread));
dx.IsBackground = true;
dx.Start(); 
}

public void StopThread()
{
_StopThread = true;
}

private void Form1_Load(object sender, EventArgs e)
{

}

#region OVERLAY 
private Margins marg;

//this is used to specify the boundaries of the transparent area
internal struct Margins
{
public int Left, Right, Top, Bottom;
}

[StructLayout(LayoutKind.Sequential)]
public struct RECT
{
public int left, top, right, bottom;
}

[DllImport("user32.dll", SetLastError = true)]

private static extern UInt32 GetWindowLong(IntPtr hWnd, int nIndex);

[DllImport("user32.dll")]

static extern int SetWindowLong(IntPtr hWnd, int nIndex, IntPtr dwNewLong);

[DllImport("user32.dll")]
static extern bool SetLayeredWindowAttributes(IntPtr hwnd, uint crKey, byte bAlpha, uint dwFlags);

[DllImport("user32.dll")]
static extern bool SetCursorPos(int X, int Y);

public const int GWL_EXSTYLE = -20;

public const int WS_EX_LAYERED = 0x80000;

public const int WS_EX_TRANSPARENT = 0x20;

public const int LWA_ALPHA = 0x2;

public const int LWA_COLORKEY = 0x1;

[DllImport("dwmapi.dll")]
static extern void DwmExtendFrameIntoClientArea(IntPtr hWnd, ref Margins pMargins);

[DllImport("user32.dll")]
[return: MarshalAs(UnmanagedType.Bool)]
public static extern bool GetWindowRect(IntPtr hwnd, out RECT lpRect);

[DllImport("user32.dll", SetLastError = true)]
static extern IntPtr FindWindow(string lpClassName, string lpWindowName);


private Device device = null;


public static RECT GetWindowRect(IntPtr hWnd)
{
RECT result = new RECT();
GetWindowRect(hWnd, out result);
return result;
}
#endregion

//----------------------DX THREAD---------------------------------
private void dxThread()
{
while (!_StopThread)
{
#region device work
//Place your update logic here
device.Clear(ClearFlags.Target, Color.FromArgb(0, 0, 0, 0), 1.0f, 0);
device.RenderState.ZBufferEnable = false;
device.RenderState.Lighting = false;
device.RenderState.CullMode = Cull.None;
device.Transform.Projection = Matrix.OrthoOffCenterLH(0, this.Width, this.Height, 0, 0, 1);
device.BeginScene();
#endregion

#region Drawing and rendering 
//Place your rendering logic here

IntPtr handle = FindWindow(null, WindowName); //Call of duty 4 Multiplayer
//only draw if our window is valid
if (handle != IntPtr.Zero)
{
RECT windowRectangle = GetWindowRect(handle);
ESP_Aimbot();
}
#endregion

#region Finish rendering
device.EndScene();
device.Present();
#endregion
}
this.device.Dispose();
threadOver = true;

}

public void FillRect(float x, float y, float w, float h, int r, int g, int b)
{
CustomVertex.TransformedColored[] verts = new CustomVertex.TransformedColored[4];

verts[0].Position = new Vector4(x, y + h, 0, 0.5f);
verts[1].Position = new Vector4(x, y, 0, 0.5f);
verts[2].Position = new Vector4(x + w, y + h, 0, 0.5f);
verts[3].Position = new Vector4(x + w, y, 0, 0.5f);
//or make it with for(int i = 0; i < 4; i++) to write less code
verts[0].Color = System.Drawing.Color.FromArgb(r, g, b).ToArgb();
verts[1].Color = System.Drawing.Color.FromArgb(r, g, b).ToArgb();
verts[2].Color = System.Drawing.Color.FromArgb(r, g, b).ToArgb();
verts[3].Color = System.Drawing.Color.FromArgb(r, g, b).ToArgb();

device.VertexFormat = CustomVertex.TransformedColored.Format;
device.DrawUserPrimitives(PrimitiveType.TriangleSt rip, 2, verts);
}



public void DrawRectangle(float x, float y, float w, float h, Color color)
{
float thickness = (w / 25);
//Vertical bar 1
FillRect(x - (w / 2), y - (h / 2), thickness/*just to keep our width consistent*/, h, color.R, color.G, color.B);
////Horiz 1
FillRect(x - (w / 2), y - (h / 2), w, thickness, color.R, color.G, color.B);
////Horizontal bar 2, -50 because we want the exact center of the crosshair to be 
////at our X,Y coords and not the far left on crosshair on them
FillRect(x - (w / 2), y + (h / 2), w, thickness, color.R, color.G, color.B);
////Vertical bar 2
FillRect(x + (w / 2), y - (h / 2), thickness, h, color.R, color.G, color.B);
}


public void DrawCircle(int X, int Y, float radius, int slices, Color color, string typeofCircle)
{
CustomVertex.TransformedColored[] vertices = new CustomVertex.TransformedColored[slices + 2];
int[] indices = new int[slices * 3];
int col1;
float x, y;
x = X;
y = Y;
col1 = color.ToArgb();

float deltaRad = DegreeToRadian(360) / slices;
float delta = 0;

vertices[0] = new CustomVertex.TransformedColored(x, y, 0, 1, col1);

for (int i = 1; i < slices + 2; i++)
{
vertices[i] = new CustomVertex.TransformedColored(
(float)Math.Cos(delta) * radius + x,
(float)Math.Sin(delta) * radius + y,
0, 1, col1);
delta += deltaRad;
}

indices[0] = 0;
indices[1] = 1;

for (int i = 0; i < slices; i++)
{
indices[3 * i] = 0;
indices[(3 * i) + 1] = i + 1;
indices[(3 * i) + 2] = i + 2;
}


//either draw a filled circle or a hollow one
device.VertexFormat = CustomVertex.TransformedColored.Format;
if (typeofCircle == "Solid")
device.DrawUserPrimitives(PrimitiveType.TriangleFa n, slices, vertices);
else
device.DrawUserPrimitives(PrimitiveType.PointList, slices, vertices);

}

private float DegreeToRadian(double angle)
{
return (float)(Math.PI * angle / 180.0);
}


private void DrawESP(int x, int y, Color color, int crosshairChoice)
{
if (crosshairChoice == (int)CrosshairTypes.normal)
NormalCrosshair(x, y, color);

else if (crosshairChoice == (int)CrosshairTypes.square)
SquareCrosshair(x, y, color);

else if (crosshairChoice == (int)CrosshairTypes.dot)
{
float size = 6.0f;
if (_ScaleESP == 1)
size = 12.0f;
else if (_ScaleESP == 2)
size = 24.0f;
DrawCircle(x, y, size, 500, color, "Solid");
}
else if (crosshairChoice == (int)CrosshairTypes.smiley)
{
if (_ScaleESP == 0)
{
//Face
DrawCircle(x, y, 16.0f, 500, color, "Clear");
//Left eye
DrawCircle(x, y, 3.0f, 500, color, "Clear");
//Right eye
DrawCircle((x), (y) - 4, 3.0f, 500, color, "Clear");
//Mouth
DrawCircle(x, y + 6, 4.0f, 500, color, "Clear");
}
if (_ScaleESP == 1)
{
//Face
DrawCircle(x, y, 32.0f, 500, color, "Clear");
//Left eye
DrawCircle(x, y, 6.0f, 500, color, "Clear");
//Right eye
DrawCircle(x, y, 6.0f, 500, color, "Clear");
//Mouth
DrawCircle(x, y + 15, 7.0f, 500, color, "Clear");
}
if (_ScaleESP == 2)
{
//Face
DrawCircle(x, y, 64.0f, 500, color, "Clear");
//Left eye
DrawCircle(x, y, 9.0f, 500, color, "Clear");
//Right eye
DrawCircle(x, y, 9.0f, 500, color, "Clear");
//Mouth
DrawCircle(x, y, 10.0f, 500, color, "Clear");
}
}

else if (crosshairChoice == (int)CrosshairTypes.predator)
{
CrosshairPredator(x, y, color);
}

else if (crosshairChoice == (int)CrosshairTypes.circleDot)
{
float radiusMain = 16.0f;
float radiusDot = 2.0f;
//medium
if (_ScaleESP == 1)
{
radiusMain = 32.0f;
radiusDot = 4.0f;
}
//large
else if (_ScaleESP == 2)
{
radiusMain = 62.0f;
radiusDot = 8.0f;
}

//Main Circle
DrawCircle(x, y, radiusMain, 500, color, "Clear");
//Dot in center
DrawCircle(x, y, radiusDot, 500, color, "Solid");
}
else if (crosshairChoice == (int)CrosshairTypes.clearSquare)
{
CrosshairSquareClear(x, y, color);
}
}

#region ESP DRAWING



private void NormalCrosshair(int x, int y, Color color)
{
if (_Scale == 0)
{
//Horizontal bar, -50 because we want the exact center of the crosshair to be 
//at our X,Y coords and not the far left on crosshair on them
FillRect(x - 25, y - 2, 50, 2, color.R, color.G, color.B);
//Vertical bar
FillRect(x, y - 28, 2, 50, color.R, color.G, color.B);
}
//medium
if (_Scale == 1)
{
//Horizontal bar
FillRect(x - 49, y - 2, 100, 2, color.R, color.G, color.B);
//Vertical bar
FillRect(x + 1, y - 54, 2, 100, color.R, color.G, color.B);
}
//large
if (_Scale == 2)
{
//Horizontal bar
FillRect(x - 100, y - 2, 200, 2, color.R, color.G, color.B);
//Vertical bar
FillRect(x + 1, y - 100, 2, 200, color.R, color.G, color.B);
}
}
private void SquareCrosshair(int x, int y, Color color)
{
if (_Scale == 0)
{
FillRect(x - 4, y - 7, 10, 10, color.R, color.G, color.B);
}
//medium
if (_Scale == 1)
{
FillRect(x - 8, y - 14, 20, 20, color.R, color.G, color.B);
}
if (_Scale == 2)
{
FillRect(x - 18, y - 25, 40, 40, color.R, color.G, color.B);
}
}


private void CrosshairPredator(int x, int y, Color color)
{
if (_Scale == 0)
{
//Main Circle
DrawCircle(x+ 1, y- 8, 2.5f, 500, color, "Solid");
//2nd Left
DrawCircle(x-8, y + 6, 2.5f, 500, color, "Solid");
//3rd right
DrawCircle(x+8, y+ 6, 2.5f, 500, color, "Solid");
}
else if (_Scale == 1)
{
//Main Circle
DrawCircle(x + 1, y - 12, 2.5f, 500, color, "Solid");
//2nd Left
DrawCircle(x- 12, y + 10, 2.5f, 500, color, "Solid");
//3rd right
DrawCircle(x+ 12, y + 10, 2.5f, 500, color, "Solid");
}
else if (_Scale == 2)
{
//Main Circle
DrawCircle(x+ 1, y - 16, 2.5f, 500, color, "Solid");
//2nd Left
DrawCircle(x- 16, y + 14, 2.5f, 500, color, "Solid");
//3rd right
DrawCircle(x+ 16, y + 14, 2.5f, 500, color, "Solid");
}
}

private void CrosshairSquareClear(int x, int y, Color color)
{
if (_Scale == 0)
{
//Vertical bar 2
FillRect(x - 14, y - 14, 2, 25, color.R, color.G, color.B);
//Horiz 1
FillRect(x - 11, y - 14, 25, 2, color.R, color.G, color.B);
//Horizontal bar 2, -50 because we want the exact center of the crosshair to be 
//at our X,Y coords and not the far left on crosshair on them
FillRect(x - 11, y + 9, 25, 2, color.R, color.G, color.B);
//Vertical bar 1
FillRect(x + 13, y - 14, 2, 25, color.R, color.G, color.B);
}
if (_Scale == 1)
{
//at our X,Y coords and not the far left on crosshair on them
FillRect(x - 24, y + 20, 50, 2, color.R, color.G, color.B);
//Vertical bar
FillRect(x - 25, y - 28, 2, 50, color.R, color.G, color.B);
//Vertical bar
FillRect(x + 25, y - 28, 2, 50, color.R, color.G, color.B);
//Horiz 2
FillRect(x - 24, y - 28, 50, 2, color.R, color.G, color.B);
}
//large
if (_Scale == 2)
{
//at our X,Y coords and not the far left on crosshair on them
FillRect(x - 50, y + 50, 100, 2, color.R, color.G, color.B);
//Vertical bar
FillRect(x - 50, y - 50, 2, 100, color.R, color.G, color.B);
//Vertical bar
FillRect(x + 50, y - 50, 2, 102, color.R, color.G, color.B);
//Horiz 2
FillRect(x - 50, y - 50, 100, 2, color.R, color.G, color.B);

}
}


#endregion

private void Form1_Paint(object sender, PaintEventArgs e)
{
//Create a margin (the whole form)
marg.Left = 0;
marg.Top = 0;
marg.Right = this.Width;
marg.Bottom = this.Height;

//Expand the Aero Glass Effect Border to the WHOLE form.
// since we have already had the border invisible we now
// have a completely invisible window - apart from the DirectX
// renders NOT in black.
DwmExtendFrameIntoClientArea(this.Handle, ref marg);
}

#region ESP and Aimbot

//By using our PlayerData pointers and memory addresses we grab all information from the player including:
//Xmouse(YAW), Ymouse(PITCH) coordinates, player's position on the game x,y and z as well as the player's health
//with that we can ignore dead enemies and not aim when OUR player is dead
private PlayerDataVec GetPlayerVecData()
{
PlayerDataVec playerRet = new PlayerDataVec();
//int playerBase = Mem.ReadMultiLevelPointer(updatePlayer.baseAddress , 4, updatePlayer.multiLevel);


playerRet.isInGame = Mem.ReadInt(0x74E35C);
//Get our client number
playerRet.clientNum = Mem.ReadInt(0x74E338);
playerRet.team = Mem.ReadInt(0x83928C); //GET OUR current team so we don't shoot at team mates
//INITIATE THIS ARRAY SOMEWHERE ELSE
//GET OUR FIELD OF VIEW
fov[0] = Mem.ReadFloat(0x797610);
fov[1] = Mem.ReadFloat(0x797614);

viewAngles.x = Mem.ReadFloat(0x79B698);
viewAngles.y = Mem.ReadFloat(0x79B69C);
viewAngles.z = Mem.ReadFloat(0x79B6A0);
playerRet.xPos = Mem.ReadFloat(0x797618);
playerRet.yPos = Mem.ReadFloat(0x79761C);
playerRet.zPos = Mem.ReadFloat(0x797620);
playerRet.clientNum = Mem.ReadInt(0x74E338);

//playerRet.isAlive = Mem.ReadInt(playerBase + updatePlayer.offsets.alive);
return playerRet;
}

private void ESP_Aimbot()
{
//if our window has been moved we update our ESP pos
//only draw if our window is valid
if (handle != IntPtr.Zero)
{
windowRectangle = GetWindowRect(handle);
}

//Grab our player's information
PlayerDataVec playerDataVec = GetPlayerVecData();
//this will store every enemy that we have information
List<PlayerDataVec> enemiesDataVec = new List<PlayerDataVec>();
List<PlayerDataVec> viableAimbBotEnemies = new List<PlayerDataVec>();
//Clear our LIST of enemies

if (playerDataVec.isInGame > 0)
{
for (int i = 0; i < MAXPLAYERS; i++)
{
//Using our pointer we grab all the enemies information e.g. health, coordinates etc and we compare
//it in order to get our mouse on the enemy and shoot at them
PlayerDataVec enemyDataVector = new PlayerDataVec();

enemyDataVector.isValid = Mem.ReadInt(0x839270 + i * 0x4CC);

enemyDataVector.isAlive = Mem.ReadInt(0x84F2D8 + i * 0x1DC + 0x1C0);

enemyDataVector.clientNum = Mem.ReadInt(0x84F2D8 + i * 0x1DC + 0xCC);

//read our player's name , i believe it has up to 16 chars
for (int x = 0; x < 16; x++)
enemyDataVector.name += (char)Mem.ReadByte(0x839270 + i * 0x4CC + (0xC + x));

//get our enemy's team
enemyDataVector.team = Mem.ReadInt(0x839270 + i * 0x4CC + 0x1C);

//if player is alive, valid and is NOT US and NOT on our team then we add him to the list of possible victims and ESP targets
if (enemyDataVector.isValid == 1 && enemyDataVector.clientNum != playerDataVec.clientNum)
{
//Same team as us
if (enemyDataVector.team == playerDataVec.team)
enemyDataVector.color = Color.Green;
//Enemy
else
enemyDataVector.color = Color.Red;

//grab enemy's pos
enemyDataVector.xPos = Mem.ReadFloat(0x839270 + i * 0x4CC + 0x398); // 0x4CC size of struct
enemyDataVector.yPos = Mem.ReadFloat(0x839270 + i * 0x4CC + 0x39C);
enemyDataVector.zPos = Mem.ReadFloat(0x839270 + i * 0x4CC + 0x3A0);
//grab the enemy's pose, we need this incase the enemy is prone that way we move the ESP box down and aimbot lower
enemyDataVector.pose = Mem.ReadInt(0x839270 + i * 0x4CC + 0x470);

//Add our new player info to our [array/list]
//add our enemy information to the list if hes alive otherwise ignore them
enemiesDataVec.Add(enemyDataVector);
}
}
//COLLECTED ALL OUR DATA regarding enemies
playerDataVec = GetPlayerVecData();


float dist;
float drawx;
float drawy;
//Now we have all our enemies stored and we need to display the ESP on them
for (int i = 0; i < enemiesDataVec.Count; i++)
{
dist = SubVectorDist(playerDataVec, enemiesDataVec[i]).length() / 48;

//converts our 3d Coordinates to 2d
if (WorldToScreen(enemiesDataVec[i].VecCoords(), playerDataVec.VecCoords()))
{
//say that our enemy is ok to aim at
enemiesDataVec[i].visible = true;

if ((((enemiesDataVec[i].pose & 0x08) != 0)) ||
((enemiesDataVec[i].pose & 0x100) != 0) ||
((enemiesDataVec[i].pose & 0x200) != 0))
{
drawx = 700.0f / dist;
drawy = 400.0f / dist;
ScreenY += 4.6f;
}
else
{
drawx = 400.0f / dist;
drawy = 700.0f / dist;
}
//We find exacly where to draw including from our Window's e.g. 
//if the window has been moved since our last loop
//add an extra bit to our screenX depending on our pos in relation to the en
//int x = windowRectangle.left + (int)(ScreenX);
//take away any height based on our own position e.g. if were crawling the ESP needs to be slightly adjusted
//int y = windowRectangle.top + (int)(ScreenY - drawy);

//DRAW OUR DAMN ESP 
DrawESP(windowRectangle.left + (int)(ScreenX), windowRectangle.top + (int)(ScreenY - drawy),
enemiesDataVec[i].color,
EspChoice);
}
else enemiesDataVec[i].visible = false;
}


#region AimbotAim
//Get only valid player's for our aimbot to use
enemiesDataVec = GetValidPlayers(enemiesDataVec, playerDataVec.team);
//---------------------------------AIMBOT PART-------------------------------
//check if our hot key is being pressed
//Mouse 2, if you want to use other hot keys Google Virtual Key Codes
int keyInput = KeyInputApi.GetKeyState(0x02); 
if ((keyInput & 0x8000) != 0)
{
FocusingOnEnemy = true;
int target = 0;
if (FocusingOnEnemy && FocusTarget != -1)
{
//If our previous target is still alive we focus on them otherwise go after someone else
if (enemiesDataVec[FocusTarget].isAlive > 0)
target = FocusTarget;
else target = FindClosestEnemyIndex(enemiesDataVec.ToArray(), playerDataVec);
}
else//By default aim at the first guy that appears, with this we focus on whos closest to us
target = FindClosestEnemyIndex(enemiesDataVec.ToArray(), playerDataVec);

//if there are more enemies we find the closest one to us then aim
if (target != -1) //-1 means something went wrong
{
dist = SubVectorDist(playerDataVec, enemiesDataVec[target]).length() / 48;
//needs to be called so certain vars are set for our aimsys
WorldToScreen(enemiesDataVec[target].VecCoords(), playerDataVec.VecCoords());

FocusTarget = target;
if ((((enemiesDataVec[target].pose & 0x08) != 0)) ||
((enemiesDataVec[target].pose & 0x100) != 0) ||
((enemiesDataVec[target].pose & 0x200) != 0))
{
drawx = 700.0f / dist;
drawy = 400.0f / dist;
ScreenY += 4.6f;
}
else
{
drawx = 400.0f / dist;
drawy = 700.0f / dist;
}

//We find exacly where to draw including from our Window's e.g. 
//if the window has been moved since our last loop
int x = windowRectangle.left + (int)(ScreenX);
int y = windowRectangle.top + (int)(ScreenY - drawy);

//this condition is only here in case all enemies are dead to aim at NO one
//previously if all were dead it would aim at the last guy killed
if (enemiesDataVec[target].isAlive > 0)
{
//put our mouse on the enemy
SetCursorPos(x, y);
}
}

}
//stopped pressing Hotkey aimbot, therefore we look for a new target as soon as its pressed again
//if player leaves key held we keep aiming at the same target until hes dead or invalid
else
{
//otherwise we stop staring at them and change targets
FocusingOnEnemy = false;
FocusTarget = -1;
}
}
}

//Returns only player's that are ok to aimbot at, e.g. enemies and only alive players
private List<PlayerDataVec> GetValidPlayers(List<PlayerDataVec> allPlayers, int myTeam)
{
List<PlayerDataVec> validPlayers = new List<PlayerDataVec>();
for (int i = 0; i < allPlayers.Count; i++)
{
if (allPlayers[i].team != myTeam)// && allPlayers[i].isAlive > 0
{
validPlayers.Add(allPlayers[i]);
}
}
return validPlayers;
}



//With this we see which enemy is closest to OUR player, we return their index that way we aim directly
//at our closest enemy
private int FindClosestEnemyIndex(PlayerDataVec[] enemiesDataVec, PlayerDataVec myPosition)
{
float[] distances = new float[enemiesDataVec.Length];
//store all our distances between us and the enemies to see which is closest
for (int i = 0; i < enemiesDataVec.Length; i++)
{
//only store their distance if they are ALIVE
if (enemiesDataVec[i].isAlive > 0 && enemiesDataVec[i].visible)
distances[i] = Get3dDistance(enemiesDataVec[i], myPosition);
//This is kind of a cheat here and im not really proud of it :/ but it was done in a rush
//in theory it just sets these as very high floats and ensures that DEAD enemies dont get 
//aimed at
else
{
distances[i] = float.MaxValue;
}
}
//Make a copy of our array so we dont lose track of which position our closest enemy is
float[] newDistances = new float[distances.Length];
Array.Copy(distances, newDistances, distances.Length);

//sorts our array from LOWEST TO HIGHEST
Array.Sort(newDistances);

//See which enemy was closest and return that Index for us to aim at them
for (int i = 0; i < distances.Length; i++)
{
if (distances[i] == newDistances[0]) //0 BEING THE CLOSEST
{
return i;
}
}
return -1;
}

#endregion


//Use the well known 3d distance formula to see how 2 players are from each other
//i didnt make this myself its just FACT. Almost every 3D game uses this formula. 2D games use a simpler variation
private float Get3dDistance(PlayerDataVec to, PlayerDataVec from)
{
return (float)
(Math.Sqrt(
((to.xPos - from.xPos) * (to.xPos - from.xPos)) +
((to.yPos - from.yPos) * (to.yPos - from.yPos)) +
((to.zPos - from.zPos) * (to.zPos - from.zPos))
));
}

Vect3d SubVectorDist(PlayerDataVec playerFrom, PlayerDataVec playerTo)
{
return new Vect3d(playerFrom.xPos - playerTo.xPos, playerFrom.yPos - playerTo.yPos, playerFrom.zPos - playerTo.zPos);
}

Vect3d SubVectorDist(Vect3d playerFrom, Vect3d playerTo)
{
return new Vect3d(playerFrom.x - playerTo.x, playerFrom.y - playerTo.y, playerFrom.z - playerTo.z);
}

//Grabs our 3d Coordinates and changes them to 2d for us to player with
//---------------------------------------------------------------------------
bool WorldToScreen(Vect3d WorldLocation, Vect3d mypos)
{
Vect3d vLocal, vTransForm;
vTransForm = new Vect3d();
vForward = new Vect3d();
vRight = new Vect3d();
vUpward = new Vect3d();

AngleVectors();
vLocal = SubVectorDist(WorldLocation, mypos);

vTransForm.x = vLocal.dotproduct(vRight);
vTransForm.y = vLocal.dotproduct(vUpward);
vTransForm.z = vLocal.dotproduct(vForward);

if (vTransForm.z < 0.01)
return false;

ScreenX = screencenter[0] + (screencenter[0] / vTransForm.z * (1 / fov[0])) * vTransForm.x;
ScreenY = screencenter[1] - (screencenter[1] / vTransForm.z * (1 / fov[1])) * vTransForm.y;

return true;
}

/// <summary>
/// One of Kn4cker's functions, this beauty does all our complex maths
/// if you want to know more about it get very comfortable with Pythagora
/// </summary>
private void AngleVectors()
{
float angle;
float sr, sp, sy, cr, cp, cy, 
cpi = (3.141f * 2 / 360);

angle = viewAngles.y * cpi;
//cpi = same view angles.x isn't

sy = (float)Math.Sin(angle);
cy = (float)Math.Cos(angle);
angle = viewAngles.x * cpi;
sp = (float)Math.Sin(angle);
cp = (float)Math.Cos(angle);
angle = viewAngles.z * cpi;
sr = (float)Math.Sin(angle);
cr = (float)Math.Cos(angle);

vForward.x = cp * cy;
vForward.y = cp * sy;
vForward.z = -sp;

vRight.x = (-1 * sr * sp * cy + -1 * cr * -sy);
vRight.y = (-1 * sr * sp * sy + -1 * cr * cy);
vRight.z = -1 * sr * cp;

vUpward.x = (cr * sp * cy + -sr * -sy);
vUpward.y = (cr * sp * sy + -sr * cy);
vUpward.z = cr * cp;
}
#endregion


}
}
всем пока

:sps:
Ушел на неоприделенный срок , вернусь незнаю когда.

правдо код не новый ну думаю каму надо подгонят
:sps:

правдо код не новый ну думаю каму надо подгонят
:sps:
Его нужно сильно переделывать и обход новый писать , кто захочет тот возьмет.
Ушел на неоприделенный срок , вернусь незнаю когда.

еще бы на варфейс выложили такойже код что бы некоторые личности не выеб.....
Skype: vik1234512345

еще бы на варфейс выложили такойже код что бы некоторые личности не выеб.....
если чесно его и на варфэйс подогнать можно это просто код для трени брал на зарубежном сайте а кто там выёпываеться там и выёпываться некому кроме крайслера и ещё пару человек :biggrin:
Сообщений: 6 Страница 1 из 1 Страница 1 из 1

Кто сейчас на форуме

Сейчас этот форум просматривают: 1 и гости: 0

Показать больше...