mirror of
https://github.com/ineedbots/cod2m.git
synced 2025-04-19 16:02:53 +00:00
Hooking script funcs and meths
This commit is contained in:
parent
a9fe1047bd
commit
94f0869ad4
@ -4,6 +4,7 @@
|
||||
#include "Modules/Flags.hpp"
|
||||
#include "Modules/HelloWorld.hpp"
|
||||
#include "Modules/Logger.hpp"
|
||||
#include "Modules/Script.hpp"
|
||||
|
||||
namespace Components
|
||||
{
|
||||
@ -39,6 +40,7 @@ namespace Components
|
||||
Loader::Register(new HelloWorld());
|
||||
Loader::Register(new Logger());
|
||||
Loader::Register(new Bots());
|
||||
Loader::Register(new Script());
|
||||
|
||||
Loader::Pregame = false;
|
||||
}
|
||||
|
25
src/Components/Modules/Script.cpp
Normal file
25
src/Components/Modules/Script.cpp
Normal file
@ -0,0 +1,25 @@
|
||||
#include "STDInclude.hpp"
|
||||
#include "Script.hpp"
|
||||
|
||||
namespace Components
|
||||
{
|
||||
Game::xmethod_t* Script::Player_GetMethod_Hook(const char** name)
|
||||
{
|
||||
return Game::Player_GetMethod(name);
|
||||
}
|
||||
|
||||
Game::xfunction_t* Script::Scr_GetFunction_Hook(const char** name, int* isDev)
|
||||
{
|
||||
return Game::Scr_GetFunction(name, isDev);
|
||||
}
|
||||
|
||||
Script::Script()
|
||||
{
|
||||
Utils::Hook(0x46E9CB, Player_GetMethod_Hook, HOOK_CALL).install()->quick();
|
||||
Utils::Hook(0x46E7BF, Scr_GetFunction_Hook, HOOK_CALL).install()->quick();
|
||||
}
|
||||
|
||||
Script::~Script()
|
||||
{
|
||||
}
|
||||
}
|
14
src/Components/Modules/Script.hpp
Normal file
14
src/Components/Modules/Script.hpp
Normal file
@ -0,0 +1,14 @@
|
||||
#pragma once
|
||||
|
||||
namespace Components
|
||||
{
|
||||
class Script : public Component
|
||||
{
|
||||
public:
|
||||
Script();
|
||||
~Script();
|
||||
private:
|
||||
static Game::xmethod_t* Player_GetMethod_Hook(const char**);
|
||||
static Game::xfunction_t* Scr_GetFunction_Hook(const char**, int*);
|
||||
};
|
||||
}
|
@ -28,8 +28,16 @@ namespace Game
|
||||
|
||||
bgs_s** bgs_ptr;
|
||||
|
||||
|
||||
Player_GetMethod_t* Player_GetMethod;
|
||||
Scr_GetFunction_t* Scr_GetFunction;
|
||||
|
||||
void Init(GAMEEXE)
|
||||
{
|
||||
Player_GetMethod = ASSIGN(Player_GetMethod_t*, 0x52E050);
|
||||
Scr_GetFunction = ASSIGN(Scr_GetFunction_t*, 0x50D280);
|
||||
|
||||
|
||||
cls = ASSIGN(clientStatic_t*, 0x68A408);
|
||||
svs = ASSIGN(serverStatic_t*, 0xD35700);
|
||||
sv = ASSIGN(server_t*, 0xCD6180);
|
||||
|
@ -33,7 +33,12 @@ namespace Game
|
||||
|
||||
extern bgs_s** bgs_ptr;
|
||||
|
||||
typedef Game::xmethod_t* (Player_GetMethod_t)(const char**);
|
||||
extern Player_GetMethod_t* Player_GetMethod;
|
||||
|
||||
void SV_ClientThink(Game::usercmd_s*, Game::client_t*);
|
||||
void SV_DropClient(Game::client_t*, const char*);
|
||||
typedef Game::xfunction_t* (Scr_GetFunction_t)(const char**, int*);
|
||||
extern Scr_GetFunction_t* Scr_GetFunction;
|
||||
|
||||
extern void SV_ClientThink(Game::usercmd_s*, Game::client_t*);
|
||||
extern void SV_DropClient(Game::client_t*, const char*);
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user