Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- library BaseHook;
- uses
- HLSDK,
- CvarDef,
- MemSearch,
- Utils,
- Windows,
- SysUtils,
- Visuals,
- MsgAPI;
- var
- Color : Color24;
- function hook_HUD_Redraw(const Time: Single; const Intermission: Longint): Longint; cdecl;
- var
- _Now : TDateTime;
- begin
- _Now:= Now;
- DrawText(25, 140, PAnsiChar(DateToStr(_Now) + ' ' + TimeToStr(_Now)), Color);
- Result := Client.HUD_Redraw(Time, Intermission);
- end;
- procedure HUD_Frame(const Time: Double); cdecl;
- begin
- if FirstFrame then
- begin
- INIT_ModuleInfo_CL;
- // searching in client.dll
- FindPlayerInfo;
- // hooking
- Color.R:= 255;
- Color.G:= 0;
- Color.B:= 0;
- PClient.HUD_Redraw:= hook_HUD_Redraw;
- // initializing
- MsgAPI.Release;
- FirstFrame := False;
- end;
- Client.HUD_Frame(Time);
- end;
- procedure INIT_Main;
- var
- Handle, SearchCount: Cardinal;
- label
- retn;
- begin
- SearchCount := 0;
- retn:
- if not FindEngineAndClient then
- begin
- Inc(SearchCount);
- if SearchCount >= 10 then
- Error('Couldn''t find EF/ET scanning pattern.' + ExportTable_Extra)
- else
- goto retn;
- end;
- Handle := CreateEvent(nil, True, False, 'TimePlugin_Handle');
- while not Initialized do
- WaitForSingleObject(Handle, 90);
- CloseHandle(Handle);
- FindStudio;
- CopyMemory(@Engine, PEngine, SizeOf(cl_enginefuncs_t));
- CopyMemory(@Studio, PStudio, SizeOf(engine_studio_api_t));
- CopyMemory(@Client, PClient, SizeOf(exporttable_t));
- SW := Studio.IsHardware = 0;
- // searching
- FindSpeedPtr;
- // hooking
- PClient.HUD_Frame := HUD_Frame;
- // initializing
- Init := True;
- EndThread(0);
- end;
- begin
- MutexName := 'TimePlugin_Mutex' + IntToHex(GetCurrentProcessID, 8);
- GlobalMutex := OpenMutex(MUTEX_ALL_ACCESS, False, PChar(MutexName));
- if not (GlobalMutex = 0) then
- begin
- CloseHandle(GlobalMutex);
- Halt;
- end;
- GlobalMutex := CreateMutex(nil, False, PChar(MutexName));
- INIT_ModuleInfo;
- Randomize;
- BeginThread(nil, 32, @INIT_Main, nil, 0, ThreadID);
- end.
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement