SBP Dhooks

Created Diff never expires
37 removals
Lines
Total
Removed
Words
Total
Removed
To continue using this feature, upgrade to
Diffchecker logo
Diffchecker Pro
141 lines
11 additions
Lines
Total
Added
Words
Total
Added
To continue using this feature, upgrade to
Diffchecker logo
Diffchecker Pro
119 lines
#pragma semicolon 1
#pragma semicolon 1


#include <sourcemod>
#include <sourcemod>
#include <dhooks>
#include <dhooks>
#include <sdktools>
#include <sdktools>


#pragma newdecls required
#pragma newdecls required


Handle g_hClientPrintf = null;
Handle g_hClientPrintf = null;


char g_sLogs[PLATFORM_MAX_PATH + 1];
char g_sLogs[PLATFORM_MAX_PATH + 1];


public Plugin myinfo =
public Plugin myinfo =
{
{
name = "Hide Plugin List",
name = "Hide Plugin List",
description = "",
description = "Block People From stealing your Plugins",
author = "Bara",
author = "[PewDiePie]",
version = "1.0.0",
version = "1.0.0",
url = "https://github.com/Bara"
url = ""
};
};


public void OnPluginStart()
public void OnPluginStart()
{
{
Handle gameconf = LoadGameConfigFile("sbp.games");
Handle gameconf = LoadGameConfigFile("sbp.games");
if(gameconf == null)
if(gameconf == null)
{
{
SetFailState("Failed to find sbp.games.txt gamedata");
SetFailState("Failed to find sbp.games.txt gamedata");
delete gameconf;
delete gameconf;
}
}
int offset = GameConfGetOffset(gameconf, "ClientPrintf");
int offset = GameConfGetOffset(gameconf, "ClientPrintf");
if(offset == -1)
if(offset == -1)
{
{
SetFailState("Failed to find offset for ClientPrintf");
SetFailState("Failed to find offset for ClientPrintf");
delete gameconf;
delete gameconf;
}
}
StartPrepSDKCall(SDKCall_Static);
StartPrepSDKCall(SDKCall_Static);
if(!PrepSDKCall_SetFromConf(gameconf, SDKConf_Signature, "CreateInterface"))
if(!PrepSDKCall_SetFromConf(gameconf, SDKConf_Signature, "CreateInterface"))
{
{
SetFailState("Failed to get CreateInterface");
SetFailState("Failed to get CreateInterface");
delete gameconf;
delete gameconf;
}
}
PrepSDKCall_AddParameter(SDKType_String, SDKPass_Pointer);
PrepSDKCall_AddParameter(SDKType_String, SDKPass_Pointer);
PrepSDKCall_AddParameter(SDKType_PlainOldData, SDKPass_Pointer, VDECODE_FLAG_ALLOWNULL);
PrepSDKCall_AddParameter(SDKType_PlainOldData, SDKPass_Pointer, VDECODE_FLAG_ALLOWNULL);
PrepSDKCall_SetReturnInfo(SDKType_PlainOldData, SDKPass_Plain);
PrepSDKCall_SetReturnInfo(SDKType_PlainOldData, SDKPass_Plain);
char identifier[64];
char identifier[64];
if(!GameConfGetKeyValue(gameconf, "EngineInterface", identifier, sizeof(identifier)))
if(!GameConfGetKeyValue(gameconf, "EngineInterface", identifier, sizeof(identifier)))
{
{
SetFailState("Failed to get engine identifier name");
SetFailState("Failed to get engine identifier name");
delete gameconf;
delete gameconf;
}
}
Handle temp = EndPrepSDKCall();
Handle temp = EndPrepSDKCall();
Address addr = SDKCall(temp, identifier, 0);
Address addr = SDKCall(temp, identifier, 0);
delete gameconf;
delete gameconf;
delete temp;
delete temp;
if(!addr)
if(!addr)
{
{
SetFailState("Failed to get engine ptr");
SetFailState("Failed to get engine ptr");
}
}
g_hClientPrintf = DHookCreate(offset, HookType_Raw, ReturnType_Void, ThisPointer_Ignore, Hook_ClientPrintf);
g_hClientPrintf = DHookCreate(offset, HookType_Raw, ReturnType_Void, ThisPointer_Ignore, Hook_ClientPrintf);
DHookAddParam(g_hClientPrintf, HookParamType_Edict);
DHookAddParam(g_hClientPrintf, HookParamType_Edict);
DHookAddParam(g_hClientPrintf, HookParamType_CharPtr);
DHookAddParam(g_hClientPrintf, HookParamType_CharPtr);
DHookRaw(g_hClientPrintf, false, addr);
DHookRaw(g_hClientPrintf, false, addr);
char sDate[18];
char sDate[18];
FormatTime(sDate, sizeof(sDate), "%y-%m-%d");
FormatTime(sDate, sizeof(sDate), "%y-%m-%d");
BuildPath(Path_SM, g_sLogs, sizeof(g_sLogs), "logs/sbp-%s.log", sDate);
BuildPath(Path_SM, g_sLogs, sizeof(g_sLogs), "logs/sbp-%s.log", sDate);
}
}


