Advertisement
Guest User

Untitled

a guest
Aug 7th, 2018
124
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Pascal 2.04 KB | None | 0 0
  1. library BaseHook;
  2.  
  3. uses
  4.   HLSDK,
  5.   CvarDef,
  6.   MemSearch,
  7.   Utils,
  8.   Windows,
  9.   SysUtils,
  10.   Visuals,
  11.   MsgAPI;
  12.  
  13. var
  14.  Color : Color24;
  15.  
  16. function hook_HUD_Redraw(const Time: Single; const Intermission: Longint): Longint; cdecl;
  17. var
  18.   _Now : TDateTime;
  19. begin
  20.   _Now:= Now;
  21.   DrawText(25, 140, PAnsiChar(DateToStr(_Now) + ' ' + TimeToStr(_Now)), Color);
  22.  
  23.   Result := Client.HUD_Redraw(Time, Intermission);
  24. end;
  25.  
  26. procedure HUD_Frame(const Time: Double); cdecl;
  27. begin
  28.   if FirstFrame then
  29.   begin
  30.     INIT_ModuleInfo_CL;
  31.  
  32.   // searching in client.dll
  33.     FindPlayerInfo;
  34.  
  35.   // hooking
  36.  
  37.     Color.R:= 255;
  38.     Color.G:= 0;
  39.     Color.B:= 0;
  40.  
  41.     PClient.HUD_Redraw:= hook_HUD_Redraw;
  42.  
  43.   // initializing
  44.  
  45.     MsgAPI.Release;
  46.     FirstFrame := False;
  47.   end;
  48.  
  49.   Client.HUD_Frame(Time);
  50. end;
  51.  
  52. procedure INIT_Main;
  53. var
  54.   Handle, SearchCount: Cardinal;
  55. label
  56.   retn;
  57. begin
  58.   SearchCount := 0;
  59.  
  60. retn:
  61.   if not FindEngineAndClient then
  62.   begin
  63.     Inc(SearchCount);
  64.     if SearchCount >= 10 then
  65.       Error('Couldn''t find EF/ET scanning pattern.' + ExportTable_Extra)
  66.     else
  67.       goto retn;
  68.   end;
  69.  
  70.   Handle := CreateEvent(nil, True, False, 'TimePlugin_Handle');
  71.   while not Initialized do
  72.     WaitForSingleObject(Handle, 90);
  73.   CloseHandle(Handle);
  74.  
  75.   FindStudio;
  76.  
  77.   CopyMemory(@Engine, PEngine, SizeOf(cl_enginefuncs_t));
  78.   CopyMemory(@Studio, PStudio, SizeOf(engine_studio_api_t));
  79.   CopyMemory(@Client, PClient, SizeOf(exporttable_t));
  80.   SW := Studio.IsHardware = 0;
  81.  
  82. // searching
  83.  
  84.   FindSpeedPtr;
  85.  
  86. // hooking
  87.  
  88.   PClient.HUD_Frame := HUD_Frame;
  89.  
  90. // initializing
  91.  
  92.   Init := True;
  93.   EndThread(0);
  94. end;
  95.  
  96. begin
  97.   MutexName := 'TimePlugin_Mutex' + IntToHex(GetCurrentProcessID, 8);
  98.   GlobalMutex := OpenMutex(MUTEX_ALL_ACCESS, False, PChar(MutexName));
  99.   if not (GlobalMutex = 0) then
  100.   begin
  101.     CloseHandle(GlobalMutex);
  102.     Halt;
  103.   end;
  104.   GlobalMutex := CreateMutex(nil, False, PChar(MutexName));
  105.  
  106.   INIT_ModuleInfo;
  107.   Randomize;
  108.   BeginThread(nil, 32, @INIT_Main, nil, 0, ThreadID);
  109. end.
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement