Raised This Month: $12 Target: $400
 3% 

tfcx bug


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
urban_ninja
Senior Member
Join Date: Feb 2009
Old 04-29-2014 , 13:06   tfcx bug
Reply With Quote #1

Could someone please fix the tfc_setweaponammo() function in the tfcx module? It doesn't work.

Moreover, when this function gets called, some core amxx functions start glitching as well as functions from other modules. No amxx errors where showing up which either. Once tfc_setweaponammo() is removed from plugin amxx and its modules starts behaving as normal.

Last edited by urban_ninja; 04-29-2014 at 14:33.
urban_ninja is offline
Arkshine
AMX Mod X Plugin Approver
Join Date: Oct 2005
Old 04-29-2014 , 14:59   Re: tfcx bug
Reply With Quote #2

More infos would be welcomed + test plugin.
__________________
Arkshine is offline
urban_ninja
Senior Member
Join Date: Feb 2009
Old 04-29-2014 , 15:46   Re: tfcx bug
Reply With Quote #3

Specify what info you need so I know what to tell you.
urban_ninja is offline
Arkshine
AMX Mod X Plugin Approver
Join Date: Oct 2005
Old 04-29-2014 , 16:27   Re: tfcx bug
Reply With Quote #4

Actually, just a simple test plugin which shows the issue should be enough to explain.
__________________
Arkshine is offline
urban_ninja
Senior Member
Join Date: Feb 2009
Old 04-30-2014 , 04:52   Re: tfcx bug
Reply With Quote #5

PHP Code:
#include <amxmodx>
#include <amxmisc>
#include <hamsandwich>
#include <tfcx>

#define PLUGIN "New Plug-In"
#define VERSION "1.0"
#define AUTHOR "author"


public plugin_init() {
    
register_plugin(PLUGINVERSIONAUTHOR)
    
    
RegisterHam(Ham_TakeDamage"player""damage")
}
public 
damage(victimwpnattackerFloat:dmgbit)
{
    
tfc_setweaponammo(wpn4)

The include says "Index must be weapon's entity index" but TFCX is now getting an error saying "Non-player entity # out of range" every time a hit is made by a projectile or hitscan. I've tried getting wepaon index though get_user_weapon() and no weapon index returned valid to this function. Something is broken somewhere for weapon ents returned to not actually be valid. Not sure whats going on with it

Last edited by urban_ninja; 04-30-2014 at 05:13.
urban_ninja is offline
Arkshine
AMX Mod X Plugin Approver
Join Date: Oct 2005
Old 04-30-2014 , 05:35   Re: tfcx bug
Reply With Quote #6

This native expects a weapon entity. Are you sure the inflictor "wpn" is the weapon index here?

Anyway this natives just set an offset on a weapon. You most likely don't use it properly.
__________________

Last edited by Arkshine; 04-30-2014 at 05:36.
Arkshine is offline
urban_ninja
Senior Member
Join Date: Feb 2009
Old 04-30-2014 , 15:14   Re: tfcx bug
Reply With Quote #7

It has with some weapons in the past. You asked for a test plugin so I tossed one together. I've tried get_user_weapon() to get the weapon entity but tfcx still rejects it. If none of the means to get the weapon entity return values acceptable to tfcx, then how the heck is tfc_setweaponammo() even workable? It doesn't seem anything is compatible with tfc_setweaponammo(). This function is too temperamental to work with and pretty much useless when nothing returns weapon ent values it can accept.

Last edited by urban_ninja; 04-30-2014 at 15:25.
urban_ninja is offline
Arkshine
AMX Mod X Plugin Approver
Join Date: Oct 2005
Old 04-30-2014 , 16:55   Re: tfcx bug
Reply With Quote #8

Tested tfc_getweaponammo and it works fine, but it's expected, it just sets some offset. All you need to provide is a weapon index. That's not something you will get from inflictor in TakeDamage, generally such index is the weapon projectile.

Also, get_user_weapon doesn't return the weapon index, but the identifier TFC_WPN_* .
__________________

Last edited by Arkshine; 04-30-2014 at 16:57.
Arkshine is offline
claudiuhks
Yam Inside®™℠
Join Date: Jan 2010
Location: Living Randomly
Old 04-30-2014 , 23:54   Re: tfcx bug
Reply With Quote #9

Something you can do:

PHP Code:
FillAllOwnedWeapons(const weap_name[])
{
  static 
= -10;
  
= -1;
 
  while (
pev_valid((engfunc(EngFunc_FindEntityByStringe"classname"weap_name))))
  {
    
pev(epev_owner);
 
    if (
pev_valid(o) && is_user_connected(o))
    {
      
tfc_setweaponammo(e4);
    }
  }

__________________
claudiuhks is offline
Send a message via MSN to claudiuhks Send a message via Yahoo to claudiuhks Send a message via Skype™ to claudiuhks
urban_ninja
Senior Member
Join Date: Feb 2009
Old 05-01-2014 , 01:26   Re: tfcx bug
Reply With Quote #10

So theres no singular function for getting weapon entity? If I remember correctly, find entity by class only returns the 1st match it finds and then stops there.

Sorry for reporting this one as a bug. Looked like a bug when HLDS wasn't displaying errors making it hard to find out what was going on until I restarted it.

When you say offset you mean the private data offset right? Would set_pdata_* be an alternative? What kind of private data is it and what is its offset?

Last edited by urban_ninja; 05-01-2014 at 01:31.
urban_ninja is offline
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 18:18.


Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.
Theme made by Freecode