Numark
Awesome Active Platinian
Hey guys, slice cast here again with another tutorial. I will show you how to hook an IEnumerable.
Let's say you found a method something like Username, Ban, Recoil, Reload, or whatever it is and it's an IEnumerable type. I don't really understand the concept of IEnumerable, but you can find out what it does by searching it.
Anyways let's get started.
We have this method like
Now if you scroll all the way down of the class, you will find something like this called
<UnbanPlayer>d__507>
Something like that.
We open that and we see some fields. One could say UserID or playername.
lets say we modify UserID and it's an integer/int type. So how do we modify it?
It's simple.
We're basically gonna hook this by calling the method with MoveNext().
Easy, now call your hooks using MSHook if using substrate.
That's all for now, hope you enjoyed this tutorial.
If you're new to this and don't know how to do it, please don't come into the comment section and asking me for help. This is all the help you will get because I explained it for you since this is a tutorial after all. If you're a newbie, don't try the hard stuff.
Let's say you found a method something like Username, Ban, Recoil, Reload, or whatever it is and it's an IEnumerable type. I don't really understand the concept of IEnumerable, but you can find out what it does by searching it.
Anyways let's get started.
We have this method like
C++:
private IEnumerator UnBanPlayer (string playerToKick)
Now if you scroll all the way down of the class, you will find something like this called
<UnbanPlayer>d__507>
Something like that.
We open that and we see some fields. One could say UserID or playername.
lets say we modify UserID and it's an integer/int type. So how do we modify it?
It's simple.
We're basically gonna hook this by calling the method with MoveNext().
C++:
//the void *instance is a self-created variable.
Void (*old_UnbanPlayer_MoveNext)(void *instance);
Void UnbanPlayer_MoveNext(void *instance) {
//Check if instance is NULL to prevent CRASH
if (instance != NULL)
{
*(int *) ((uint64_t)instance + 0x4C) = 18372819; //Return how many value
}
old_UnbanPlayer_MoveNext(instance);
}
Easy, now call your hooks using MSHook if using substrate.
C++:
MSHookFunction((void*)getAbsoluteAddress(OFFSETS), (void*)UnbanPlayer_MoveNext, (void**)&UnbanPlayer_MoveNext;
That's all for now, hope you enjoyed this tutorial.
If you're new to this and don't know how to do it, please don't come into the comment section and asking me for help. This is all the help you will get because I explained it for you since this is a tutorial after all. If you're a newbie, don't try the hard stuff.
Last edited: