Skip to content

All in one Garry's Mod binary module for x86 linux/windows srcds that provide access to various source/gmod methods and callbacks. Make your serverside scripts more optimized, powerfull and secure! 💪

License

Notifications You must be signed in to change notification settings

klen-list/gmsv_network

Repository files navigation

🔧 gmsv_network ⚙️

💪 All in one Garry's Mod binary module for x86 (x32) Linux/Windows dedicated server that provide access to various SourceEngine/GMOD methods and callbacks. Make your serverside lua scripts more optimized, powerfull and secure!
💡 Originally designed to replace the tracking of many events that require gm_sourcenet (which produces lua panic crashes, corrupted netchannel buffer read/write, and decreased optimization).
🪛 Currently under development. Feel free to request any new lua bindings you need, I can probably add them!

Available functions and hooks

Check example for detailed usage. All functions placed in global gmnetwork table.

CBaseServer:
GetNumClients GetNumProxies GetNumFakeClients GetMaxClients GetUDPPort GetClientCount GetTime GetTick GetTickInterval GetName GetMapName GetSpawnCount GetNumClasses GetClassBits GetNetStats GetNumPlayers GetCPUUsage IsActive IsLoading IsDedicated IsPaused IsMultiplayer IsPausable IsHLTV IsReplay GetPassword SetMaxClients SetPaused SetPassword DisconnectClient DisconnectClientSilent

IVEngineServer:
GMOD_RawServerCommand

HandleClientError:
EnableClientErrHandle
[Hook] GmNetwork.OnClientErr (ply_id: number, err: string) -> prevent_default: bool

ProcessCmd:
EnableClientProcessCmd
[Hook] GmNetwork.ProcessCmd (ply_id: number, cmd: string) -> prevent_default: any bool

LuaAutoRefresh:
EnableLuaAutoRefreshHandle
[Hook] GmNetwork.OnLuaRefresh (file_path: string) -> prevent_default: any bool

Other:
Version (string) (nil|string) GetEnv (string)

Worklist

  • Integrate bindings into existing glua classes/libraries, or create new ones.
  • Simplified version of ClientLuaError from gm_luaerror, allow parsing errors on lua side
  • Bindings for most of CBaseServer methods
    • Bindings for CBaseServer broadcast methods
  • Bindings for most of IVEngineServer methods
    • Binding to RawServerCommand
  • Binding a hook when client want execute serverside concommand (ProcessCmd) like binary module from myarena hosting, allow to block executing
  • Some GmodDataPack bindings (personal request from one server owner)
    • Binding a hook when datapack handle a lua file refresh
    • Block a lua refresh in this hook (probably needed too)
    • Binding to datapack HandleChange_Lua method like metastruct old code do
  • Create method to mark entities with method like SetTransmitControl
  • Binding a hook when marked entities change their PVS for players. Needed do a some magic with sv_ents_write.cpp (probably useful for own networked entity values system)
  • Binding a hook when marked entities and their childrens about to be writen in svc_PacketEntities, allow to suppress. Useful for accurate admin vanish instead spamming SetPreventTransmit calls
  • Bindings for CGameEventManager with ability suppress and create events. Also useful for ideal vanish
  • Binding a hook when server handle new value of FCVAR_USERINFO convar from client. Allow handle changes without spamming GetInfo/GetInfoNum calls. (Requested by me #1995 in garrysmod-requests)
  • Some bindings for vphysics (Most of this done in my other private module)
    • Bindings to some CCollisionEvent callbacks (detouring a friction system warning already used by my as good anticrash addition, i also seen this hook in metastruct old code)
    • Bindings to IPhysicsObjectEvent callbacks (related to CCollisionEvent bindings, just for #1923 in garrysmod-requests about adding hook when physobj going sleep)
    • Bindings to CPhysicsObject, including methods that are not exposed to IPhysicsObject (including #2234 in garrysmod-requests about adding PhysObj:GetBuoyancyRatio)
    • Binding to PhysIsInCallback (mentioned by #894 in garrysmod-requests)
    • Binding to PhysicsGameSystem and fields like m_bPaused that allow pause a physics
    • Bindings to IPhysicsEnvironment (probably)

Requirements

  1. Garrysmod Common - A framework to facilitate the creation of compilations files (Visual Studio, make, XCode, etc). Simply set the environment variable GARRYSMOD_COMMON or the premake option --gmcommon=path to the path of your local copy of garrysmod_common.
  2. Scanning Advanced - My helpful module contains symbols for sigscanning with garrysmod_common. Should be installed in third-party folder with name gmc_scanning_advanced.
  3. (Linux) Installed gcc-multilib and g++-multilib packages.

All requirements already added in repository as submodules. Make sure that you clone them with recursive!
git clone https://github.com/klen-list/gmsv_network --recursive

Compiling

  1. Download or install premake5
  2. Enter the project folder and run:
  • ./premake5.exe vs2022 (Windows with installed Visual Studio 2022 and locally placed premake5.exe)
  • ./premake5 gmake (Linux with installed build-essential and locally placed premake5)
    ⚠️ If you catch Error: module 'premake-export-compile-commands/export-compile-commands' not found you didn't clone submodules correctly! Read above about clone command.
  1. Move to projects/{os_platform}/{vs2022|gmake} and run network.sln (Windows) or run make command (Linux)

Stars

Star History Chart

About

All in one Garry's Mod binary module for x86 linux/windows srcds that provide access to various source/gmod methods and callbacks. Make your serverside scripts more optimized, powerfull and secure! 💪

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published