Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

25th year anniversary issue #1086

Open
stylez1989 opened this issue Dec 5, 2023 · 11 comments
Open

25th year anniversary issue #1086

stylez1989 opened this issue Dec 5, 2023 · 11 comments

Comments

@stylez1989
Copy link

Will hamsandwhich tables be updated with the new 25th anniversary? A few of our plugins crash because of amxx incompatibility with the new update

Pre legacy half-life runs fine but not on post 25th

@xhsu
Copy link

xhsu commented Dec 8, 2023

May I ask what game is it you are referring to? My 1.8.2 runs fine on CS and CZ.

@Hedwig7s
Copy link

Hedwig7s commented Dec 10, 2023

Just tried cstrike and czero and it's incompatible now
Tried removing amxmod and leaving metamod and it worked fine so it's amxmod

@xhsu
Copy link

xhsu commented Dec 10, 2023 via email

@Hedwig7s
Copy link

What function in AMX causes your crash? I can personally confirm 100% of PDATA offsets and VFT that I have ever in use is working fine.

On Mon, Dec 11, 2023, 05:42 Hedwig7s @.> wrote: Just tried cstrike and it's incompatible now — Reply to this email directly, view it on GitHub <#1086 (comment)>, or unsubscribe https://github.com/notifications/unsubscribe-auth/AH55XVVVJCBUFQDO76OAQQDYIX7AHAVCNFSM6AAAAABAHBK6Z2VHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMYTQNBZGA2DMNRXGU . You are receiving this because you commented.Message ID: @.>

No clue but it crashes when a player joins on a default install using the installer

@raub
Copy link

raub commented Jan 1, 2024

Hey, unsure if that's what you need, but since Valve has rebuilt both SWDS.DLL and HL.DLL, now AMXX can't find some key memory points. In AMXX 1.9 there are GAMEDATA configs to specify the binary search.

Using IDA I found the new bytes and got latest HLDM working with AMXX and no warnings/crashes. Note: these are for HLDM ("valve"), because that's what I needed. Extract custom.zip to valve/addons/amxmodx/data/gamedata/common.games/ - becomes valve/addons/amxmodx/data/gamedata/common.games/custom/globalvars.engine.txt, etc.

@ClaudiuHKS
Copy link
Contributor

ClaudiuHKS commented Jan 2, 2024

@raub do you have any idea about

			"svs"    // Used with pfnGetCurrentPlayer ( PF_GetCurrentPlayer in swds.dll/ engine_i486.so ) base address
			{
				"windows"   "8" ////// ??? This is what I need ///////////////////////
			}
			"sv"
			{
				"windows"
				{
					"signature"  "sv"
					"read"       "2" ////// ??? This is what I need ///////////////////////
				}
			}
            "sv"                    /// server_t            sv
            {
                ///
                "library"           "engine"
                ///
                /// "windows"       "\x8B\x2A\x2A\x2A\x2A\x2A\x8D\x2A\x2A\x2A\x2A\x2A\x53\x33\x2A\x89"                                                                                                                      /// SVC_PlayerInfo()                [ 2020 HLDS ]   CS/ CZ, DOD, HL, ...
                ///
                "windows"           "\x8B\x2A\x2A\x2A\x2A\x2A\x8B\x2A\x2A\x2A\x2A\x2A\x76\x2A\xA1\x2A\x2A\x2A\x2A\x85\x2A\x0F\x2A\x2A\x83\x2A\x2A\x74\x2A\x83\x2A\x2A\x2A\x2A\x2A\x2A\x74"                                  /// dword_10971F40 @ sub_101D1EF0() [ 2023 HLDS ]   CS/ CZ, DOD, HL, ...
                ///
                "linux"             "@sv"
                "mac"               "@sv"
                ///
            }

? This signature is needed for the cstrike module (@ cs_set_user_team). The game server crashes when calling this function.
(non-Re); g_pGameRules I managed to fix myself.

@raub
Copy link

raub commented Jan 3, 2024

@ClaudiuHKS I guess that's because the Windows search is not specified at all for svs? like that:

"svs"    // server_static_t svs
{
"library"   "engine"
// <---- windows is missing
"linux"     "@svs"
"mac"       "@svs"
}

So it should be provided first. We can look at ReHLDS where it happens to be very similar: https://github.com/search?q=repo%3Adreamstalker%2Frehlds%20g_psvs&type=code - now find any adjacent text data to look for (https://github.com/search?q=repo%3Adreamstalker%2Frehlds%20dll_initialized&type=code - I search for dll_initialized, that is the first field of g_psvs).

Then I use this string: https://github.com/dreamstalker/rehlds/blob/93f5775ac26240782981f47ee8e052fb53d30877/rehlds/engine/host_cmd.cpp#L181 and it gets me here (IDA Free):
Screenshot_23

Now that it's settled, we only need to fetch bytes and offset. I ended up with 33 C0 83 3D ?? ?? ?? ?? 01 0F 9F C0 50 E8 ?? ?? ?? ?? 83 C4 04 83 3D - that for IDA, and for AMXX that should be \x33\xC0\x83\x3D\x2A\x2A\x2A\x2A\x01\x0F\x9F\xC0\x50\xE8\x2A\x2A\x2A\x2A\x83\xC4\x04\x83\x3D. So it will arrive at the first byte of this sequence, while g_psvs turns out to be mentioned right AFTER this sequence (as in if (g_psvs.dll_initialized), that translates to 83 3D __ __ __ __, yeah that ... 83 3D from above). Hence the offset is 23 - the whole length of my byte sequence.

