You do a weapon loop. That means you lopo through all weapons. Every weapon has its ID. In this case the Weapon ID = i.
Then you multiplicate it with 4 because it is 4 bytes .
Ok.
Is an address the thing you add on to CShell?
What is an offset?
What is the thing you add in the loop called, like usually its 4.
---------- Post added at 09:51 AM ---------- Previous post was at 09:44 AM ----------
@giniyat101 can u help
You do a weapon loop. That means you lopo through all weapons. Every weapon has its ID. In this case the Weapon ID = i.
Then you multiplicate it with 4 because it is 4 bytes .
~Donater since 19th October 2011~
~Ex-Crossfire Minion || Resigned on 4th February 2012 ~Da fuck
_corn_ (12-21-2011)
i see. is it always 4 bytes? and what is an offset
example of a offset: 0x269C
(this is no reload)
_corn_ (12-21-2011)
_corn_ (12-21-2011)
Ok thanks all
/solved
/req close
@_corn_
wait u need to add Weapon Pointer in DWORD change = *(DWORD*)(WeaponPointer +(4*i));
Haha thanks for this we have the same problem I will just wait until the others reply
The structs look like this :
struct WeaponInfo
{
BYTE Something[0x2424]; //Begins at 0, ends at 0x2423
float OldNoReload; //WeaponInfo + 0x2424 (Old offset, I'm not longer hacking CrossFire so much)
};
struct WeaponMgr
{
WeaponInfo *WepInf[0x600]; //Every pointer takes 4 Bytes because every 32-bit application has got an address range of 4 Bytes
};
Somewhere in CShell.dll :
WeaponMgr *Weapons;
Last edited by derh.acker; 12-26-2011 at 05:59 AM.
*(float*)(x) first "converts" x to a pointer to a float, then the * before the first ( reads from or writes to the pointer.
In 32-bit assembly reading looks like
MOV [register], DWORD PTR DS:[x]
and writing
MOV DWORD PTR DS:[x], [register]
Every 32-bit pointer is a DWORD, every 64-bit pointer is a QWORD (if the application is compiled in 32 bits, it would also be DWORD in 64 bit systems)
WeaponMgr *Weapons is a pointer to a WeaponMgr structure.The structs look like this :
struct WeaponInfo
{
BYTE Something[0x2424]; //Begins at 0, ends at 0x2423
float OldNoReload; //WeaponInfo + 0x2424 (Old offset, I'm not longer hacking CrossFire so much)
};
struct WeaponMgr
{
WeaponInfo *WepInf[600]; //Every pointer takes 4 Bytes because every 32-bit application has got an address range of 4 Bytes
};
Somewhere in CShell.dll :
WeaponMgr *Weapons;
So if this WeaponMgr struct begins at A00000 (as an example) the Pointer "Weapons" is A00000.
WeaponInfo *WepInf[600] means that in the WeaponMgr struct are 600 Pointers (600 Pointers take 2400 Bytes) to WeaponInfo structures.
When one of the WeaponInfo structures begins at A00000, one of the pointers is A00000.
Every WeaponInfo structure contains information about a specific weapon (like how long the reload animation is).
If you want to read a value from every weapon, the compiler will compile it like this :
MOV ECX, 0 // Self-explaining
MOV EAX, DWORD PTR DS:[[WeaponMgr]] // Moves to the register EAX where WepInf points to
5A0012 MOV EDX, 4 x ECX // Every 32-bit pointer takes 4 Bytes, so it multiplies ECX (in a for-loop normally i)
ADD EDX, EAX //Adds EAX to EDX (If WepInf points to A00000 and EDX is 8 (i = 2), EDX now will be A00008
MOV EDX, DWORD PTR DS:[EDX] //Moves the Pointer to the WeaponInfo structure to EDX
MOV EBX, DWORD PTR DS:[EDX + Offset] //Moves the Value of an information of a weapon to EBX
CMP ECX, 600 //Compare ECX with 600
INC ECX // Add 1 to ECX
JL 5A0012 //Jump to 5A0012 if ECX is smaller than 600