|
You last visited: Today at 23:27
Advertisement
Warrock - Code Snippets
Discussion on Warrock - Code Snippets within the WarRock forum part of the Shooter category.
10/02/2012, 15:54
|
#376
|
elite*gold: 0
Join Date: Sep 2012
Posts: 35
Received Thanks: 0
|
Please Source MemPatch and OPK Player
|
|
|
10/02/2012, 17:50
|
#377
|
elite*gold: 297
Join Date: Dec 2010
Posts: 1,129
Received Thanks: 1,687
|
Here you go with your memory class which is able to restore a saved value. Easily extendable.
mempatch.h
Code:
#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();
};
mempatch.cpp
Code:
#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;
}
|
|
|
10/03/2012, 15:41
|
#378
|
elite*gold: 0
Join Date: Mar 2012
Posts: 281
Received Thanks: 158
|
#request Speed,GlassWalls,HeadShot Source?
|
|
|
10/03/2012, 19:04
|
#379
|
elite*gold: 0
Join Date: Sep 2012
Posts: 35
Received Thanks: 0
|
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?)
|
|
|
10/03/2012, 19:38
|
#380
|
elite*gold: 0
Join Date: Jul 2012
Posts: 1,426
Received Thanks: 1,370
|
Quote:
Originally Posted by ignorehax
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?)
|
is not to copy and paste it will be seen that you have no idea of just c++ learn c + + the source work perfect.
|
|
|
10/03/2012, 21:43
|
#381
|
elite*gold: 1
Join Date: Aug 2009
Posts: 183
Received Thanks: 11
|
Thanks of this thread realy useful
|
|
|
10/04/2012, 00:23
|
#382
|
elite*gold: 297
Join Date: Dec 2010
Posts: 1,129
Received Thanks: 1,687
|
Quote:
Originally Posted by ignorehax
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:
Originally Posted by ~ExoduS~*
is not to copy and paste it will be seen that you have no idea of just c++ learn c + + the source work perfect.
|
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.
Basically the source is taken out of some old code in my project, but I removed some enhancements to it which would not be needed anyways. I don't think any of you guys will need initWithReferencedObject anyways, but it is the only extension I decided not to delete from the class (as it's basic stuff anyways).
If you guys prefer using constructor code you may also rename initWithAddressedMemory to mempatch (to make it the public constructor with 2 arguments), delete initWithReferencedObject and then add an empty destructor ~mempatch.
|
|
|
10/04/2012, 17:36
|
#383
|
elite*gold: -19
Join Date: Sep 2012
Posts: 108
Received Thanks: 28
|
request
glasswall (adr v.)
nospawnwait (my v. dont work :/)
|
|
|
10/04/2012, 17:52
|
#384
|
elite*gold: 0
Join Date: Mar 2012
Posts: 288
Received Thanks: 296
|
GlassWall ,
On = 4
Off = 0
*(INT*) Addy = 4;
NoSpawnWait
*(FLOAT*) Addy = 0;
|
|
|
10/04/2012, 18:05
|
#385
|
elite*gold: -19
Join Date: Sep 2012
Posts: 108
Received Thanks: 28
|
Quote:
Originally Posted by Pu3Mi2o
GlassWall ,
On = 4
Off = 0
*(INT*) Addy = 4;
NoSpawnWait
*(FLOAT*) Addy = 0;
|
hab ich beides genau so.
gehen beide nicht.
edit: war ein scriptfehler^^
edit2:
PHP Code:
#define ADR_WTW 0x00862C48
if (WTW == 1) { *(float*)(ADR_WTW) = -999; } else { *(float*)(ADR_WTW) = 6; }
CRASH AFTER JOIN! :/
|
|
|
10/04/2012, 22:02
|
#386
|
elite*gold: 1
Join Date: Oct 2011
Posts: 1,117
Received Thanks: 1,520
|
Quote:
Originally Posted by FamousBrothers
hab ich beides genau so.
gehen beide nicht.
edit: war ein scriptfehler^^
edit2:
PHP Code:
#define ADR_WTW 0x00862C48
if (WTW == 1)
{
*(float*)(ADR_WTW) = -999;
}
else
{
*(float*)(ADR_WTW) = 6;
}
CRASH AFTER JOIN! :/
|
Checke die Addy noch einmal und versuche es mit Mempatch
|
|
|
10/05/2012, 09:55
|
#387
|
elite*gold: -19
Join Date: Sep 2012
Posts: 108
Received Thanks: 28
|
Quote:
Originally Posted by CyberVeezy :)
Checke die Addy noch einmal und versuche es mit Mempatch
|
Habs mit mempatch versucht.
Kann nur in eine wand glitchen aber nicht durch^^
|
|
|
10/05/2012, 13:52
|
#388
|
elite*gold: 0
Join Date: Sep 2012
Posts: 44
Received Thanks: 58
|
Code:
if ( cPlayer.WTW == 1 )
{
WriteMEM<float>((void*)ADR_WTW,-3);
}
else
{
WriteMEM<float>((void*)ADR_WTW,6);
}
|
|
|
10/05/2012, 14:46
|
#389
|
elite*gold: 31
Join Date: Oct 2011
Posts: 2,276
Received Thanks: 2,029
|
Code:
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++;
}
}
|
|
|
10/05/2012, 15:52
|
#390
|
elite*gold: -19
Join Date: Sep 2012
Posts: 108
Received Thanks: 28
|
Quote:
Originally Posted by .Kha'Zix.
Code:
if ( cPlayer.WTW == 1 )
{
WriteMEM<float>((void*)ADR_WTW,-3);
}
else
{
WriteMEM<float>((void*)ADR_WTW,6);
}
|
geht auch nicht,
hab als value -9999998.0175 genommen,
klappt besser.
Falls ihr diese Value benutzt
währen credits nett! ich hab 3 stunden drann gessessen
______________________________________
Wie definiert man p_Player?
|
|
|
Similar Threads
|
WarRock EU - Code Snippets
07/12/2012 - WarRock - 7490 Replies
Hi Leute,
in diesem Thread könnt ihr:
-> Nach Sourcecodes fragen(Beispiel unten)
-> Eure Sourcecodes posten(Wenn sie nicht von euch sind mit Credits!)
-> Fragen ob eure Source evtl. einen Fehler hat
-> Fragen was welcher Fehler bedeuted
-> Sourcecodes entnehmen(Bitte beim Release dann Credits angeben!)
|
All times are GMT +1. The time now is 23:27.
|
|