Closed pizzahut2 closed 3 years ago
[QUOTE=pizzahut;2703132] Looked into this today.
According to
https://github.com/alliedmodders/amxmodx/blob/master/modules/tfcx/CMisc.h
PD_HAS_GOALITEM is 26
This is correct for Windows.
I made this test plugin:
https://rv.apg-clan.org/dlds/amxx_plugins/flag_goal_item2.sma
And it's 24 on Linux. [/QUOTE]
[QUOTE=pizzahut;2696224] Since I updated the HLDS a few months ago, this plugin stopped working:
https://rv.apg-clan.org/dlds/amxx_plugins/bot_flag_drop21.sma
It looks like tfc_get_user_goalitem is always returning false, so I suspect that hamdata.ini needs updating.
Had this issue originally on v1.9, so upgraded to v1.10 and still happening.
How can I get an updated hamdata for TFC (Linux)?
version Protocol version 48 Exe version 1.1.2.2/Stdio (tfc) Exe build: 15:16:04 Jul 24 2019 (8308)
meta version Metamod v1.21p38 2018/02/11 (5:13) by Will Day [url] http://www.metamod.org/ [/url] Patch: Metamod-P (mm-p) v38 by Jussi Kivilinna [url] http://metamod-p.sourceforge.net/ [/url] compiled: Feb 11 2018, 11:05:06 EET (optimized)
amxx version AMX Mod X 1.10.0.5392 ([url] http://www.amxmodx.org [/url]) Authors:
#include <amxmodx>
#include <fakemeta>
new player_data[32][32]
public plugin_init()
{
register_plugin("flag goal item", "2", "pizzahut")
register_event("StatusIcon", "flag_grab", "b", "1=1", "2&flag_")
register_event("StatusIcon", "flag_drop", "b", "1=0", "2&flag_")
set_task(1.0, "update_player_data",_,_,_, "b")
}
public flag_grab(id)
{
new icon_name[32], player_name[32]
read_data(2, icon_name, charsmax(icon_name))
get_user_name(id, player_name, charsmax(player_name))
client_print(0, print_console, "%s picked up the %s flag.", player_name, icon_name[5])
//check_offsets(id)
}
public flag_drop(id)
{
new icon_name[32], player_name[32]
read_data(2, icon_name, charsmax(icon_name))
get_user_name(id, player_name, charsmax(player_name))
client_print(0, print_console, "%s dropped the %s flag.", player_name, icon_name[5])
//check_offsets(id)
}
public update_player_data()
{
static offset, players[32], num, i, id
get_players(players, num)
for(i=0; i<num; i++)
{
id = players[i]
check_offsets(id)
for(offset=12; offset<=29; offset++)
player_data[id][offset] = get_pdata_int(id, offset)
}
}
public check_offsets(id)
{
static offset
for(offset=12; offset<=29; offset++)
{
if (player_data[id][offset] != get_pdata_int(id, offset))
client_print(0, print_console, "offset %d: %d => %d", offset, player_data[id][offset], get_pdata_int(id, offset))
}
}
Are you sure? I believe 30 is correct for linux. Your plugin doesn't log after 29, can you try again to make sure? The HL update should not have changed those offsets.
No I'm actually not sure. Couldn't get other TFC admins to check and no response on forum so there's zero confirmation. Anyway updated the test plugin:
Testing result with this correction: offset 26 for Windows and Linux.
https://rv.apg-clan.org/dlds/amxx_plugins/flag_goal_item2.sma
#include <amxmodx>
#include <fakemeta>
new player_data[32][32]
#define linux_diff 3
public plugin_init()
{
register_plugin("flag goal item", "2", "pizzahut")
register_event("StatusIcon", "flag_grab", "b", "1=1", "2&flag_")
register_event("StatusIcon", "flag_drop", "b", "1=0", "2&flag_")
set_task(1.0, "update_player_data",_,_,_, "b")
}
public flag_grab(id)
{
new icon_name[32], player_name[32]
read_data(2, icon_name, charsmax(icon_name))
get_user_name(id, player_name, charsmax(player_name))
client_print(0, print_console, "%s picked up the %s flag.", player_name, icon_name[5])
//check_offsets(id)
}
public flag_drop(id)
{
new icon_name[32], player_name[32]
read_data(2, icon_name, charsmax(icon_name))
get_user_name(id, player_name, charsmax(player_name))
client_print(0, print_console, "%s dropped the %s flag.", player_name, icon_name[5])
//check_offsets(id)
}
public update_player_data()
{
static offset, players[32], num, i, id
get_players(players, num)
for(i=0; i<num; i++)
{
id = players[i]
check_offsets(id)
for(offset=12; offset<=30; offset++)
player_data[id][offset] = get_pdata_int(id, offset, linux_diff)
}
}
public check_offsets(id)
{
static offset
for(offset=12; offset<=30; offset++)
{
if (player_data[id][offset] != get_pdata_int(id, offset, linux_diff))
client_print(0, print_console, "offset %d: %d => %d", offset, player_data[id][offset], get_pdata_int(id, offset, linux_diff))
}
}
Offsets in tfcx should be corrected according to gamedata just like in dodfun. Not sure about this member but someone reported a problem with heal/poison timers.
I see this in amxmodx/data/gamedata/common.games/entities.games/tfc/offsets-cbaseentity.txt :
"is_unableto_spy_or_teleport" // BOOL
{
"type" "integer"
"windows" "104"
"linux" "120"
"mac" "120"
}
@pizzahut2 note that it should be divided by 4.
Related to this, tfc_setbammo is broken, too (on Linux). When trying to set TFC_AMMO_NADE1 and TFC_AMMO_NADE2, it changes TFC_AMMO_NADE2 and the grenade type of the primary grenades (instead of the count).
So for the following plugin, which used to work fine, now when you capture the flag as medic, you throw nail grenades as primary because of this issue. https://forums.alliedmods.net/showthread.php?t=69829 This is not a plugin issue, but an AMXX issue.
This has been happening on Battlezone and I re-produced this bug on Royston Vasey. (Though I'm going to turn the plugin off on the latter.)
Private data from an old Allied Modders thread:
int no_grenades_1; /* 72 4 */
int no_grenades_2; /* 76 4 */
int tp_grenades_1; /* 80 4 */
int tp_grenades_2; /* 84 4 */
Server 1 (Battlezone):
(EDIT: Two days later, this server has switched to ReHLDS, with the issue still present.)
version Protocol version 48 Exe version 1.1.2.2/Stdio (tfc) Exe build: 19:52:19 Aug 3 2020 (8684)
meta version Metamod v1.21p38 2018/02/11 (5:13)
amxx version AMX Mod X 1.10.0.5435 (http://www.amxmodx.org)
Server 2 (Royston Vasey):
version Protocol version 48 Exe version 1.1.2.2/Stdio (tfc) Exe build: 19:52:19 Aug 3 2020 (8684)
meta version Metamod v1.21p-APG 2020/03/30 (5:13) Patch: Metamod-P (mm-p) v39
amxx version AMX Mod X 1.9.0.5281 (http://www.amxmodx.org)
Turned out both test servers still had an old "tfc_i386.so" file which took precedence over the newer "tfc.so" library, so both servers were misconfigured and that's why the offsets didn't work.
PD_HAS_GOALITEM in amxmodx/modules/tfcx/CMisc.h seems to require a different "linuxdiff" for get_pdata_int on the latest HLDS (not beta). Without adjusting linuxdiff, I need to use offset 24 instead of 26 for Linux.
Maybe I'm doing something wrong, would it help to update hamdata and how would I do this?
Detailed information: https://forums.alliedmods.net/showthread.php?t=323687
Example plugin which uses tfc_get_user_goalitem and thus broke on Linux: https://rv.apg-clan.org/dlds/amxx_plugins/bot_flag_drop21.sma (Bot in same team should drop flag if a human is near, or suicide if the map has disabled flag throws.)
Plugin for testing private data access: https://rv.apg-clan.org/dlds/amxx_plugins/flag_goal_item2.sma
Affects: http://www.amxmodx.org/api/tfcx/tfc_get_user_goalitem https://github.com/alliedmodders/amxmodx/blob/master/modules/tfcx/CMisc.h