"svs"
{
"windows"   "23" // it depends on where (start of) your byte sequence points
}

and

"svs"    // server_static_t svs
{
"library"   "engine"
"windows"   "\x33\xC0\x83\x3D\x2A\x2A\x2A\x2A\x01\x0F\x9F\xC0\x50\xE8\x2A\x2A\x2A\x2A\x83\xC4\x04\x83\x3D"
"linux"     "@svs"
"mac"       "@svs"
}

I hope it helps, and now you know the steps in case you have a different SWDS.DLL

@ClaudiuHKS
Copy link
Contributor

ClaudiuHKS commented Jan 3, 2024

@raub svs does not need a Windows signature. In Windows, it is only an offset. It is g_engfuncs.pfnGetCurrentPlayer() (PF_GetCurrentPlayer() in engine_i486.so) address plus this offset, =the address of the real server_static_t svs.
That's why I asked about:

"svs" // This offset (2020 HLDS = '8', 2023 = '??????')
"sv" -> "read" "2" // (2020 HLDS), but for 2023 HLDS = '??????' (The signature of it I've typed above, up-to-date)

I don't know if you can help ... g_pGameRules had read 2 in 2020 HLDS, but I found out that read is 1 in 2023 HLDS after updating the signature. Just sv/ svs needs to be fixed and I've no idea how to.

Also see: https://github.com/alliedmodders/amxmodx/blob/master/modules/cstrike/cstrike/CstrikeHacks.cpp#L779

image
image
image
image

If you help with this, we've got latest AMXX 1.10 to work on DOD, HL, CS/ CZ in full (without RE stuff). Thanks.

@Th3-822
Copy link
Contributor

Th3-822 commented Jan 3, 2024

The offset is 13 to get to svs.clients which is pointed at svs + 4 (yes, thats the 4 that is substracting from base at that CstrikeHacks line for setting ServerStatic)
image

@ClaudiuHKS
Copy link
Contributor

ClaudiuHKS commented Jan 4, 2024

@Th3-822 thanks man that's incredible. Working like a charm. I only tested values such 0, 4, 8, 10, 12, 16, 20, 24 & 28. I put my updated file so other people can use (CS/ CZ, DOD, HL, ...). This file is for non-ReHLDS game servers only (25th only).

globalvars.engine.txt

/**
 * Do not edit this file.  Any changes will be overwritten by the gamedata
 * updater or by upgrading your AMX Mod X install.
 *
 * To override data in this file, create a subdirectory named "custom" and
 * place your own gamedata file(s) inside of it.  Such files will be parsed
 * after AMXX's own.
 *
 * For more information, see http://wiki.alliedmods.net/Gamedata_Updating_(AMX_Mod_X)
 */

