Hey Infestationcoder :P
I really need help from you.
I have this code to draw red dots for player, and white dots for vehicles:
Code:
void Draw(){
//=======================================================================
//Local Player
//=======================================================================
DWORD LocalPlayerAddress;
D3DXVECTOR3 LocalPlayerPos;
LocalPlayerAddress = memory.read<DWORD>(GetGame() + LocalPlayerOffset);
LocalPlayerAddress ^= LocalPlayerXOR;
LocalPlayerPos = memory.read<D3DXVECTOR3 >(LocalPlayerAddress + locationAddress);
//=======================================================================
//Objects + Zombies
//=======================================================================
CGameWorld gw = memory.read<CGameWorld>(GetGameWorld());
int maxObjects = gw.GetMaxObjects();
for(int x = 0; x < maxObjects; x++){
D3DCOLOR color = NULL;
DWORD objAddress = memory.read<int>(gw.GetObject(x));
D3DXVECTOR3 pvPos = memory.read<D3DXVECTOR3 >(objAddress + locationAddress);
D3DXVECTOR3 pvOut;
if(300 >= getDistance(LocalPlayerPos, pvPos)){
if(World2Screen(pvPos, &pvOut)){
if (memory.read<int>(objAddress + ObjectManagerID) == PLAYER)
DrawFilledBox(pvOut.x, pvOut.y, 4, 4, 204, 46, 46, 200);
else if (memory.read<int>(objAddress + ObjectManagerID) == OBJTYPE_VEHICLE)
DrawFilledBox(pvOut.x, pvOut.y, 4, 4, 204, 255, 255, 255);
}
}
}
Its working.
But now, i want to draw a box instead of the FilledBox.
So i made this:
Code:
void DrawPlayerBox(int x, int y, int w, int h, int borderPx, int r, int g, int b, int a) {
DrawFilledBox(x - (w / 2), (y - h + borderPx), w, borderPx, r, g, b, a); //bottom
DrawFilledBox(x - (w / 2), (y - h + borderPx), borderPx, h, r, g, b, a); //left
DrawFilledBox(x - (w / 2), y, w, borderPx, r, g, b, a); //top
DrawFilledBox((x + w - borderPx) - (w / 2), (y - h + borderPx), borderPx, h, r, g, b, a);//right
}
And changed the code below to:
Code:
void Draw(){
//=======================================================================
//Local Player
//=======================================================================
DWORD LocalPlayerAddress;
D3DXVECTOR3 LocalPlayerPos;
LocalPlayerAddress = memory.read<DWORD>(GetGame() + LocalPlayerOffset);
LocalPlayerAddress ^= LocalPlayerXOR;
LocalPlayerPos = memory.read<D3DXVECTOR3 >(LocalPlayerAddress + locationAddress);
//=======================================================================
//Objects + Zombies
//=======================================================================
CGameWorld gw = memory.read<CGameWorld>(GetGameWorld());
int maxObjects = gw.GetMaxObjects();
for(int x = 0; x < maxObjects; x++){
D3DCOLOR color = NULL;
DWORD objAddress = memory.read<int>(gw.GetObject(x));
D3DXVECTOR3 pvPos = memory.read<D3DXVECTOR3 >(objAddress + locationAddress);
D3DXVECTOR3 pvOut;
if(300 >= getDistance(LocalPlayerPos, pvPos)){
if(World2Screen(pvPos, &pvOut)){
if (memory.read<int>(objAddress + ObjectManagerID) == PLAYER)
float dx = LocalPlayerPos.x - pvPos.x;
float dy = LocalPlayerPos.y - pvPos.y;
float dz = LocalPlayerPos.z - pvPos.z;
float DistancePlayer = (float)sqrt((dx * dx) + (dy * dy) + (dz * dz));
float fWidth = (60.0f * 15.0f) / DistancePlayer;
float fHeight = (100.0f * 15.0f) / DistancePlayer;
float fHeightMod = (500.0f / DistancePlayer);
DrawPlayerBox(pvOut.x, pvOut.y, fWidth, fHeight, 1, 0, 204, 0, 255);
else if (memory.read<int>(objAddress + ObjectManagerID) == OBJTYPE_VEHICLE)
DrawFilledBox(pvOut.x, pvOut.y, 4, 4, 204, 255, 255, 255);
}
}
}
But now ALL objects ingame are shown as a Box. Zombies, Player and Vehicles.
I saw this:
Code:
CGameWorld gw = memory.read<CGameWorld>(GetGameWorld());
This could be the reason why it shows me all objects, but then i dont know why the red dot only shows me the player..
Okay. Now i have this region in code which is made ONLY for player:
Code:
ClientGame gc = memory.read<ClientGame>(GetGame());
for (int x = 0; x < 128; x++){
DWORD objAddress = (DWORD)gc.GetPlayerByIndex(x);
if (memory.read<int>(objAddress + ObjectManagerID) == PLAYER){
D3DXVECTOR3 pvPos = memory.read<D3DXVECTOR3 >(objAddress + locationAddress);
D3DXVECTOR3 pvOut;
if (World2Screen(pvPos, &pvOut)){
// Draw everything for the players here
float dx = LocalPlayerPos.x - pvPos.x;
float dy = LocalPlayerPos.y - pvPos.y;
float dz = LocalPlayerPos.z - pvPos.z;
float DistancePlayer = (float)sqrt((dx * dx) + (dy * dy) + (dz * dz));
float fWidth = (60.0f * 15.0f) / DistancePlayer;
float fHeight = (100.0f * 15.0f) / DistancePlayer;
float fHeightMod = (500.0f / DistancePlayer);
DrawPlayerBox(pvOut.x, pvOut.y, fWidth, fHeight, 1, 0, 204, 0, 255);
}
}
}
But if i do this, i don´t see anything, so the code isn´t working.
What is wrong with the second code which is made for player only?
And why do i see all objects with the PlayerBox, but only player with the red FilledBox?
Im German, so sorry for my bad English.
I hope you can help me
If you want to see it (Teamviewer) add me in skype: SawMister
Best regards, René