From ee4d50882f11f115a6f5607e2f5d83a14ca55088 Mon Sep 17 00:00:00 2001 From: neon <> Date: Tue, 21 May 2019 21:39:52 +0200 Subject: [PATCH] plis no hate --- PackageScript | 8 ++++---- extension.cpp | 28 ++++++++++++++++++++++++++++ extension.h | 2 +- include/A2SFixes.inc | 30 ++++++++++++++++++++++++++++++ 4 files changed, 63 insertions(+), 5 deletions(-) create mode 100644 include/A2SFixes.inc diff --git a/PackageScript b/PackageScript index d3d460c..1b7210a 100644 --- a/PackageScript +++ b/PackageScript @@ -8,7 +8,7 @@ builder.SetBuildFolder('package') # Add any folders you need to this list folder_list = [ 'addons/sourcemod/extensions', - #'addons/sourcemod/scripting/include', + 'addons/sourcemod/scripting/include', #'addons/sourcemod/gamedata', #'addons/sourcemod/configs', ] @@ -29,9 +29,9 @@ def CopyFiles(src, dest, files): builder.AddCopy(source_path, dest_entry) # Include files -#CopyFiles('include', 'addons/sourcemod/scripting/include', -# [ 'sample.inc', ] -#) +CopyFiles('include', 'addons/sourcemod/scripting/include', + [ 'A2SFixes.inc', ] +) # GameData files #CopyFiles('gamedata', 'addons/sourcemod/gamedata', diff --git a/extension.cpp b/extension.cpp index 7717a9d..bb5b30f 100644 --- a/extension.cpp +++ b/extension.cpp @@ -62,6 +62,8 @@ char *OldBuf; char g_PlayerReply[1024]; bf_write g_PlayerReplyPacket(g_PlayerReply, 1024); +int g_FakePlayers = 0; + /** * @brief */ @@ -121,6 +123,9 @@ DETOUR_DECL_STATIC6(Detour_SendTo, int, int, s, char *, buf, int, len, int, flag } } + if (iPlayers + g_FakePlayers < 64) + iPlayers += g_FakePlayers; + // Correct playercount memset(NewBuf, iPlayers, 1); @@ -174,6 +179,29 @@ DETOUR_DECL_STATIC6(Detour_SendTo, int, int, s, char *, buf, int, len, int, flag return DETOUR_STATIC_CALL(Detour_SendTo)(s, buf, len, flags, to, tolen); } +/** + * @brief + */ +cell_t FakePlayers(IPluginContext *pContext, const cell_t *params) +{ + g_FakePlayers = params[1]; + return 1; +} + +/** + * @brief + */ +const sp_nativeinfo_t MyNatives[] = +{ + {"FakePlayers", FakePlayers}, + {NULL, NULL}, +}; + +void A2SFixes::SDK_OnAllLoaded() +{ + sharesys->AddNatives(myself, MyNatives); +} + /** * @brief This is called after the initial loading sequence has been processed. * diff --git a/extension.h b/extension.h index 6d01fd1..4eb2d6f 100644 --- a/extension.h +++ b/extension.h @@ -66,7 +66,7 @@ public: * @brief This is called once all known extensions have been loaded. * Note: It is is a good idea to add natives here, if any are provided. */ - //virtual void SDK_OnAllLoaded(); + virtual void SDK_OnAllLoaded(); /** * @brief Called when the pause state is changed. diff --git a/include/A2SFixes.inc b/include/A2SFixes.inc new file mode 100644 index 0000000..93c42f5 --- /dev/null +++ b/include/A2SFixes.inc @@ -0,0 +1,30 @@ +#if defined _A2SFixes_included + #endinput +#endif +#define _A2SFixes_included + +native bool FakePlayers(int amount); + + +public Extension __ext_RevEmuAPI = +{ + name = "A2SFixes", + file = "A2SFixes.ext", +#if defined AUTOLOAD_EXTENSIONS + autoload = 1, +#else + autoload = 0, +#endif +#if defined REQUIRE_EXTENSIONS + required = 1, +#else + required = 0, +#endif +}; + +#if !defined REQUIRE_EXTENSIONS +public __ext_A2SFixes_SetNTVOptional() +{ + MarkNativeAsOptional("FakePlayers"); +} +#endif