Todo : Update Player Pointer Todo : Update CBase Reclass Todo : Update CPlayer Reclass Todo : Update Add PlayerOPKItem to your Menu
Todo : Try to understand the source by reading the Comments , If you just copy it , you will never be able to Create things yourself
Credits :
Code ( Cyno__™ )
Comments ( Cyno__™ )
Code:
int PlayerOPKItem = 0;
struct CPlayer
{
int index;
float X;
float Y;
float Z;
};
struct CBase
{
CPlayer * m_pLocalPlayer;
char GlobalPtr[123456];
CPlayer ** m_pGlobalPlayers;
};
unsigned long PlayerPointer = 0x0;
unsigned long __stdcall PlayerOPK ( void * lpParam )
{
UNREFERENCED_PARAMETER ( lpParam );// Ignore Unreferenced Parameter Warining
CBase * pBase = ( CBase * )(PlayerPointer);// Init our Reclass with the Original WR Class Pointer
bool bTeleportMyself = true; // Helper Var to Check if theres a new Round and we have to Teleport ourself
while ( true ) // Endless Loop
{
if ( PlayerOPKItem ) // Menu Items = On ?
{
if ( pBase->m_pLocalPlayer ) // Do we Live ?
{
if ( bTeleportMyself )// Do we need to Teleport us once ?
{
pBase->m_pLocalPlayer->X = 0.0f;// Set our X Pos to 0 ( once )
pBase->m_pLocalPlayer->Y = 0.0f;// Set our Y Pos to 0 ( once )
pBase->m_pLocalPlayer->Z = 0.0f;// Set our Z Pos to 0 ( once )
bTeleportMyself = FALSE;//Teleported us once we are Living ? Do do it anymore
}
for ( int i = 0; i < 32 ; i++ )// Loop trough all Players
{
if ( pBase->m_pGlobalPlayers[i] )// Pointer to Global Player Valid ( != 0 ) ?
{
if ( i != pBase->m_pLocalPlayer->index )// Teleport all ( 0-32 Players ) but not ourself to Position 0.0f
{
pBase->m_pGlobalPlayers[i]->X = 0.0f;// Set Player(i)'s X Pos to 0
pBase->m_pGlobalPlayers[i]->Y = 0.0f;// Set Player(i)'s Y Pos to 0
pBase->m_pGlobalPlayers[i]->Z = 0.0f;// Set Player(i)'s Z Pos to 0
}// End Index Check ( Global Player is not our own Player )
}// End Valid Ptr Check
}// End Loop trough all Players
}
else
{
bTeleportMyself = TRUE;// Are we Dead ? Teleport us once when we are living again
Sleep ( 200 );// Dont Overload
}
}
else
{
Sleep ( 200 );// Var is Off -> Chillout 200ms ( anti overload )
}
}
return NO_ERROR;// Should never Reach this under normal circumstances
}
int __stdcall DllMain ( HINSTANCE__ * hModule , unsigned long ulReason , void * lpReserved )
{
UNREFERENCED_PARAMETER(lpReserved);// Ignore Unreferenced Parameter warning
if ( ulReason == DLL_PROCESS_ATTACH )
{
CreateThread ( 0 , 0 , & PlayerOPK , 0 , 0 , 0 );
}
}
@Cyno: Warum lässt du den Thread weiterlaufen, wenn OPK nicht aktiv ist? Selbst wenn er nur Sleep() ausführt...
Richtig wäre wohl, den Thread entweder mit einer Condition-Variable zu pausieren oder den Thread sogar ganz zu beenden und neu zu starten, wenn OPK neu angemacht wird.
Ja da hast du wohl recht , wäre besser.
Ehm ich weiß nicht was "besser" ist und da ich damals CreateThread kennengelernt habe und eigentlich noch keine Probleme damit gehabt habe , verwende ich es bisher weiterhin.
Wenn du mich jedoch eines besseren belehren kannst , bin ich natürlich offen dafür die bessere Variante einzusetzen
Ehm ich weiß nicht was "besser" ist und da ich damals CreateThread kennengelernt habe und eigentlich noch keine Probleme damit gehabt habe , verwende ich es bisher weiterhin.
Wenn du mich jedoch eines besseren belehren kannst , bin ich natürlich offen dafür die bessere Variante einzusetzen
Ihr behauptet immer alle, C++ zu programmieren und doch nutzt ihr hauptsächlich Features von C. CreateThread ist eine Funktion aus der C Win32 API.
Die C++ Variante hat sehr, sehr viel mehr Features, die zwar irgendwo versteckt auch mit der Win32 API möglich sind, aber deshalb kaum einer nutzt.
Funktionen aus den Headern <future> und <thread> können ziemlich nützlich sein, wenn man Multithreading richtig machen will.
Ihr behauptet immer alle, C++ zu programmieren und doch nutzt ihr hauptsächlich Features von C. CreateThread ist eine Funktion aus der C Win32 API.
Die C++ Variante hat sehr, sehr viel mehr Features, die zwar irgendwo versteckt auch mit der Win32 API möglich sind, aber deshalb kaum einer nutzt.
Funktionen aus den Headern <future> und <thread> können ziemlich nützlich sein, wenn man Multithreading richtig machen will.
Das fängt doch schon beim Type Casting an .. ?
Es wird überall darauf hingewissen, das man die alte
C Methode nicht mehr verwenden soll & trotzdem
macht es noch jeder .. Oder sehe ich da was falsch ?
*(float*)(0x8B28C4) = 150.0F; /* C Style */
*reinterpret_cast<float*>(0x8B28C4) = 150.0F; /* C++ Style */
Please learn programming using C or C++ from scratch, not from copy and pasting. Learn pointer arithmetics from scratch. Get to know the basics of Intel 80x86 Assembly (Intel Notation). From scratch.
Tips were given, explaining what to do. Look, if you didn't understand the english language you wouldn't be able to understand what I'm writing right here. Same applies to programming languages. Not understanding their syntax, semantics and paradigms makes you unable to understand what we are trying to tell you.
What do you really want? Us to give you perfectly copy- and pastable code or yourself to understand about the code?
Please learn programming using C or C++ from scratch, not from copy and pasting. Learn pointer arithmetics from scratch. Get to know the basics of Intel 80x86 Assembly (Intel Notation). From scratch.
Tips were given, explaining what to do. Look, if you didn't understand the english language you wouldn't be able to understand what I'm writing right here. Same applies to programming languages. Not understanding their syntax, semantics and paradigms makes you unable to understand what we are trying to tell you.
What do you really want? Us to give you perfectly copy- and pastable code or yourself to understand about the code?
Please learn programming using C or C++ from scratch, not from copy and pasting. Learn pointer arithmetics from scratch. Get to know the basics of Intel 80x86 Assembly (Intel Notation). From scratch.
Tips were given, explaining what to do. Look, if you didn't understand the english language you wouldn't be able to understand what I'm writing right here. Same applies to programming languages. Not understanding their syntax, semantics and paradigms makes you unable to understand what we are trying to tell you.
What do you really want? Us to give you perfectly copy- and pastable code or yourself to understand about the code?
hi, i have a question about opk.
yes i have it working with structs, altough using it ingame gets me some strange results.
i go to the 0,0,0 point and all the players too, im not able to move but i expected that, but what happens is that the players keep getting send back and forth, (to the map back to 0,0,0) and you get like some sort of infinite loop thing, i tried adding while (true) to the opk code but that only resulted in a crash.
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!)