Hooks.cpp (include "INetMessage.h")
bool __fastcall SendNetMsg(INetChannel* pNetChan, void* edx, INetMessage& msg, bool bForceReliable, bool bVoice) noexcept
{
if (msg.GetType() == 14) // Return and don't send messsage if its FileCRCCheck
return false;
if (msg.GetGroup() == 9) // Fix lag when transmitting voice and fakelagging
bVoice = true;
return hooks->engine.callOriginal<INetChannel*, 42, void*, INetMessage&, bool, bool>(pNetChan, msg, bForceReliable, bVoice);
}
Put this on "void Hooks::install() noexcept" (to call and run it automatically when you join the game )
engine.hookAt(42, SendNetMsg);
Engine.h
class INetChannel;
class Engine {
public:
VIRTUAL_METHOD(INetChannel*, getNetworkChannel, 42, (), (this))
};
INetMessage.h
class INetMsgHandler;
class INetMessage;
class INetChannel;
// typedef bool (INetMsgHandler::PROCESSFUNCPTR)(INetMessage); class INetMessage }; If i forgot something then please let me know or someone gonna help you.
// #define CASTPROCPTR( fn ) static_cast
{
public:
virtual ~INetMessage() {};// Use these to setup who can hear whose voice.
// Pass in client indices (which are their ent indices - 1).
virtual void SetNetChannel(INetChannel * netchan) = 0; // netchannel this message is from/for
virtual void SetReliable( bool state ) = 0; // set to true if it's a reliable message
virtual bool Process( void ) = 0; // calls the recently set handler to process this message
virtual bool ReadFromBuffer( bf_read &buffer ) = 0; // returns true if parsing was OK
virtual bool WriteToBuffer( bf_write &buffer ) = 0; // returns true if writing was OK
virtual bool IsReliable( void ) const = 0; // true, if message needs reliable handling
virtual int GetType( void ) const = 0; // returns module specific header tag eg svc_serverinfo
virtual int GetGroup( void ) const = 0; // returns net message group of this message
virtual const char *GetName( void ) const = 0; // returns network message name, eg "svc_serverinfo"
virtual INetChannel *GetNetChannel( void ) const = 0;
virtual const char *ToString( void ) const = 0; // returns a human readable string about message content
virtual size_t GetSize() const = 0;
endif
Hey! Thanks for your contribution to the repository, however would you mind putting this as a pull request? It just makes things a lot simpler and cleaner to go ahead and implement if it works well.
im pretty sure you didnt test this, you have to hook netchannel not engine
im pretty sure you didnt test this, you have to hook netchannel not engine
it can works normally, cause still its be hooked.
I have this code few months, cause it was on uc, and it works fine.
virtual bool ReadFromBuffer(bf_read& buffer) = 0; // returns true if parsing was OK
virtual bool WriteToBuffer(bf_write& buffer) = 0; // returns true if writing was OK
bf_read & bf_write
you forget this
bf_read & bf_write
you aren't finish them
bf_read & bf_write
you aren't finish them
you dont need that
ok
i don't understand the engine.h part, i can't put that in there because it collides with " VIRTUAL_METHOD(NetworkChannel*, getNetworkChannel, 78, (), (this))"
could you make a pull request, i pasted it in as is and i'm crashing :/
could you make a pull request, i pasted it in as is and i'm crashing :/
...and this is why we use git. doing things by hand is error prone.
use git as it was intended and submit a pull request, even if it's going to get declined it can still be pulled from.
^ also saves a lot of work from anyone wanting to try out your code.
how can i use this code do i need a programm or what can someone explain please?
Most helpful comment
Hey! Thanks for your contribution to the repository, however would you mind putting this as a pull request? It just makes things a lot simpler and cleaner to go ahead and implement if it works well.