Hi i was wondering if anybody knows how to do script Event protection with messages the correct way i have the code for it but it does not protect against every script event for some reason it protects against for example Off-Host kick and gives message and everything but if somebody tries fake leave me it does not protect against it fake leaves me so how do i fix this and i now i am calling it right
this is the code i am using
this is the code i am using
Code:
class CEventTable {
private:
int g_EventTable; // The pointer to the event table
int g_EventId; // The event id which is passed through the setup function
int g_EventHandler; // The address of where the handler function address is stored
public:
CEventTable(int eventTable, int eventId) {
this->g_EventTable = eventTable;
this->g_EventId = eventId;
this->g_EventHandler = *(int*)(*(int*)(this->g_EventTable) + (((this->g_EventId & 0xFFFF) + 0x4EB4) << 2));
};
~CEventTable() {};
inline CEventTable DetourEvent(int originalAddress, int destFunc) {
if (this->g_EventHandler == originalAddress) {
*(int*)(*(int*)(this->g_EventTable) + (((this->g_EventId & 0xFFFF) + 0x4EB4) << 2)) = destFunc;
//WriteLog("Event 0x%X Detoured At 0x%X", this->g_EventId, destFunc);
}
return *this;
}
};
void ScriptEventProtection(int r3, int r4, int r5, int r6, int r7, int r8) {
int* iArgs = (int*)(r3 + 0x24);
char* sName = (char*)(*(DWORD*)(r4 + 0x78) + 0x5C);
if (iArgs[0] == 0x2 && iArgs[2] == 0x35) {
ShowMessage_Name("Tried: Off-Host kick!", sName);
*(int*)0x835DB068 = 0x60000000;
}
if (iArgs[0] == 0x3 && iArgs[1] == 0x36) {
ShowMessage_Name("Tried: to send you to darts!", sName);
*(int*)0x835DB068 = 0x60000000;
}
if (iArgs[0] == 0x3 && iArgs[1] == 0x37) {
ShowMessage_Name("Tried: to send you to golf!", sName);
*(int*)0x835DB068 = 0x60000000;
}
if (iArgs[0] == 0x3 && iArgs[1] == 0x14) {
ShowMessage_Name("Tried: to send you to tut!", sName);
*(int*)0x835DB068 = 0x60000000;
}
if (iArgs[0] == 0x3 && iArgs[1] == 0x35) {
ShowMessage_Name("Tried: to send you to armwrestling!", sName);
*(int*)0x835DB068 = 0x60000000;
}
if (iArgs[0] == 0x3 && iArgs[1] == 0x3A) {
ShowMessage_Name("Tried: to send you to flight school!", sName);
*(int*)0x835DB068 = 0x60000000;
}
if (iArgs[0] == 0x3 && iArgs[1] == 0x35) {
ShowMessage_Name("Tried: to make you rejoin session!", sName);
*(int*)0x835DB068 = 0x60000000;
}
if (iArgs[0] == 0x3 && iArgs[1] == 0x40) {
ShowMessage_Name("Tried: to remove phone and hud!", sName);
*(int*)0x835DB068 = 0x60000000;
}
if (iArgs[0] == 0x3 && iArgs[1] == 0x2D) {
ShowMessage_Name("Tried: to remove interaction menu!", sName);
*(int*)0x835DB068 = 0x60000000;
}
if (iArgs[0] == 0x2 && iArgs[1] == 0x34) {
ShowMessage_Name("Tried: to make you fake leave!", sName);
*(int*)0x835DB068 = 0x60000000;
}
if (iArgs[0] == 0x16C) {
ShowMessage_Name("Tried: to force you into thier apt!", sName);
*(int*)0x835DB068 = 0x60000000;
}
if (iArgs[0] == 0x2 && iArgs[1] == 0x2e) {
ShowMessage_Name("Tried: to reset your view!", sName);
*(int*)0x835DB068 = 0x60000000;
}
((DWORD(*)(DWORD, DWORD, DWORD, DWORD, DWORD, DWORD)) 0x830D9E90)(r3, r4, r5, r6, r7, r8);
*(int*)0x835DB068 = 0x4E800421;
}
void ProtectionsLoop()
{
CEventTable(0x83C8686C, 0x19).DetourEvent(0x830D9E90, (int)ScriptEventProtection);
}