"Games"
{
    "#default"
    {
        "Offsets"
        {
            "svs"                   /// Used With   pfnGetCurrentPlayer     Base Address
            {
                ///
                /// "windows"       "8"     /// 2020 HLDS (CS/ CZ, DOD, HL, ...)
                ///
                "windows"           "13"    /// 2023 HLDS (CS/ CZ, DOD, HL, ...)
                ///
            }
        }

        "Addresses"
        {
            "realtime"
            {
                "windows"
                {
                    "signature"     "realtime"

                    "read"          "2"
                }
            }

            "sv"
            {
                "windows"
                {
                    "signature"     "sv"

                    "read"          "2"
                }
            }

            "g_pGameRules"
            {
                "signature"         "g_pGameRules"

                "windows"
                {
                    ///
                    /// "read"      "2"     /// [ HLDS 2020 ]   CS/ CZ
                    ///
                    "read"          "1"     /// [ HLDS 2023 ]   CS/ CZ, DOD, HL, ...
                    ///
                }

                "read"              "0"
            }
        }

        "Signatures"
        {
            "svs"                   /// server_static_t     svs
            {
                "library"           "engine"
                "linux"             "@svs"
                "mac"               "@svs"
            }

            "sv"                    /// server_t            sv
            {
                ///
                "library"           "engine"
                ///
                /// "windows"       "\x8B\x2A\x2A\x2A\x2A\x2A\x8D\x2A\x2A\x2A\x2A\x2A\x53\x33\x2A\x89"                                                                                                                      /// SVC_PlayerInfo()                [ 2020 HLDS ]   CS/ CZ, DOD, HL, ...
                ///
                "windows"           "\x8B\x2A\x2A\x2A\x2A\x2A\x8B\x2A\x2A\x2A\x2A\x2A\x76\x2A\xA1\x2A\x2A\x2A\x2A\x85\x2A\x0F\x2A\x2A\x83\x2A\x2A\x74\x2A\x83\x2A\x2A\x2A\x2A\x2A\x2A\x74"                                  /// dword_10971F40 @ sub_101D1EF0() [ 2023 HLDS ]   CS/ CZ, DOD, HL, ...
                ///
                "linux"             "@sv"
                "mac"               "@sv"
                ///
            }

            "realtime"              /// double              realtime
            {
                ///
                "library"           "engine"
                ///
                /// "windows"       "\xDC\x2A\x2A\x2A\x2A\x2A\xA1\x2A\x2A\x2A\x2A\x56"                                                                                                                                      /// SV_CheckTimeouts()              [ 2020 HLDS ]   CS/ CZ, DOD, HL, ...
                ///
                "windows"           "\xF2\x2A\x2A\x2A\x2A\x2A\x2A\x2A\x66\x2A\x2A\x2A\x72\x2A\x3B\x2A\x7D\x2A\x8B\x2A\x8D\x2A\x2A\x2B\x2A\x8B\x2A\xC1\x2A\x2A\x81\x2A\x2A\x2A\x2A\x2A\xF3\x2A\x8B\x2A\x2A\x2A\x2A\x2A\x8B"  /// qword_10B6A158 @ sub_10208750() [ 2023 HLDS ]   CS/ CZ, DOD, HL, ...
                ///
                "linux"             "@realtime"
                "mac"               "@realtime"
                ///
            }

            "g_pGameRules"          /// CGameRules *        g_pGameRules
            {
                ///
                "library"           "server"
                ///
                /// "windows"       "\x8B\x2A\x2A\x2A\x2A\x2A\x85\x2A\x74\x2A\x8B\x2A\xFF\x2A\x2A\xA1"                                                                                                                      /// StartFrame()                    [ 2020 HLDS ]   CS/ CZ
                ///
                "windows"           "\xA3\x2A\x2A\x2A\x2A\xFF\x2A\x2A\x2A\x2A\x2A\x85\x2A\x75\x2A\x33\x2A\xEB"                                                                                                              /// dword_10130BA0 @ sub_100C2440() [ 2023 HLDS ]   CS/ CZ
                /// "windows"       "\xA3\x2A\x2A\x2A\x2A\xA1\x2A\x2A\x2A\x2A\x8B\x2A\x8B\x2A\x2A\x2A\x2A\x2A\xFF\x2A\x6A\x2A\xE8\x2A\x2A\x2A\x2A\x83\x2A\x2A\xA3\x2A\x2A\x2A\x2A\xA1"                                      /// dword_1013B31C @ sub_100BB790() [ 2023 HLDS ]   DOD
                /// "windows"       "\xA3\x2A\x2A\x2A\x2A\xFF\x2A\x2A\x2A\x2A\x2A\x85\x2A\x75\x2A\x33\x2A\xEB\x2A\x8D\x2A\x2A\x2A\x2A\x2A\x8B\x2A\x2A\x2A\x2A\x2A\x89\x2A\x2A\x85\x2A\x74\x2A\x8B\x2A\x2A\x85\x2A\x75"      /// dword_100D74A4 @ sub_100985B0() [ 2023 HLDS ]   HL
                ///
                "linux"             "@g_pGameRules"
                "mac"               "@g_pGameRules"
                ///
            }
        }
    }
}

functions.engine.txt

/**
 * Do not edit this file.  Any changes will be overwritten by the gamedata
 * updater or by upgrading your AMX Mod X install.
 *
 * To override data in this file, create a subdirectory named "custom" and
 * place your own gamedata file(s) inside of it.  Such files will be parsed
 * after AMXX's own.
 *
 * For more information, see http://wiki.alliedmods.net/Gamedata_Updating_(AMX_Mod_X)
 */

"Games"
{
    "#default"
    {
        "Signatures"
        {
            "SV_DropClient"     /// void SV_DropClient(client_t *cl, qboolean crash, const char *fmt, ...);
            {
                ///
                "library"       "engine"
                ///
                /// "windows"   "\x55\x8B\x2A\x81\x2A\x2A\x2A\x2A\x2A\x8B\x2A\x2A\x53\x56\x8D"                                                                                                          /// [ HLDS 2020 ] CS/ CZ, DOD, HL, ... ( OLD )
                ///
                "windows"       "\x55\x8B\x2A\x81\x2A\x2A\x2A\x2A\x2A\xA1\x2A\x2A\x2A\x2A\x33\x2A\x89\x2A\x2A\x56\x57\x8B\x2A\x2A\x8D\x2A\x2A\x50\x33\x2A\x8D\x2A\x2A\x2A\x2A\x2A\x56\xFF\x2A\x2A\x68"  /// [ HLDS 2023 ] CS/ CZ, DOD, HL, ... ( NEW ) @ sub_101D1CB0()
                ///
                "linux"         "@SV_DropClient"
                "mac"           "@SV_DropClient"
                ///
            }

            "Cvar_DirectSet"    /// void Cvar_DirectSet(struct cvar_s *var, char *value);
            {
                ///
                "library"       "engine"
                ///
                /// "windows"   "\x55\x8B\x2A\x81\x2A\x2A\x2A\x2A\x2A\x56\x8B\x2A\x2A\x57\x8B\x2A\x2A\x85"                                                                                              /// [ HLDS 2020 ] CS/ CZ, DOD, HL, ... ( OLD )
                ///
                "windows"       "\x55\x8B\x2A\x81\x2A\x2A\x2A\x2A\x2A\xA1\x2A\x2A\x2A\x2A\x33\x2A\x89\x2A\x2A\x56\x8B\x2A\x2A\x57\x8B\x2A\x2A\x85\x2A\x0F\x2A\x2A\x2A\x2A\x2A\x85\x2A\x0F"              /// [ HLDS 2023 ] CS/ CZ, DOD, HL, ... ( NEW ) @ sub_101BDCF0()
                ///
                "linux"         "@Cvar_DirectSet"
                "mac"           "@Cvar_DirectSet"
                ///
            }
        }
    }
}

