re: pluggin for a game

so when I upload this code to http://codepad.org it returned with this

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
bool __stdcall CS_Knife_s::bAutoKnife ( usercmd_s *cmd )
{
    cl_entity_s *ent;
    float flDistance = 32;
    int iEntity;
    pmtrace_t gVis;
    vec3_t vForward, vecEnd;

    gEngfuncs.pfnAngleVectors ( gClient.flAimAngles, vForward, NULL, NULL );

    for ( int iCount = 1; iCount <= 2; iCount++ )
    {
        vecEnd[0] = gClient.flEyePos[0] + vForward[0] * flDistance;
        vecEnd[1] = gClient.flEyePos[1] + vForward[1] * flDistance;
        vecEnd[2] = gClient.flEyePos[2] + vForward[2] * flDistance;

        gEngfuncs.pEventAPI->EV_SetTraceHull ( 2 );
        gEngfuncs.pEventAPI->EV_PlayerTrace ( gClient.flEyePos, vecEnd, PM_STUDIO_BOX, -1, &gVis );

        iEntity = gEngfuncs.pEventAPI->EV_IndexFromTrace ( &gVis );

        ent = gEngfuncs.GetEntityByIndex ( iEntity );
                
        if ( ent->player )
        {
            if ( Aimbot.bIsEnemy ( iEntity ) )
            {
                if ( iCount == 1 )
                {
                    cmd->buttons |= IN_ATTACK2;

                    return true;
                }
                else if ( iCount == 2 )
                {
                    cmd->buttons |= IN_ATTACK;

                    return true;
                }
            }
            else
            {
                if ( iCount == 2 )
                    return false;
            }
        }
        else
        {
            if ( iCount == 2 )
                return false;
        }

        flDistance += 16.0f;
    }

    return false;
}


Line 1: error: expected initializer before 'CS_Knife_s'
compilation terminated due to -Wfatal-errors.


and when I add offsets it returned with this

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
COffsets gOffsets;





bool COffsets::Initialize(void)
{
	ClBase = (DWORD)GetModuleHandle("client.dll");
	ClSize = (DWORD)0x00159000;
	
	HwBase = (DWORD)GetModuleHandle("hw.dll");
	HwSize = (DWORD)0x0122A000;
	
	if (!(ClBase && HwBase))
	{
		ClBase = HwBase = (DWORD)GetModuleHandle(NULL);
		ClSize = HwSize = (DWORD)0x02116000;
	}
	
	return (ClBase && HwBase);
}

void *COffsets::ClientFuncs(void)
{
	PCHAR String = "ScreenFade";
	DWORD Address = FindMemoryClone(HwBase, HwBase+HwSize, String, strlen(String));
	return (void*)*(DWORD*)(FindReference(HwBase, HwBase+HwSize, Address) + 0x13);
}

void *COffsets::EngineFuncs(void)
{
	PCHAR String = "ScreenFade";
	DWORD Address = FindMemoryClone(HwBase, HwBase+HwSize, String, strlen(String));
	return (void*)*(DWORD*)(FindReference(HwBase, HwBase+HwSize, Address) + 0x0D);
}

void *COffsets::EngineStudio(void)
{
	PCHAR String = "Couldn't get client .dll studio model rendering interface.";
	DWORD Address = FindMemoryClone(HwBase, HwBase+HwSize, String, strlen(String));
	return (void*)*(DWORD*)(FindReference(HwBase, HwBase+HwSize, Address) - 0x14);
}

void *COffsets::FOV(void)
{
	UCHAR Sig[] = "\xDB\x44\x24\x0C\x85\xFF\xD9\x54\x24\x0C\xD9\x1D\xFF\xFF\xFF\xFF\x75\x05\x89\x5E\x58\xEB\x03\x89\x7E\x58\x39\x5E\x58\x75\x16\xC7\x46\x18\x00\x00\x00\x00\x5F\x5E\xB8\x01\x00\x00\x00\x5B\x81\xC4\x08\x04\x00\x00\xC3";
	return (void*)*(DWORD*)(FindMemoryClone(ClBase, ClBase+ClSize, Sig, sizeof(Sig)-1) + 0x0C);
}

