Closed DarthMan closed 5 years ago
Get m_iId after you get the m_pActiveItem ID.
Yeah, true, but the amxx native is broken and must be fixed as well.
I am not sure if that's an issue related to the latest TFC beta update, but it probably is because it worked jsut fine in the past.
It returns 0 if player is not in-game. It's also possible that the value failed to be saved from CurWeapon
message (don't know if the message has been altered, probably not?)
Please show how do you test (provide a small working test code).
#pragma semicolon 1
#include <amxmodx>
public plugin_init()
{
register_clcmd("say /weaponid", "cmd_PlayerWeapon");
}
public cmd_PlayerWeapon(const iID)
{
client_print(iID, print_chat, "Weapon ID: %d", get_user_weapon(iID));
}
This always prints 0 to me. Edit: This must be tested on a TFC server running the latest beta build.
It returns 0 if player is not in-game. It's also possible that the value failed to be saved from
CurWeapon
message (don't know if the message has been altered, probably not?)Please show how do you test (provide a small working test code).
Also, any ideas why this happens whenever Rage loads a handler?
Problem is not solved. This seems to happen everytime I register the CurWeapon message, even if I'm not doing anything inside the function.
g_hMsgWeapon = get_user_msgid("CurWeapon"); register_message(g_hMsgWeapon, "OnChangeWeaponPlayer_Pre");
This makes the native return 0. If I remvoe these lines it returns the correct weapon id.
Likely you block the message where you should not. The native relies on this message. If you want a more reliable way, you should use the private data m_iID
as stated above.
I checked, it's not blocked. Just by hooking it, that happens.
Likely you block the message where you should not. The native relies on this message. If you want a more reliable way, you should use the private data
m_iID
as stated above.#pragma semicolon 1
public plugin_init() { register_clcmd("say /weaponid", "cmd_PlayerWeapon");
register_message(get_user_msgid("CurWeapon"), "OnChangeWeaponPlayer_Pre");
}
public cmd_PlayerWeapon(const iID) { client_print(iID, print_chat, "Weapon ID: %d", get_user_weapon(iID)); }
public OnChangeWeaponPlayer_Pre(const iMsgID, const iMsgDest, const iMsgEnt) {
}
Try this and see how it works.
It works..
Strange, when I applied that code it didn't work for me. Not sure if the issue had to do with Metamod -P, but I tested on my Linux server and it seemed to work fine there.
It works..
Any ideas why I get these errors? It seems to happen everytime Rage loads a handler. I tried the handlers from the AM website with updated signatures for TFC, except for FireBullets3 cuz it's CS-only, and it seems to crash all the time.
It works..
Any ideas why I get these errors? It seems to happen everytime Rage loads a handler. I tried the handlers from the AM website with updated signatures for TFC, except for FireBullets3 cuz it's CS-only, and it seems to crash all the time.
Github issues are not scripting help. You can't just ask questions about whatever problem you are facing with completely unrelated stuff. Please stick to the subject of the issue and post questions in the appropriate place.
Yeah, I know, but if I post in the right section I'll never ever get answers, because only Arkshine and joaquim know the fix and joaquim is long gone from the forum, Arkshine seems busy 24/7, he abrely even has time to fix AMXX issues.
It works..
https://imgur.com/a/7D7Hlkg Any ideas why I get these errors? It seems to happen everytime Rage loads a handler. I tried the handlers from the AM website with updated signatures for TFC, except for FireBullets3 cuz it's CS-only, and it seems to crash all the time.
Github issues are not scripting help. You can't just ask questions about whatever problem you are facing with completely unrelated stuff. Please stick to the subject of the issue and post questions in the appropriate place.
Yeah, I know, but if I post in the right section I'll never ever get answers, because only Arkshine and joaquim know the fix and joaquim is long gone from the forum, Arkshine seems busy 24/7, he abrely even has time to fix AMXX issues.
Also, I didn;t think there's anyone else owning a goldsrc server other than me that wants to use Rage. I know that people have 0 interest on it and most stuff that people want can be already achieved with Orpheu, but that's not my case, as I want to hook a function that has vectors as arguments and don't want to use Okapi because I prefer to have the signatures in files, similar to Orpheu.
Closing the issue as it was fixed with Metamod -P.
Hello. I noticed that on the game Team Fortress Classic get_user_weapon always returns 0. I did a simple debug in one of my plug-ins and it returned 0. Hope will be fixed in the upcomiung AMXX v.1.10 build. Using get_ent_data_entity(iID, "CBasePlayer", "m_pActiveItem") works correctly, as it returns the correct weapon entity id, but I don't need the entity id. Instead, I need the weapon id.