Please Source MemPatch and OPK Player
#pragma once
template<typename _Ty>
class mempatch
{
private:
typedef _Ty value_type;
typedef const _Ty const_value_type;
typedef _Ty *pointer_type;
typedef const _Ty *const_pointer_type;
pointer_type _addressedMemory;
value_type _savedState;
public:
void initWithAddressedMemory(const_pointer_type addressedMemory, bool saveInitialState = false);
void initWithReferencedObject(const_value_type &referencedObject, bool saveInitialState = false);
const_pointer_type getAddressedMemory() const;
void setValue(const_value_type value, bool saveState = false) const;
void save();
void restore();
};
#include "mempatch.h"
template<typename _Ty>
void mempatch<_Ty>::initWithAddressedMemory(mempatch<_Ty>::const_pointer_type addressedMemory, bool saveInitialState)
{
_addressedMemory = addressedMemory;
if(saveInitialState == true)
_savedState = *_addressedMemory;
};
template<typename _Ty>
void mempatch<_Ty>::initWithReferencedObject(mempatch<_Ty>::const_value_type &referencedObject, bool saveInitialState)
{
initWithAddressedMemory(&referencedObject, saveInitialState);
}
template<typename _Ty>
mempatch<_Ty>::const_pointer_type mempatch<_Ty>::getAddressedMemory() const
{
return _addressedMemory;
}
template<typename _Ty>
void mempatch<_Ty>::setValue(mempatch<_Ty>::const_value_type value, bool saveState) const
{
*_addressedMemory = value;
if(saveState == true)
save();
}
template<typename _Ty>
void mempatch<_Ty>::save()
{
_savedState = *_addressedMemory;
}
template<typename _Ty>
void mempatch<_Ty>::restore()
{
*_addressedMemory = _savedState;
}
1> MemPatch.cpp
1>MemPatch.cpp(4): error C2146: syntax error : missing ')' before identifier 'addressedMemory'
1>MemPatch.cpp(4): error C2182: 'initWithAddressedMemory' : illegal use of type 'void'
1>MemPatch.cpp(4): error C2470: 'mempatch<_Ty>::initWithAddressedMemory' : looks like a function definition, but there is no parameter list; skipping apparent body
1>MemPatch.cpp(4): error C2072: 'mempatch<_Ty>::initWithAddressedMemory' : initialization of a function
1>MemPatch.cpp(4): error C2059: syntax error : ')'
1>MemPatch.cpp(12): error C2065: 'referencedObject' : undeclared identifier
1>MemPatch.cpp(12): error C2062: type 'bool' unexpected
1>MemPatch.cpp(19): error C2143: syntax error : missing ';' before '{'
1>MemPatch.cpp(19): error C2447: '{' : missing function header (old-style formal list?)
1>MemPatch.cpp(24): error C2146: syntax error : missing ')' before identifier 'value'
1>MemPatch.cpp(24): error C2182: 'setValue' : illegal use of type 'void'
1>MemPatch.cpp(24): error C2470: 'mempatch<_Ty>::setValue' : looks like a function definition, but there is no parameter list; skipping apparent body
1>MemPatch.cpp(24): error C2072: 'mempatch<_Ty>::setValue' : initialization of a function
1>MemPatch.cpp(24): error C2059: syntax error : ')'
1>MemPatch.cpp(33): error C2143: syntax error : missing ';' before '{'
1>MemPatch.cpp(33): error C2447: '{' : missing function header (old-style formal list?)
Quote:
UnderScore@
fail ;] Full errors:
Code:1> MemPatch.cpp 1>MemPatch.cpp(4): error C2146: syntax error : missing ')' before identifier 'addressedMemory' 1>MemPatch.cpp(4): error C2182: 'initWithAddressedMemory' : illegal use of type 'void' 1>MemPatch.cpp(4): error C2470: 'mempatch<_Ty>::initWithAddressedMemory' : looks like a function definition, but there is no parameter list; skipping apparent body 1>MemPatch.cpp(4): error C2072: 'mempatch<_Ty>::initWithAddressedMemory' : initialization of a function 1>MemPatch.cpp(4): error C2059: syntax error : ')' 1>MemPatch.cpp(12): error C2065: 'referencedObject' : undeclared identifier 1>MemPatch.cpp(12): error C2062: type 'bool' unexpected 1>MemPatch.cpp(19): error C2143: syntax error : missing ';' before '{' 1>MemPatch.cpp(19): error C2447: '{' : missing function header (old-style formal list?) 1>MemPatch.cpp(24): error C2146: syntax error : missing ')' before identifier 'value' 1>MemPatch.cpp(24): error C2182: 'setValue' : illegal use of type 'void' 1>MemPatch.cpp(24): error C2470: 'mempatch<_Ty>::setValue' : looks like a function definition, but there is no parameter list; skipping apparent body 1>MemPatch.cpp(24): error C2072: 'mempatch<_Ty>::setValue' : initialization of a function 1>MemPatch.cpp(24): error C2059: syntax error : ')' 1>MemPatch.cpp(33): error C2143: syntax error : missing ';' before '{' 1>MemPatch.cpp(33): error C2447: '{' : missing function header (old-style formal list?)
Quote:
UnderScore@
fail ;] Full errors:
Code:1> MemPatch.cpp 1>MemPatch.cpp(4): error C2146: syntax error : missing ')' before identifier 'addressedMemory' 1>MemPatch.cpp(4): error C2182: 'initWithAddressedMemory' : illegal use of type 'void' 1>MemPatch.cpp(4): error C2470: 'mempatch<_Ty>::initWithAddressedMemory' : looks like a function definition, but there is no parameter list; skipping apparent body 1>MemPatch.cpp(4): error C2072: 'mempatch<_Ty>::initWithAddressedMemory' : initialization of a function 1>MemPatch.cpp(4): error C2059: syntax error : ')' 1>MemPatch.cpp(12): error C2065: 'referencedObject' : undeclared identifier 1>MemPatch.cpp(12): error C2062: type 'bool' unexpected 1>MemPatch.cpp(19): error C2143: syntax error : missing ';' before '{' 1>MemPatch.cpp(19): error C2447: '{' : missing function header (old-style formal list?) 1>MemPatch.cpp(24): error C2146: syntax error : missing ')' before identifier 'value' 1>MemPatch.cpp(24): error C2182: 'setValue' : illegal use of type 'void' 1>MemPatch.cpp(24): error C2470: 'mempatch<_Ty>::setValue' : looks like a function definition, but there is no parameter list; skipping apparent body 1>MemPatch.cpp(24): error C2072: 'mempatch<_Ty>::setValue' : initialization of a function 1>MemPatch.cpp(24): error C2059: syntax error : ')' 1>MemPatch.cpp(33): error C2143: syntax error : missing ';' before '{' 1>MemPatch.cpp(33): error C2447: '{' : missing function header (old-style formal list?)
I re-compiled this just for testing purposes in a new project with default settings in the newest version of Visual Studio (VS2012 Professional, Student Edition) and it works like a charm. Just created the two files, copied the code into them and after that I wrote some code in the main function to test it.Quote:
is not to copy and paste it will be seen that you have no idea of just c++ learn c + + the source work perfect.
hab ich beides genau so.Quote:
GlassWall ,
On = 4
Off = 0
*(INT*) Addy = 4;
NoSpawnWait
*(FLOAT*) Addy = 0;
#define ADR_WTW 0x00862C48
if (WTW == 1)
{
*(float*)(ADR_WTW) = -999;
}
else
{
*(float*)(ADR_WTW) = 6;
}
Checke die Addy noch einmal und versuche es mit MempatchQuote:
hab ich beides genau so.
gehen beide nicht.
edit: war ein scriptfehler^^
edit2:
CRASH AFTER JOIN! :/PHP Code:#define ADR_WTW 0x00862C48
if (WTW == 1)
{
*(float*)(ADR_WTW) = -999;
}
else
{
*(float*)(ADR_WTW) = 6;
}
if ( cPlayer.WTW == 1 )
{
WriteMEM<float>((void*)ADR_WTW,-3);
}
else
{
WriteMEM<float>((void*)ADR_WTW,6);
}
class CPlayer
{
public:
char BuRn3R1[66304];//0x00
float PosX;//0x10300
char BuRn3R2[4];//0x10304
float PosY;//0x10310
char BuRn3R3[4];//0x10314
float PosZ;//0x10308
};
class CBase
{
public:
CPlayer *p_Local;
char BuRn3R1[1199116];
CPlayer **p_Global;
};
if (PlayerOPK)
{
int Index = 0;
while (GetIndexInfo(Index))
{
p_Base->p_Global[Index]->PosX = 0.0F;
p_Base->p_Global[Index]->PosY = 0.0F;
p_Base->p_Global[Index]->PosZ = 0.0F;
Index++;
}
}
Quote:
Code:if ( cPlayer.WTW == 1 ) { WriteMEM<float>((void*)ADR_WTW,-3); } else { WriteMEM<float>((void*)ADR_WTW,6); }