void *COffsets::GlobalTime(void)
{
	UCHAR Sig[] = "\x74\x47\xDD\x05\xFF\xFF\xFF\xFF\x51\x8D\x4C\x24\x08\xD9\x5C\x24\x04\xD9\x44\x24\x04\xD9\x1C\x24\x51\xFF\xD0\x83\xC4\x08\x85\xC0\x74\x27";
	return (void*)*(DWORD*)(FindMemoryClone(HwBase, HwBase+HwSize, Sig, sizeof(Sig)-1) + 0x04);
}

void *COffsets::PlayerMove(void)
{
	UCHAR Sig[] = "\xA1\xFF\xFF\xFF\xFF\x8B\x0D\xFF\xFF\xFF\xFF\x8B\x95\xFF\xFF\xFF\xFF\x8D\x74\x24\xFF";
	return (void*)**(DWORD**)(FindMemoryClone(HwBase, HwBase+HwSize, Sig, sizeof(Sig)-1) + 0x01);
}

void *COffsets::RefParams(void)
{
	UCHAR Sig[] = "\x53\x8B\x5C\x24\xFF\x56\x57\xB9\xFF\xFF\xFF\xFF\x8B\xF3\xBF\xFF\xFF\xFF\xFF\x68";
	return (void*)*(DWORD*)(FindMemoryClone(HwBase, HwBase+HwSize, Sig, sizeof(Sig)-1) + 0x0F);
}

void *COffsets::StudioModelRenderer(void)
{
	UCHAR Sig[] = "\x56\x8B\xF1\xE8\xFF\xFF\xFF\xFF\xC7\x06\xFF\xFF\xFF\xFF\xC6\x86\xFF\xFF\xFF\xFF\xFF\x8B\xC6\x5E\xC3";
	return (void*)*(DWORD*)(FindMemoryClone(ClBase, ClBase+ClSize, Sig, sizeof(Sig)-1) + 0x0A);
}

/* ___________________________________________________________________ */




class COffsets
{
private:
	DWORD ClBase, ClSize;
	DWORD HwBase, HwSize;

public:
	bool Initialize(void);
	void *ClientFuncs(void);
	void *EngineFuncs(void);
	void *EngineStudio(void);
	void *FOV(void);
	void *GlobalTime(void);
	void *PlayerMove(void);
	void *RefParams(void);
	void *StudioModelRenderer(void);
};

extern COffsets gOffsets;

/* _____________________________________________________________________ */


BOOL __comparemem(const UCHAR *buff1, const UCHAR *buff2, UINT size)
{
	for (UINT i = 0; i < size; i++, buff1++, buff2++)
	{
		if ((*buff1 != *buff2) && (*buff2 != 0xFF))
			return FALSE;
	}
	return TRUE;
}

ULONG __findmemoryclone(const ULONG start, const ULONG end, const ULONG clone, UINT size)
{
	for (ULONG ul = start; (ul + size) < end; ul++)
	{
		if (CompareMemory(ul, clone, size))
			return ul;
	}
	return NULL;
}

ULONG __findreference(const ULONG start, const ULONG end, const ULONG address)
{
	UCHAR Pattern[5];
	Pattern[0] = 0x68;
	*(ULONG*)&Pattern[1] = address;
	return FindMemoryClone(start, end, Pattern, sizeof(Pattern)-1);
}

/* ___________________________________________________________________ */




BOOL __comparemem(const UCHAR *buff1, const UCHAR *buff2, UINT size);
ULONG __findmemoryclone(const ULONG start, const ULONG end, const ULONG clone, UINT size);
ULONG __findreference(const ULONG start, const ULONG end, const ULONG address);

#define CompareMemory(Buff1, Buff2, Size) __comparemem((const UCHAR *)Buff1, (const UCHAR *)Buff2, (UINT)Size)
#define FindMemoryClone(Start, End, Clone, Size) __findmemoryclone((const ULONG)Start, (const ULONG)End, (const ULONG)Clone, (UINT)Size)
#define FindReference(Start, End, Address) __findreference((const ULONG)Start, (const ULONG)End, (const ULONG)Address)

