I'm working on a custom server tool for a game I'm trying to trigger an event when a variable in the memory changes a certain way.
Example of what I'm trying to do in a timer
Code
int client0alivevalue = memory.ReadByte((IntPtr)address + (clientsize * 0));
if (client0alivevalue == 0 then changes from 0 to 1)
{ do something }
So when client0alivevalue = 0 the client is dead and when it's 1 the client is alive. When the client dies and then respawns I want to trigger a function hence the example: if (client0alivevalue == 0 then changes from 0 to 1). I only want to trigger said function when the client0alivevalue changes from 0 to 1.
You could also do a thread event that grabs the integer repeatedly. But that would take up alot of CPU.
So i'd recommend subscribing to an eventhandle.
I suggest you to have your code injected into the target process. That will make it easy to simply check the value every x milliseconds without requiring alot of resources
You could also do a thread event that grabs the integer repeatedly. But that would take up alot of CPU.
So i'd recommend subscribing to an eventhandle.
Properties won't do him any good if the process is external and he doesn't have the code. Reading from memory in a loop isn't all that CPU intensive, just don't query too often. 100 milliseconds between checks should be fine for *most* purposes.
Originally Posted by Hell_Demon
Properties won't do him any good if the process is external and he doesn't have the code. Reading from memory in a loop isn't all that CPU intensive, just don't query too often. 100 milliseconds between checks should be fine for *most* purposes.
And even if he did it in a continuous loop without any sleeps, it will only use like 20% of your CPU. I tell you this from experience...