for some reason, I can't seem to get the local player coords?
I always seem to get 970.0 for the Y and 0.0 for the x
yet, I can get the coords for all the other players just fine!
here's a snippet of code I've writtent just for pulling back the local player coords.
Could someone point out my mistake?
Code:
public void FindLocalPlayer()
{
var localPlayerAddress = GetAddress(0xDFCDD8, 0X13A8, 0X4);
var localCoordsBaseAddress = (localPlayerAddress + 0x18);
var localX = mem.ReadFloat(localCoordsBaseAddress + 0x28);
var localY = mem.ReadFloat(localCoordsBaseAddress + 0x30);
var localZ = mem.ReadFloat(localCoordsBaseAddress + 0x2C);
var localXDir = mem.ReadFloat(localCoordsBaseAddress + 0x1C);
var localYDir = mem.ReadFloat(localCoordsBaseAddress + 0x24);
}
private int GetAddress(params int[] offsets)
{
int address = 0;
foreach (var offset in offsets)
{
address = mem.ReadInt(address + offset);
}
return address;
}
Edit:
Nevermind.. I was being a div!
Here's the "right" code just incase anyone else stumbles on the same issue (unlikely):
Code:
public void FindLocalPlayer()
{
var localPlayerAddress = GetAddress(0xDFCDD8, 0X13A8, 0X4);
var localCoordsBaseAddress = mem.ReadInt(localPlayerAddress + 0x18);
var localX = mem.ReadFloat(localCoordsBaseAddress + 0x28);
var localY = mem.ReadFloat(localCoordsBaseAddress + 0x30);
var localZ = mem.ReadFloat(localCoordsBaseAddress + 0x2C);
var localXDir = mem.ReadFloat(localCoordsBaseAddress + 0x1C);
var localYDir = mem.ReadFloat(localCoordsBaseAddress + 0x24);
}
private int GetAddress(params int[] offsets)
{
int address = 0;
foreach (var offset in offsets)
{
address = mem.ReadInt(address + offset);
}
return address;
}
---------- Post added at 05:39 AM ---------- Previous post was at 04:08 AM ----------
There's a typo on this line (for finding weapon names):
Code:
weaponNameAddress: Player + 694] + (0x24 * weaponID + 8)] + 0x10] + 4]
I believe it should read:
Code:
weaponNameAddress: Player + 0x694] + (0x24 * weaponID + 8)] + 0x10] + 4]
---------- Post added at 06:06 AM ---------- Previous post was at 05:39 AM ----------
I'd also say this:
Code:
PlayerSkinStringAddress: player + 0x3C] + 0x30] + 0x8]
should be this:
Code:
PlayerSkinStringAddress: player + 0x3C] + 0x30]
and then you can read it like any other string:
Code:
PlayerSkinStringLength: PlayerSkinStringAddress + 0x4
PlayerSkinString: PlayerSkinStringAddress + 0x8
ps - I'm not knocking the tut btw - it's precisely what I wanted and I'm learning a shit-tonne from it so thanks for that.
I just want to help out anyone help out anyone else who is following it and gets stuck / confused by it
---------- Post added at 06:36 AM ---------- Previous post was at 06:06 AM ----------
Could I suggest this bit be cleared up a little?
From this:
Code:
To get the player name, first we have to get the NameID. Things like vehicles or AI will have a NameID of 1, which means their only name is stored in their entity struct at:
Code:
GenericName: entity + 0xAC8].
If their name is !=1 and >0, then we can get their name from the scoreboard
to maybe this:
...To get the player name, first we have to get the NameID:
Code:
NameID: entity + 0xAC8]
Things like vehicles or AI will have a NameID of 1, which means their only name is stored in their entity struct, which we can find a pointer to at this address:
Code:
NameStringAddress: entity + 0xA20
which can then be read like any other string
Code:
NameStringLength: NameStringAddress + 0x4
NameString: NameStringAddress + 0x8
If their name is !=1 and >0, then we can get their name from the scoreboard...