0x32789
Expert
Hi guys! I am trying to make a GTA IV Hack but I faced a problem while doing..
(I dont know alot about Memory so please dont judge me by that)
So in this I am trying to read firetype of weapon id 20(idk if I am reading of 32 or 20, But please correct me) in a array located at GTAIV.exe+0x1540A20,
Here is some info regarding the array
and this info regarding weapon ids and fire type
Correct me
(I dont know alot about Memory so please dont judge me by that)
Code:
while(true)
{
int value = 65534;
if(ReadProcessMemory(GTAIV.ProcessHandle, (LPCVOID)(GTAIV.BaseAddress+0x1540A20), &value, sizeof(value), NULL))
{
value += 0x20;
int value3 = 65534;
if(ReadProcessMemory(GTAIV.ProcessHandle, (LPCVOID)value, &value3, sizeof(value3), NULL))
{
value3 += 0x8;
int value2 = 65534;
if(ReadProcessMemory(GTAIV.ProcessHandle, (LPCVOID)value3, &value2, sizeof(value2), NULL))
{
sprintf_s(iStr, "Val: %d (0x%08X)", value2, value2);
print(iStr);
/*
WriteProcessMemory(GTAIV.ProcessHandle, (void*)address[2], &value, sizeof(value), NULL);*/
Sleep(18000);
}
else
{
print("FAILED TO READ X2");
}
}
else
{
print("FAILED TO READ X1");
}
}
else
{
print("FAILED TO READ X0");
}
}
CloseHandle(GTAIV.ProcessHandle);
Here is some info regarding the array
CWeaponInfo
See List_of_Weapons_(GTA4) for the arrays referred to in the struct.
Array of CWeaponInfo's can be found at GTAIV.exe+0x1540A20 (1.0.7.0).
[font=monospace, Courier]CWeaponInfo g_weaponInfos[60];
[/font]
NOTE: work in progress
[font=monospace, Courier]class CWeaponInfo // size: 0x110 (1.0.7.0)
{
// weapontype (index of array element)
int weapontype; // 0x0 | 0
// slottype (index of array element)
int slot; // 0x4 | 4
// firetype (index of array element)
int firetype; // 0x8 | 8
// damagetype (index of array element)
int damagetype; // 0xC | 12
// group (index of array element)
int group; // 0x10 | 16
float targetrange; // 0x14 | 20
float weaponrange; // 0x18 | 24
int stattype; // 0x1C | 28
// Weaponflags stored as bitflags. Refer to corresponding array. (if n-th bit is 1, array element n is true)
DWORD weaponflags; // 0x20 | 32
DWORD modelhash; // 0x24 | 36
float aimaccuracy; // 0x34 | 52
float aimaccuracyfps; // 0x38 | 52
float offset_x; // 0x40 | 64
float offset_y; // 0x44 | 68
float offset_z; // 0x48 | 72
float crouchoffset_x; // 0x50 | 80
float crouchoffset_y; // 0x54 | 84
float crouchoffset_z; // 0x58 | 88
float reticule_standing; // 0x64 | 100
float reticule_ducked; // 0x68 | 104
float reticule_scale; // 0x6C | 108
int rumbleduration; // 0x70 | 112
float rumbleintensity; // 0x74 | 116
int pickup_regentime; // 0x78 | 120
short pickup_ammoonstreet; // 0x80 | 124
// damage:
short damage; // 0x82 | 130
short damagefps; // 0x84 | 132
short clipsize // 0x86 | 132
short ammomax; // 0x88 | 136
int timebetweenshots; // 0x8C | 140
float physicsforce; // 0x90 | 144
int reloadtime_normal; // 0x94 | 150
int reloadtime_fast; // 0x98 | 154
int reloadtime_crouch; // 0x9C | 160
int projectiletype; // 0xA0
int projectilefusetime; // 0xA4
float projectilephysicsexplodeimpactthreshold // 0xD0
float projectilephysicsexplodeimpactwithvehiclethreshold // 0xD4
float projectilephysicsvehiclevelocity // 0xD8
// damage, continued:
float networkplayermod; // 0xF0 | 240
float networkpedmod; // 0xF4 | 244
float aimingaccuracytime; // 0xF8
int aimingpellets; // 0xFC
};[/font]
and this info regarding weapon ids and fire type
I want to read that memory and I dont know how should I do, I think I am doing something wrong thats why I fail to read it?List of weapons
[hide]ID
Name0
UNARMED
1
BASEBALLBAT
2
POOLCUE
3
KNIFE
4
GRENADE
5
MOLOTOV
6
ROCKET
7
PISTOL
8
UNUSED0
9
DEAGLE
10
SHOTGUN
11
BARETTA
12
MICRO_UZI
13
MP5
14
AK47
15
M4
16
SNIPERRIFLE
17
M40A1
18
RLAUNCHER
19
FTHROWER
20
MINIGUN
21
EPISODIC_1
22
EPISODIC_2
23
EPISODIC_3
24
EPISODIC_4
25
EPISODIC_5
26
EPISODIC_6
27
EPISODIC_7
28
EPISODIC_8
29
EPISODIC_9
30
EPISODIC_10
31
EPISODIC_11
32
EPISODIC_12
33
EPISODIC_13
34
EPISODIC_14
35
EPISODIC_15
36
EPISODIC_16
37
EPISODIC_17
38
EPISODIC_18
39
EPISODIC_19
40
EPISODIC_20
41
EPISODIC_21
42
EPISODIC_22
43
EPISODIC_23
44
EPISODIC_24
45
CAMERA
46
OBJECT
47
WEAPONTYPE_LAST_WEAPONTYPE
48
ARMOUR
49
RAMMEDBYCAR
50
RUNOVERBYCAR
51
EXPLOSION
52
UZI_DRIVEBY
53
DROWNING
54
FALL
55
UNIDENTIFIED
56
ANYMELEE
57
ANYWEAPON
List of weapon fire types
[hide]ID
Name0
MELEE
1
INSTANT_HIT
2
DELAYED_HIT
3
PROJECTILE
4
AREA_EFFECT
5
CAMERA
6
USE
7
UNKNOWN
Correct me