/gamedata/modules.games/game.cstrike.txt

/**
 * Do not edit this file.  Any changes will be overwritten by the gamedata
 * updater or by upgrading your AMX Mod X install.
 *
 * To override data in this file, create a subdirectory named "custom" and
 * place your own gamedata file(s) inside of it.  Such files will be parsed
 * after AMXX's own.
 *
 * For more information, see http://wiki.alliedmods.net/Gamedata_Updating_(AMX_Mod_X)
 */

"Games"
{
    "#default"
    {
        "Signatures"
        {
            "CanPlayerBuy"          /// bool CBasePlayer::CanPlayerBuy(bool display) [__thiscall]
            {
                "library"           "server"
                /// "windows"       "\x51\x53\x55\x56\x57\x8B\x2A\x8B\x2A\x2A\x2A\x2A\x2A\x8B\x2A\xFF" /// HLDS 2020
                "windows"           "\x55\x8B\x2A\x51\x56\x8B\x2A\x8B\x2A\x2A\x2A\x2A\x2A\x8B\x2A\xFF\x2A\x2A\x85\x2A\x75\x2A\x8B\x2A\x2A\x2A\x2A\x2A\x56\xE8\x2A\x2A\x2A\x2A\x5E\x8B\x2A\x5D\xC2" /// HLDS 2023
                "linux"             "@_ZN11CBasePlayer12CanPlayerBuyEb"
                "mac"               "@_ZN11CBasePlayer12CanPlayerBuyEb"
            }

            "CanBuyThis"            /// bool CanBuyThis(CBasePlayer *pPlayer, int iWeapon)
            {
                "library"           "server"
                /// "windows"       "\x53\x8B\x2A\x2A\x2A\x2A\x2A\x56\x8B\x2A\x2A\x2A\x57\x8B" /// HLDS 2020
                "windows"           "\x55\x8B\x2A\x53\x8B\x2A\x2A\x2A\x2A\x2A\x56\x8B\x2A\x2A\x8B\x2A\x57\xE8\x2A\x2A\x2A\x2A\x8B\x2A\x2A\x84\x2A\x74\x2A\x83\x2A\x2A\x0F\x2A\x2A\x2A\x2A\x2A\x8B\x2A\xE8\x2A\x2A\x2A\x2A\x84\x2A\x74\x2A\x83\x2A\x2A\x0F" /// HLDS 2023
                "linux"             "@_Z10CanBuyThisP11CBasePlayeri"
                "mac"               "@_Z10CanBuyThisP11CBasePlayeri"
            }

            "AddAccount"            /// void CBasePlayer::AddAccount(int amount, bool bTrackChange) [__thiscall]
            {
                "library"           "server"
                /// "windows"       "\x8B\x2A\x2A\x2A\x56\x8B\x2A\x8B\x2A\x2A\x2A\x2A\x2A\x03" /// HLDS 2020
                "windows"           "\x55\x8B\x2A\x8B\x2A\x2A\x56\x8B\x2A\x01\x2A\x2A\x2A\x2A\x2A\x79\x2A\xC7\x2A\x2A\x2A\x2A\x2A\x2A\x2A\x2A\x2A\xEB\x2A\x8B\x2A\x2A\x2A\x2A\x2A\xB9\x2A\x2A\x2A\x2A\x3B\x2A\x0F\x2A\x2A\x89\x2A\x2A\x2A\x2A\x2A\x8B\x2A\x2A\xFF\x2A\x2A\x2A\x2A\x2A\x6A\x2A\xFF" /// HLDS 2023
                "linux"             "@_ZN11CBasePlayer10AddAccountEib"
                "mac"               "@_ZN11CBasePlayer10AddAccountEib"
            }

            "GiveNamedItem"         /// void CBasePlayer::GiveNamedItem(const char *pszName) [__thiscall]
            {
                "library"           "server"
                /// "windows"       "\x8B\x2A\x2A\x2A\x56\x57\x8B\x2A\x8B\x2A\x2A\x2A\x2A\x2A\x2B" /// HLDS 2020
                "windows"           "\x55\x8B\x2A\xA1\x2A\x2A\x2A\x2A\x8B\x2A\x2A\x56\x57\x2B\x2A\x2A\x2A\x2A\x2A\x8B\x2A\x52\xE8\x2A\x2A\x2A\x2A\x8B\x2A\x83\x2A\x2A\x85\x2A\x74\x2A\x56\xFF\x2A\x2A\x2A\x2A\x2A\x83\x2A\x2A\x85\x2A\x74\x2A\x8B\x2A\x2A\x56\xF3\x2A\x2A\x2A\x2A\x66\x2A\x2A\x2A\x2A\x2A\x2A\x2A\x8B\x2A\x2A\x89" /// HLDS 2023
                "linux"             "@_ZN11CBasePlayer13GiveNamedItemEPKc"
                "mac"               "@_ZN11CBasePlayer13GiveNamedItemEPKc"
            }

            "GiveDefaultItems"      /// void CBasePlayer::GiveDefaultItems() [__thiscall]
            {
                "library"           "server"
                /// "windows"       "\x56\x57\x6A\x2A\x8B\x2A\xE8\x2A\x2A\x2A\x2A\x8B\x2A\x2A\x2A\x2A\x2A\xC6" /// HLDS 2020
                "windows"           "\x56\x6A\x2A\x8B\x2A\xE8\x2A\x2A\x2A\x2A\x8B\x2A\x2A\x2A\x2A\x2A\xC6\x2A\x2A\x2A\x2A\x2A\x2A\x83\x2A\x2A\x75\x2A\x68\x2A\x2A\x2A\x2A\x8B\x2A\xE8\x2A\x2A\x2A\x2A\x68\x2A\x2A\x2A\x2A\x8B\x2A\xE8\x2A\x2A\x2A\x2A\x80\x2A\x2A\x2A\x2A\x2A\x2A\x8B\x2A\x8B\x2A\x6A\x2A\x68" /// HLDS 2023
                "linux"             "@_ZN11CBasePlayer16GiveDefaultItemsEv"
                "mac"               "@_ZN11CBasePlayer16GiveDefaultItemsEv"
            }

            "GiveShield"            /// void CBasePlayer::GiveShield(bool bDeploy) [__thiscall]
            {
                "library"           "server"
                /// "windows"       "\x56\x8B\x2A\x57\x33\x2A\x8B\x2A\x2A\x2A\x2A\x2A\xB0" /// HLDS 2020
                "windows"           "\x55\x8B\x2A\x56\x8B\x2A\x8B\x2A\x2A\x2A\x2A\x2A\xC6\x2A\x2A\x2A\x2A\x2A\x2A\xC6\x2A\x2A\x2A\x2A\x2A\x2A\x85\x2A\x74\x2A\x80\x2A\x2A\x2A\x75\x2A\x8B\x2A\x2A\x2A\x2A\x2A\x83\x2A\x2A\x2A\x2A\x2A\x2A\x2A\x7E\x2A\x8B\x2A\x6A\x2A\xFF\x2A\x2A\x2A\x2A\x2A\x8B\x2A\x2A\x2A\x2A\x2A\x8B\x2A\xFF" /// HLDS 2023
                "linux"             "@_ZN11CBasePlayer10GiveShieldEb"
                "mac"               "@_ZN11CBasePlayer10GiveShieldEb"
            }

            "CreateNamedEntity"     /// edict_t* CREATE_NAMED_ENTITY(int iClass)
            {
                "library"           "server"
                /// "windows"       "\x56\x57\x8B\x2A\x2A\x2A\x57\xFF\x2A\x2A\x2A\x2A\x2A\x8B" /// HLDS 2020
                "windows"           "\x55\x8B\x2A\x56\xFF\x2A\x2A\xFF\x2A\x2A\x2A\x2A\x2A\x8B\x2A\x83\x2A\x2A\x85\x2A\x74\x2A\x8B\x2A\x2A\x2A\x2A\x2A\x6A\x2A\x8B\x2A\x2A\x2A\x2A\x2A\x03\x2A\x2A\x51\x8D\x2A\x2A\x2A\x2A\x2A\x51\xE8\x2A\x2A\x2A\x2A\x83\x2A\x2A\x8B\x2A\x5E\x5D\xC3" /// HLDS 2023
                "linux"             "@_Z19CREATE_NAMED_ENTITYj"
                "mac"               "@_Z19CREATE_NAMED_ENTITYj"
            }

            "FindEntityByString"    /// CBaseEntity *UTIL_FindEntityByString(CBaseEntity *pStartEntity, const char *szKeyword, const char *szValue)
            {
                "library"           "server"
                /// "windows"       "\x51\x8B\x2A\x2A\x2A\x53\x55\x56\x85\x2A\x57" /// HLDS 2020
                "windows"           "\x55\x8B\x2A\x51\x8B\x2A\x2A\x53\x56\x57\x85\x2A\x74\x2A\x8B\x2A\x2A\x8B\x2A\x2A\x2A\x2A\x2A\xEB\x2A\x33\x2A\x56\xFF\x2A\x2A\x2A\x2A\x2A\x8B\x2A\x2A\x83\x2A\x2A\x89\x2A\x2A\x80\x2A\x2A\x0F\x2A\x2A\x2A\x2A\x2A\xFF\x2A\x2A\x2A\x2A\x2A\xFF\x2A\x2A\xE8\x2A\x2A\x2A\x2A\x8B" /// HLDS 2023
                "linux"             "@_Z23UTIL_FindEntityByStringP11CBaseEntityPKcS2_"
                "mac"               "@_Z23UTIL_FindEntityByStringP11CBaseEntityPKcS2_"
            }

            "AddEntityHashValue"    /// void AddEntityHashValue(entvars_t *pev, const char *value, hash_types_e fieldType)
            {
                "library"           "server"
                /// "windows"       "\x8B\x2A\x2A\x2A\x83\x2A\x2A\x85\x2A\x53\x55\x56\x57\x0F" /// HLDS 2020
                "windows"           "\x55\x8B\x2A\x51\x83\x2A\x2A\x2A\x0F\x2A\x2A\x2A\x2A\x2A\x53\x8B\x2A\x2A\x83\x2A\x2A\x0F\x2A\x2A\x2A\x2A\x2A\xA1\x2A\x2A\x2A\x2A\x56\x57\x50\xFF\x2A\x2A\x89\x2A\x2A\xE8\x2A\x2A\x2A\x2A\xFF\x2A\x2A\x2A\x2A\x2A\x8B\x2A\xFF\x2A\x2A\x2A\x2A\x2A\x83\x2A\x2A\x89\x2A\x2A\xB9\x2A\x2A\x2A\x2A\x56\xE8" /// HLDS 2023
                "linux"             "@_Z18AddEntityHashValueP9entvars_sPKc12hash_types_e"
                "mac"               "@_Z18AddEntityHashValueP9entvars_sPKc12hash_types_e"
            }

            "RemoveEntityHashValue" /// void RemoveEntityHashValue(entvars_t *pev, hash_item_t *value, hash_types_e fieldType)
            {
                "library"           "server"
                /// "windows"       "\x8B\x2A\x2A\x2A\x53\x8B\x2A\x55\x8A\x2A\x33" /// HLDS 2020
                "windows"           "\x55\x8B\x2A\x8B\x2A\x2A\x33\x2A\x56\x57\x8A\x2A\x84\x2A\x74\x2A\x0F\x2A\x2A\x03\x2A\x2C\x2A\x3C\x2A\x77\x2A\x83\x2A\x2A\x8A\x2A\x2A\x41\x03\x2A\x84\x2A\x75\x2A\x8B\x2A\x33\x2A\xF7\x2A\x2A\x2A\x2A\x2A\x8B\x2A\x2A\x8B\x2A\xFF" /// HLDS 2023
                "linux"             "@_Z21RemoveEntityHashValueP9entvars_sPKc12hash_types_e"
                "mac"               "@_Z21RemoveEntityHashValueP9entvars_sPKc12hash_types_e"
            }

            "GetWeaponInfo"         /// const WeaponInfoStruct *GetWeaponInfo(int weaponID)
            {
                "library"           "server"
                /// "windows"       "\x8B\x2A\x2A\x2A\x2A\x2A\x33\x2A\x85\x2A\x56\x74\x2A\x8B" /// HLDS 2020
                "windows"           "\x55\x8B\x2A\xA1\x2A\x2A\x2A\x2A\x33\x2A\x85\x2A\x74\x2A\x8B\x2A\x2A\x3B\x2A\x74\x2A\x41\x8B\x2A\xC1\x2A\x2A\x8B\x2A\x2A\x2A\x2A\x2A\x85\x2A\x75\x2A\x33\x2A\x5D\xC3\xC1\x2A\x2A\x81\x2A\x2A\x2A\x2A\x2A\x8B\x2A\x5D\xC3" /// HLDS 2023
                "linux"             "@_Z13GetWeaponInfoi"
                "mac"               "@_Z13GetWeaponInfoi"
            }

            "GetAmmoIndex"          /// int CBasePlayer::GetAmmoIndex(const char *psz) [__thiscall]
            {
                "library"           "server"
                /// "windows"       "\x56\x57\x8B\x2A\x2A\x2A\x85\x2A\x74\x2A\xBE" /// HLDS 2020
                "windows"           "\x55\x8B\x2A\x53\x56\x57\x8B\x2A\x2A\x85\x2A\x74\x2A\x8B\x2A\x2A\x2A\x2A\x2A\xBE\x2A\x2A\x2A\x2A\x0F\x2A\x2A\x2A\x2A\x2A\x2A\x2A\x8B\x2A\x2A\x2A\x2A\x2A\x2A\x85\x2A\x74\x2A\x50\x57\xFF\x2A\x83\x2A\x2A\x85\x2A\x74" /// HLDS 2023
                "linux"             "@_ZN11CBasePlayer12GetAmmoIndexEPKc"
                "mac"               "@_ZN11CBasePlayer12GetAmmoIndexEPKc"
            }

            "BuyGunAmmo"            /// bool BuyGunAmmo(CBasePlayer *const player, CBasePlayerItem *const weapon, bool bBlinkMoney)
            {
                "library"           "server"
                /// "windows"       "\x56\x57\x8B\x2A\x2A\x2A\x6A\x2A\x8B\x2A\xE8\x2A\x2A\x2A\x2A\x84\x2A\x0F" /// HLDS 2020
                "windows"           "\x55\x8B\x2A\x56\x57\x8B\x2A\x2A\x8B\x2A\x6A\x2A\xE8\x2A\x2A\x2A\x2A\x84\x2A\x0F\x2A\x2A\x2A\x2A\x2A\x8B\x2A\x2A\x8B\x2A\x8B\x2A\xFF\x2A\x2A\x2A\x2A\x2A\x83\x2A\x2A\x0F\x2A\x2A\x2A\x2A\x2A\x8B\x2A\x2A\x2A\x2A\x2A\x8B\x2A\x2A\x2A\x2A\x2A\x2A\x6B\x2A\x2A\x3B\x2A\x2A\x2A\x2A\x2A\x0F\x2A\x2A\x2A\x2A\x2A\x8D\x2A\x2A\x83\x2A\x2A\x0F\x2A\x2A\x2A\x2A\x2A\xFF" /// HLDS 2023
                "linux"             "@_Z10BuyGunAmmoR11CBasePlayerR15CBasePlayerItemb"
                "mac"               "@_Z10BuyGunAmmoR11CBasePlayerR15CBasePlayerItemb"
            }
        }
    }

    "#default"
    {
        "Signatures"
        {
            "UseBotArgs"        /// bool UseBotArgs
            {
                "library"       "server"
                /// "windows"   "\x8B\x2A\x2A\x2A\x56\x8B\x2A\x8B\x2A\x2A\x2A\x2A\x2A\x03" /// HLDS 2020
                "windows"       "\x55\x8B\x2A\x8B\x2A\x2A\xA3\x2A\x2A\x2A\x2A\x8B\x2A\x2A\xA3\x2A\x2A\x2A\x2A\x8B\x2A\x2A\xA3\x2A\x2A\x2A\x2A\x8B\x2A\x2A\xA3\x2A\x2A\x2A\x2A\xC6\x2A\x2A\x2A\x2A\x2A\x2A\x8B\x2A\x2A\xFF\x2A\x2A\x2A\x2A\x2A\xE8\x2A\x2A\x2A\x2A\x83\x2A\x2A\xC6\x2A\x2A\x2A\x2A\x2A\x2A\x5D\xC2" /// HLDS 2023
                "linux"         "@UseBotArgs"
                "mac"           "@UseBotArgs"
            }                   /// void CBot::ClientCommand(const char *cmd, const char *arg1, const char *arg2, const char *arg3) [__thiscall]

            "BotArgs"           /// const char *BotArgs[4]
            {
                "library"       "server"
                /// "windows"   "\x8B\x2A\x2A\x2A\x56\x8B\x2A\x8B\x2A\x2A\x2A\x2A\x2A\x03" /// HLDS 2020
                "windows"       "\x55\x8B\x2A\x8B\x2A\x2A\xA3\x2A\x2A\x2A\x2A\x8B\x2A\x2A\xA3\x2A\x2A\x2A\x2A\x8B\x2A\x2A\xA3\x2A\x2A\x2A\x2A\x8B\x2A\x2A\xA3\x2A\x2A\x2A\x2A\xC6\x2A\x2A\x2A\x2A\x2A\x2A\x8B\x2A\x2A\xFF\x2A\x2A\x2A\x2A\x2A\xE8\x2A\x2A\x2A\x2A\x83\x2A\x2A\xC6\x2A\x2A\x2A\x2A\x2A\x2A\x5D\xC2" /// HLDS 2023
                "linux"         "@BotArgs"
                "mac"           "@BotArgs"
            }                   /// void CBot::ClientCommand(const char *cmd, const char *arg1, const char *arg2, const char *arg3) [__thiscall]
        }

        "Offsets"
        {
            "UseBotArgs"        /// bool UseBotArgs
            {
                /// "windows"   "2" /// HLDS 2020
                "windows"       "37" /// HLDS 2023
            }

            "BotArgs"           /// const char *BotArgs[4]
            {
                /// "windows"   "22" /// HLDS 2020
                "windows"       "7" /// HLDS 2023
            }
        }
    }

    "#default"
    {
        "ItemInfos"
        {
            "BuyAliases"
            {
                ///
                /// Weapon
                ///

                "p228"
                {
                    "itemid"    "1" /// CSW/I_P228
                    "classid"   "2" /// CS_WEAPONCLASS_PISTOL
                    "altname"   "228compact"
                }
                "scout"
                {
                    "itemid"    "3" /// CSW/I_SCOUT
                    "classid"   "8" /// CS_WEAPONCLASS_SNIPERRIFLE
                }
                "xm1014"
                {
                    "itemid"    "5" /// CSW/I_XM1014
                    "classid"   "5" /// CS_WEAPONCLASS_SHOTGUN
                    "altname"   "autoshotgun"
                }
                "mac10"
                {
                    "itemid"    "7" /// CSW/I_MAC10
                    "classid"   "4" /// CS_WEAPONCLASS_SUBMACHINEGUN
                }
                "aug"
                {
                    "itemid"    "8" /// CSW/I_AUG
                    "classid"   "7" /// CS_WEAPONCLASS_RIFLE
                    "altname"   "bullpup"
                }
                "elites"
                {
                    "itemid"    "10" /// CSW/I_ELITE
                    "classid"   "2" /// CS_WEAPONCLASS_PISTOL
                }
                "fn57"
                {
                    "itemid"    "11" /// CSW/I_FIVESEVEN
                    "classid"   "2" /// CS_WEAPONCLASS_PISTOL
                    "altname"   "fiveseven"
                }
                "ump45"
                {
                    "itemid"    "12" /// CSW/I_UMP45
                    "classid"   "4" /// CS_WEAPONCLASS_SUBMACHINEGUN
                }
                "sg550"
                {
                    "itemid"    "13" /// CSW/I_SG550
                    "classid"   "8" /// CS_WEAPONCLASS_SNIPERRIFLE
                    "altname"   "krieg550"
                }
                "galil"
                {
                    "itemid"    "14" /// CSW/I_GALIL
                    "classid"   "7" /// CS_WEAPONCLASS_RIFLE
                    "altname"   "defender"
                }
                "famas"
                {
                    "itemid"    "15" /// CSW/I_FAMAS
                    "classid"   "7" /// CS_WEAPONCLASS_RIFLE
                    "altname"   "clarion"
                }
                "usp"
                {
                    "itemid"    "16" /// CSW/I_USP
                    "classid"   "2" /// CS_WEAPONCLASS_PISTOL
                    "altname"   "km45"
                }
                "glock"
                {
                    "itemid"    "17" /// CSW/I_GLOCK18
                    "classid"   "2" /// CS_WEAPONCLASS_PISTOL
                    "altname"   "9x19mm"
                }
                "awp"
                {
                    "itemid"    "18" /// CSW/I_AWP
                    "classid"   "8" /// CS_WEAPONCLASS_SNIPERRIFLE
                    "altname"   "magnum"
                }
                "mp5"
                {
                    "itemid"    "19" /// CSW/I_MP5NAVY
                    "classid"   "4" /// CS_WEAPONCLASS_SUBMACHINEGUN
                    "altname"   "smg"
                }
                "m249"
                {
                    "itemid"    "20" /// CSW/I_M249
                    "classid"   "6" /// CS_WEAPONCLASS_MACHINEGUN
                }
                "m3"
                {
                    "itemid"    "21" /// CSW/I_M3
                    "classid"   "5" /// CS_WEAPONCLASS_SHOTGUN
                    "altname"   "12gauge"
                }
                "m4a1"
                {
                    "itemid"    "22" /// CSW/I_M4A1
                    "classid"   "7" /// CS_WEAPONCLASS_RIFLE
                }
                "tmp"
                {
                    "itemid"    "23" /// CSW/I_TMP
                    "classid"   "4" /// CS_WEAPONCLASS_SUBMACHINEGUN
                    "altname"   "mp"
                }
                "g3sg1"
                {
                    "itemid"    "24" /// CSW/I_G3SG1
                    "classid"   "8" /// CS_WEAPONCLASS_SNIPERRIFLE
                    "altname"   "d3au1"
                }
                "deagle"
                {
                    "itemid"    "26" /// CSW/I_DEAGLE
                    "classid"   "2" /// CS_WEAPONCLASS_PISTOL
                    "altname"   "nighthawk"
                }
                "sg552"
                {
                    "itemid"    "27" /// CSW/I_SG552
                    "classid"   "7" /// CS_WEAPONCLASS_RIFLE
                    "altname"   "krieg552"
                }
                "ak47"
                {
                    "itemid"    "28" /// CSW/I_AK47
                    "classid"   "7" /// CS_WEAPONCLASS_RIFLE
                    "altname"   "cv47"
                }
                "p90"
                {
                    "itemid"    "30" /// CSW/I_P90
                    "classid"   "4" /// CS_WEAPONCLASS_SUBMACHINEGUN
                    "altname"   "c90"
                }

                ///
                /// Equipment
                ///

                "hegren"
                {
                    "itemid"    "4" /// CSW/I_HEGRENADE
                    "classid"   "3" /// CS_WEAPONCLASS_GRENADE
                    "price"     "300"
                }
                "sgren"
                {
                    "itemid"    "9" /// CSW/I_SMOKEGRENADE
                    "classid"   "3" /// CS_WEAPONCLASS_GRENADE
                    "price"     "300"
                }
                "flash"
                {
                    "itemid"    "25" /// CSW/I_FLASHBANG
                    "classid"   "3" /// CS_WEAPONCLASS_GRENADE
                    "price"     "200"
                }
                "vest"
                {
                    "itemid"    "31" /// CSW/I_VEST
                    "classname" "item_kevlar"
                    "price"     "650"
                }
                "vesthelm"
                {
                    "itemid"    "32" /// CSW/I_VESTHELM
                    "classname" "item_assaultsuit"
                    "price"     "1000"
                }
                "defuser"
                {
                    "itemid"    "33" /// CSI_DEFUSER
                    "classname" "item_thighpack"
                    "price"     "200"
                }
                "nvgs"
                {
                    "itemid"    "34" /// CSI_NVGS
                    "price"     "1250"
                }
                "shield"
                {
                    "itemid"    "35" /// CSI_SHIELD
                    "classid"   "2" /// CS_WEAPONCLASS_PISTOL
                    "classname" "weapon_shield"
                }

                ///
                /// Ammunition
                ///

                "primammo"
                {
                    "itemid"    "36" /// CSI_PRIAMMO
                    "altname"   "buyammo1"
                }
                "secammo"
                {
                    "itemid"    "37" /// CSI_SECAMMO
                    "altname"   "buyammo2"
                }
            }
        }
    }
}

@ClaudiuHKS
Copy link
Contributor

ClaudiuHKS commented Jan 4, 2024

@stylez1989 to update hamdata, drop /dlls/mp.so | dod.so | hl.so to https://asherkin.github.io/vtable/ and type CBasePlayer, fill the offsets into the hamdata file. Then type CBasePlayerItem, fill offsets with _item, then CBasePlayerWeapon, fill offsets with _weapon. This is the only way. The names are very similar. This can be done for any HL1 game. If something is not clear, try CBaseEntity too. Hamdata file: F:\SteamCMDHL\steamapps\common\Half-Life\valve\addons\amxmodx\data\gamedata\common.games\virtual.games\valve\offsets-common.txt.

fysiks1 added a commit to fysiks1/amxmodx that referenced this issue Sep 13, 2024
From: alliedmodders#1086 (comment)

However, the author says that this is not fully functional.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

6 participants