/* ___________________________________________________________________ */





/* ___________________________________________________________________ */

bool __stdcall CS_Knife_s::bAutoKnife ( usercmd_s *cmd )
{
    cl_entity_s *ent;
    float flDistance = 32;
    int iEntity;
    pmtrace_t gVis;
    vec3_t vForward, vecEnd;

    gEngfuncs.pfnAngleVectors ( gClient.flAimAngles, vForward, NULL, NULL );

    for ( int iCount = 1; iCount <= 2; iCount++ )
    {
        vecEnd[0] = gClient.flEyePos[0] + vForward[0] * flDistance;
        vecEnd[1] = gClient.flEyePos[1] + vForward[1] * flDistance;
        vecEnd[2] = gClient.flEyePos[2] + vForward[2] * flDistance;

        gEngfuncs.pEventAPI->EV_SetTraceHull ( 2 );
        gEngfuncs.pEventAPI->EV_PlayerTrace ( gClient.flEyePos, vecEnd, PM_STUDIO_BOX, -1, &gVis );

        iEntity = gEngfuncs.pEventAPI->EV_IndexFromTrace ( &gVis );

        ent = gEngfuncs.GetEntityByIndex ( iEntity );
                
        if ( ent->player )
        {
            if ( Aimbot.bIsEnemy ( iEntity ) )
            {
                if ( iCount == 1 )
                {
                    cmd->buttons |= IN_ATTACK2;

                    return true;
                }
                else if ( iCount == 2 )
                {
                    cmd->buttons |= IN_ATTACK;

                    return true;
                }
            }
            else
            {
                if ( iCount == 2 )
                    return false;
            }
        }
        else
        {
            if ( iCount == 2 )
                return false;
        }

        flDistance += 16.0f;
    }

    return false;
}


Line 1: error: 'COffsets' does not name a type
compilation terminated due to -Wfatal-errors.




so what happened so compiler doesn't complains about the initializer before 'CS_Knife_s'

and where does coffset are






when I compile at cfree it doesn't matter with or without offsets it is always the same

[Error] *\Untitled1.cpp:1: syntax error before `::'
[Error] *\Untitled1.cpp:6: syntax error before `;'
[Error] *\Untitled1.cpp:7: syntax error before `,'
[Error] *\Untitled1.cpp:9: syntax error before `.'
[Error] *\Untitled1.cpp:11: syntax error before `<='
[Error] *\Untitled1.cpp:11: syntax error before `++'
[Error] *\Untitled1.cpp:14: ANSI C++ forbids declaration `vecEnd' with no type
[Error] *\Untitled1.cpp:14: `gClient' was not declared in this scope
[Error] *\Untitled1.cpp:14: `vForward' was not declared in this scope
[Error] *\Untitled1.cpp:15: ANSI C++ forbids declaration `vecEnd' with no type
[Error] *\Untitled1.cpp:15: conflicting types for `int vecEnd[2]'
[Error] *\Untitled1.cpp:14: previous declaration as `int vecEnd[1]'
[Error] *\Untitled1.cpp:15: `gClient' was not declared in this scope
[Error] *\Untitled1.cpp:15: `vForward' was not declared in this scope
[Error] *\Untitled1.cpp:17: syntax error before `.'
[Error] *\Untitled1.cpp:18: syntax error before `.'
[Error] *\Untitled1.cpp:20: ANSI C++ forbids declaration `iEntity' with no type
[Error] *\Untitled1.cpp:20: redefinition of `int iEntity'
[Error] *\Untitled1.cpp:5: `int iEntity' previously declared here
[Error] *\Untitled1.cpp:20: `gEngfuncs' was not declared in this scope
[Error] *\Untitled1.cpp:20: `gVis' was not declared in this scope
[Error] *\Untitled1.cpp:22: ANSI C++ forbids declaration `ent' with no type
[Error] *\Untitled1.cpp:22: `gEngfuncs' was not declared in this scope
[Error] *\Untitled1.cpp:24: parse error before `if'
[Error] *\Untitled1.cpp:53: syntax error before `+='


so why does the compiler output from http://codepad.org and cfree output are different






Topic archived. No new replies allowed.