public MRESReturn Hook_ClientPrintf(Handle hParams)
public MRESReturn Hook_ClientPrintf(Handle hParams)
{
{
char sBuffer[1024];
char sBuffer[1024];
int client = DHookGetParam(hParams, 1);
int client = DHookGetParam(hParams, 1);
if (client == 0)
if (client == 0)
{
{
return MRES_Ignored;
return MRES_Ignored;
}
}
DHookGetParamString(hParams, 2, sBuffer, sizeof(sBuffer));
DHookGetParamString(hParams, 2, sBuffer, sizeof(sBuffer));
if(sBuffer[1] == '"' && (StrContains(sBuffer, "\" (") != -1 || (StrContains(sBuffer, ".smx\" ") != -1)))
if(sBuffer[1] == '"' && (StrContains(sBuffer, "\" (") != -1 || (StrContains(sBuffer, ".smx\" ") != -1)))
{
{
DHookSetParamString(hParams, 2, "");
DHookSetParamString(hParams, 2, "");
return MRES_ChangedHandled;
return MRES_ChangedHandled;
}
}
else if(StrContains(sBuffer, "To see more, type \"sm plugins") != -1)
else if(StrContains(sBuffer, "To see more, type \"sm plugins") != -1)
{
{
if (client > 0 && IsClientInGame(client) && !IsFakeClient(client) && !IsClientSourceTV(client))
if (client > 0 && IsClientInGame(client) && !IsFakeClient(client) && !IsClientSourceTV(client))
{
{
if (CheckCommandAccess(client, "sm_admin", ADMFLAG_ROOT, true))
if (CheckCommandAccess(client, "sm_admin", ADMFLAG_ROOT, true))
{
{
return MRES_Ignored;
return MRES_Ignored;
}
}
PrintToConsole(client, " ¶¶¶¶¶¶¶¶¶¶¶¶¶¶¶¶¶¶¶¶¶¶¶¶¶¶¶¶¶¶¶¶¶¶¶¶¶¶¶¶¶¶¶¶¶¶¶¶¶¶\n \
PrintToConsole(iClient, " ¶¶¶¶¶¶¶¶¶¶¶¶¶¶¶¶¶¶¶¶¶¶¶¶¶¶¶¶¶¶¶¶¶¶¶¶¶¶¶¶¶¶¶¶\n \
¶¶¶¶¶¶¶¶¶¶¶¶¶¶¶¶¶¶¶¶¶¶¶¶¶¶¶¶¶¶¶¶¶¶¶¶¶¶¶¶¶¶¶¶¶¶¶¶¶¶\n \
¶¶¶¶¶¶¶¶¶¶¶¶¶¶¶¶¶¶¶¶¶¶¶¶¶¶¶¶¶¶¶¶¶¶¶¶¶¶¶¶¶¶¶¶\n \
¶¶¶¶¶¶¶¶¶¶¶¶¶¶¶¶¶¶¶¶¶¶¶______¶¶¶¶¶¶¶¶¶¶¶¶¶¶¶¶¶¶¶¶¶\n \
¶¶¶¶¶¶¶¶¶¶¶¶GET LOST YOU STEALER¶¶¶¶¶¶¶¶¶¶¶¶\n \
¶¶¶¶¶¶¶¶¶¶¶¶¶¶¶¶¶¶¶¶¶¶¶______¶¶¶¶¶¶¶¶¶¶¶¶¶¶¶¶¶¶¶¶¶\n \
¶¶¶¶¶¶¶¶¶¶¶¶¶¶¶¶¶DONT STEAL MY¶¶¶¶¶¶¶¶¶¶¶¶¶¶\n \
¶¶¶¶¶¶¶¶¶¶¶¶¶¶¶¶¶¶¶¶¶¶¶______¶¶¶¶¶¶¶¶¶¶¶¶¶¶¶¶¶¶¶¶¶\n \
¶¶¶¶¶¶¶¶¶¶¶¶¶¶¶¶¶¶¶¶PLUGINS¶¶¶¶¶¶¶¶¶¶¶¶¶¶¶¶¶\n \
¶¶¶¶¶¶¶¶¶¶¶¶¶¶¶¶¶¶¶¶¶¶¶______¶¶¶¶¶¶¶¶¶¶¶¶¶¶¶¶¶¶¶¶¶\n \
¶¶¶¶¶¶¶¶¶¶¶¶¶¶¶¶¶¶¶¶¶¶¶¶¶¶¶¶¶¶¶¶¶¶¶¶¶¶¶¶¶¶¶¶\n \
¶¶¶¶¶¶¶¶¶¶¶¶¶¶¶¶¶¶¶¶¶¶¶______¶¶¶¶¶¶¶¶¶¶¶¶¶¶¶¶¶¶¶¶¶");
¶¶¶¶¶¶¶¶¶¶¶¶¶¶¶CODED BY PEWDIEPIE¶¶¶¶¶¶¶¶¶¶¶");
PrintToConsole(client, " ¶¶¶¶¶¶¶¶¶¶¶¶¶¶¶¶¶¶¶¶¶¶¶______¶¶¶¶¶¶¶¶¶¶¶¶¶¶¶¶¶¶¶¶¶\n \
¶¶¶¶¶¶¶¶¶¶¶¶¶¶¶¶¶¶¶¶¶¶¶______¶¶¶¶¶¶¶¶¶¶¶¶¶¶¶¶¶¶¶¶¶\n \
¶¶¶¶¶¶¶¶¶¶¶¶¶¶¶¶_____¶¶______¶¶¶____¶¶¶¶¶¶¶¶¶¶¶¶¶¶\n \
¶¶¶¶¶¶¶¶¶¶¶¶¶¶¶______¶¶______¶¶______¶¶¶¶¶¶¶¶¶¶¶¶¶\n \
¶¶¶¶¶¶¶¶¶¶¶¶¶¶¶______¶¶______¶¶______¶¶¶¶¶¶¶¶¶¶¶¶¶\n \
¶¶¶¶¶¶¶¶¶¶¶¶¶¶¶______¶¶______¶¶______¶¶______¶¶¶¶¶\n \
¶¶¶¶¶¶¶¶¶¶¶¶¶¶¶¶_____¶¶______¶¶______¶¶______¶¶¶¶¶");
PrintToConsole(client, " ¶¶¶__¶¶¶¶¶¶¶¶¶¶______¶¶______¶¶______¶¶______¶¶¶¶¶\n \
¶______¶¶¶¶¶¶¶¶¶_____¶¶______¶¶______¶¶______¶¶¶¶¶\n \
¶¶______¶¶¶¶¶¶¶______¶¶______¶¶______¶¶______¶¶¶¶¶\n \
¶¶¶______¶¶¶¶¶¶¶_____¶¶______¶¶______¶¶______¶¶¶¶¶\n \
¶¶¶¶______¶¶¶¶¶______¶¶______¶¶______¶¶______¶¶¶¶¶\n \
¶¶¶¶¶_______¶¶¶______¶¶______¶¶______¶¶______¶¶¶¶¶\n \
¶¶¶¶¶¶_______¶¶¶_____¶¶______¶¶______¶¶¶___¶¶¶¶¶¶¶");
PrintToConsole(client, " ¶¶¶¶¶¶¶¶______¶¶¶¶_¶¶¶¶______¶¶¶¶__¶¶¶¶¶¶¶¶¶¶¶¶¶¶¶\n \
¶¶¶¶¶¶¶¶¶______¶¶¶¶¶¶¶¶¶¶___¶¶¶¶¶¶¶¶¶¶¶_____¶¶¶¶¶¶\n \
¶¶¶¶¶¶¶¶¶¶________¶¶¶¶¶¶¶¶¶¶¶¶¶¶¶¶¶¶________¶¶¶¶¶¶\n \
¶¶¶¶¶¶¶¶¶¶¶¶__________¶¶¶¶¶¶¶¶¶¶__________¶¶¶¶¶¶¶¶\n \
¶¶¶¶¶¶¶¶¶¶¶¶¶¶¶_________________________¶¶¶¶¶¶¶¶¶¶\n \
¶¶¶¶¶¶¶¶¶¶¶¶¶¶¶¶¶¶__________________¶¶¶¶¶¶¶¶¶¶¶¶¶¶\n \
¶¶¶¶¶¶¶¶¶¶¶¶¶¶¶¶¶¶¶¶¶¶¶¶¶¶¶¶¶¶¶¶¶¶¶¶¶¶¶¶¶¶¶¶¶¶¶¶¶¶\n \
¶¶¶¶¶¶¶¶¶¶¶¶¶¶¶¶¶¶¶¶¶¶¶¶¶¶¶¶¶¶¶¶¶¶¶¶¶¶¶¶¶¶¶¶¶¶¶¶¶¶\n ");
PrintToConsole(client, "\t\tNo chance\n");
PrintToConsole(client, "\t\tNo chance\n");


LogToFile(g_sLogs, "\"%L\" tried to get the plugin list", client);
LogToFile(g_sLogs, "\"%L\" tried to get the plugin list", client);
}
}
return MRES_ChangedHandled;
return MRES_ChangedHandled;
}
}
return MRES_Ignored;
return MRES_Ignored;
}
}