AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Module Coding (https://forums.alliedmods.net/forumdisplay.php?f=9)
-   -   tfcx bug (https://forums.alliedmods.net/showthread.php?t=239548)

urban_ninja 04-29-2014 13:06

tfcx bug
 
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.

Arkshine 04-29-2014 14:59

Re: tfcx bug
 
More infos would be welcomed + test plugin.

urban_ninja 04-29-2014 15:46

Re: tfcx bug
 
Specify what info you need so I know what to tell you.

Arkshine 04-29-2014 16:27

Re: tfcx bug
 
Actually, just a simple test plugin which shows the issue should be enough to explain.

urban_ninja 04-30-2014 04:52

Re: tfcx bug
 
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

Arkshine 04-30-2014 05:35

Re: tfcx bug
 
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.

urban_ninja 04-30-2014 15:14

Re: tfcx bug
 
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.

Arkshine 04-30-2014 16:55

Re: tfcx bug
 
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_* .

claudiuhks 04-30-2014 23:54

Re: tfcx bug
 
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);
    }
  }



urban_ninja 05-01-2014 01:26

Re: tfcx bug
 
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?


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

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