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

Problem with amxx-dev-git4917


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
wicho
Veteran Member
Join Date: Feb 2012
Location: GuateAmala
Old 10-21-2015 , 03:21   Problem with amxx-dev-git4917
Reply With Quote #1

Hi everybody, well I update to amxx-dev-git4917 and I have a problem with nademodes plugin (plugin not work), this is the error:

L 10/21/2015 - 00:026: [ENGINE] Entity out of range (-1)
L 10/21/2015 - 00:026: [AMXX] Displaying debug trace (plugin "nademodes.amxx", version "11.2")
L 10/21/2015 - 00:026: [AMXX] Run time error 10: native error (native "entity_get_int")
L 10/21/2015 - 00:026: [AMXX] [0] nademodes.sma::is_solid (line 4450)
L 10/21/2015 - 00:026: [AMXX] [1] nademodes.sma::fw_touch (line 3387)

line 4450:

PHP Code:
public bool:is_solid(ent)
{
    
// Here we account for ent = 0, where 0 means it's part of the map (and therefore is solid)
    
return ( ent ? ( (entity_get_int(entEV_INT_solid) > SOLID_TRIGGER) ? true false ) : true )

line 3387:

PHP Code:
public fw_touch(touchertouched)
{
    if (!(
bs_forward_collection FWD_TOUCH))
        return 
HAM_IGNORED
    
    
switch (get_grenade_type(toucher))
    {
        case 
NADE_IMPACT:
        {
            if (
is_solid(touched)) // this is the line
            
{
                
make_explode(toucher)
                
                
entity_set_float(toucherEV_FL_nextthinkget_gametime() + 0.001)
                
                if (
NadeRace:get_grenade_race(toucher) == GRENADE_SMOKEGREN)
                {
                    
entity_set_int(toucherEV_INT_flagsentity_get_int(toucherEV_INT_flags) | FL_ONGROUND)
                }
            }
        } 
How I can fix this? ... thx in advance

Last edited by wicho; 10-21-2015 at 03:32.
wicho is offline
Arkshine
AMX Mod X Plugin Approver
Join Date: Oct 2005
Old 10-21-2015 , 03:44   Re: Problem with amxx-dev-git4917
Reply With Quote #2

Not sure why you got -1, but you should always check if an entity is valid before doing something. Use something like "pev_valid" or "is_valid_ent". In your specific case, you're basically doing "if (-1)" which will returns true because value is non-zero. To check properly positive value, you should do "ent > 0 ?".
__________________

Last edited by Arkshine; 10-21-2015 at 03:50.
Arkshine is offline
wicho
Veteran Member
Join Date: Feb 2012
Location: GuateAmala
Old 10-27-2015 , 11:05   Re: Problem with amxx-dev-git4917
Reply With Quote #3

Thx for the help, I have only another question I found this error in the same code:

L 10/27/2015 - 00:00:07: [ENGINE] Entity out of range (-1)
L 10/27/2015 - 00:00:07: [AMXX] Displaying debug trace (plugin "nademodes.amxx", version "11.2")
L 10/27/2015 - 00:00:07: [AMXX] Run time error 10: native error (native "entity_get_string")
L 10/27/2015 - 00:00:07: [AMXX] [0] nademodes.sma::fw_takedamage (line 3473)

PHP Code:
public fw_takedamage(victiminflictorattackerFloat:damagedamagebits)
{
    if (!(
bs_forward_collection FWD_TAKEDAMAGE))
        return 
HAM_IGNORED
    
    
static aclassname[7], iclassname[8]
    
    
entity_get_string(attacker,  EV_SZ_classnameaclassnamecharsmax(aclassname)) // this is the line
    
entity_get_string(inflictor,  EV_SZ_classnameiclassnamecharsmax(iclassname))
    
    if ((
damagebits DMG_BLAST))
        return 
HAM_IGNORED
    
    
if (!equal(aclassname"player") || !equal(iclassname"grenade"))
        return 
HAM_IGNORED
    
    
if (attacker == victim)
    {
        
damage *= (get_option_float(OPTION_DMG_SELF) / 100.0)
    }
    else
    {
        if (
cl_team[attacker] == cl_team[victim] && get_option(OPTION_FRIENDLY_FIRE))
        {
            
damage *= 0.02 get_option_float(OPTION_DMG_TEAMMATES)
        }
    }
    
    static 
Float:origin[3], Float:user_origin[3], Float:fraction
    
    entity_get_vector
(victimEV_VEC_originuser_origin)
    
entity_get_vector(inflictorEV_VEC_originorigin)
    
origin[2] += 2.0
    engfunc
(EngFunc_TraceLineuser_originoriginIGNORE_MONSTERSvictimg_ptrace[TH_DMG])

    
get_tr2(g_ptrace[TH_DMG], TR_flFractionfraction)
    
    if (
fraction 1.0)
    {
        
damage *= (get_option_float(OPTION_DMG_THROUGH_WALL) / 100.0)
    }
    
    if ( 
get_option(OPTION_DAMAGE_SYSTEM) == 1)
    {
        
damage *= get_option_float(OPTION_DMG_NORMAL)
    }
    else
    {
        new 
type _:get_grenade_type(inflictor)
        
type &= ~NADE_DONT_COUNT
        
        
switch ( type )
        {
            case 
NADE_NORMAL:
            {
                
damage *= get_option_float(OPTION_DMG_NORMAL)
            }
            
            case 
NADE_PROXIMITY:
            {
                
damage *= get_option_float(OPTION_DMG_PROXIMITY)
            }
            
            case 
NADE_IMPACT:
            {
                
damage *= get_option_float(OPTION_DMG_IMPACT)
            }
            
            case 
NADE_TRIP:
            {
                
damage *= get_option_float(OPTION_DMG_TRIP)
            }
            
            case 
NADE_MOTION:
            {
                
damage *= get_option_float(OPTION_DMG_MOTION)
            }
            
            case 
NADE_SATCHEL:
            {
                
damage *= get_option_float(OPTION_DMG_SATCHEL)
            }
            
            case 
NADE_HOMING:
            {
                
damage *= get_option_float(OPTION_DMG_HOMING)
            }
            
            default:
            {
                
damage *= get_option_float(OPTION_DMG_NORMAL)
            }
        }
    }
    
    
SetHamParamFloat(4damage)
    
    return 
HAM_HANDLED

Is for the same or something else?

Last edited by wicho; 10-27-2015 at 11:06.
wicho is offline
Arkshine
AMX Mod X Plugin Approver
Join Date: Oct 2005
Old 10-27-2015 , 11:41   Re: Problem with amxx-dev-git4917
Reply With Quote #4

The answer is the same.
A valid index is between 1 and max entities (for players, it's up to server max slots, so if 32 slots, a player can have 32 as index. Above it's for non-players entities).

When you get -1, this usually means that the value passed internally in module is null or invalid, and in such case -1 is always returned. That's why you should always check if entity is valid before doing something.

I'm concerned though why you get -1, that's not something you should get from game, especially from this forward, unless you have plugins altering such param and passing a wrong value. Just for the sake of understanding, you should try to debug, logging such params value and trying to understand in what situation you get -1. I don't think there is an issue with latest changes in dev build, but just to be sure, it would help if you could reproduce this behavior.
__________________

Last edited by Arkshine; 10-27-2015 at 11:42.
Arkshine is offline
wicho
Veteran Member
Join Date: Feb 2012
Location: GuateAmala
Old 10-27-2015 , 11:58   Re: Problem with amxx-dev-git4917
Reply With Quote #5

It is strange because with version 1.8.2 I dont have errors or problems, work fine, and no I do not use plugins that altered..

Last edited by wicho; 10-27-2015 at 12:42.
wicho is offline
Arkshine
AMX Mod X Plugin Approver
Join Date: Oct 2005
Old 10-27-2015 , 13:52   Re: Problem with amxx-dev-git4917
Reply With Quote #6

Let's assume the changes recently doesn't work well.

What I want to know is: doesn't it happen always? do you have an easy way to reproduce the issue?
__________________
Arkshine is offline
wicho
Veteran Member
Join Date: Feb 2012
Location: GuateAmala
Old 10-27-2015 , 14:34   Re: Problem with amxx-dev-git4917
Reply With Quote #7

Yes, this appears when I select the mode called "trip laser" this mode dont work, apart I found another error, the samething:

L 10/27/2015 - 05:43:04: [ENGINE] Entity out of range (-1)
L 10/27/2015 - 05:43:04: [AMXX] Displaying debug trace (plugin "nademodes.amxx", version "11.2")
L 10/27/2015 - 05:43:04: [AMXX] Run time error 10: native error (native "entity_get_string")
L 10/27/2015 - 05:43:04: [AMXX] [0] nademodes.sma::fw_touch (line 3406)

PHP Code:
public fw_touch(touchertouched)
{
    if (!
pev_valid(toucher))
                return 
HAM_IGNORED
    
    
if (!(bs_forward_collection FWD_TOUCH))
        return 
HAM_IGNORED
    
    
switch (get_grenade_type(toucher))
    {
        case 
NADE_IMPACT:
        {
            if (
is_solid(touched))
            {
                
make_explode(toucher)
                
                
entity_set_float(toucherEV_FL_nextthinkget_gametime() + 0.001)
                
                if (
NadeRace:get_grenade_race(toucher) == GRENADE_SMOKEGREN)
                {
                    
entity_set_int(toucherEV_INT_flagsentity_get_int(toucherEV_INT_flags) | FL_ONGROUND)
                }
            }
        }
        
        case 
NADE_TRIP:
        {
            static 
classname[10]
/* This is the line */ entity_get_string(touchedEV_SZ_classnameclassnamecharsmax(classname))
            
            if (
get_trip_grenade_mode(toucher) > TRIP_NOT_ATTACHED || is_user_connected(touched))
            {
                return 
HAM_IGNORED
            
}
            else
            {
                if (
is_solid(touched))
                {
                    
entity_set_int(toucherEV_INT_movetypeMOVETYPE_NONE)
                    
set_trip_grenade_mode(toucherTRIP_ATTACHED)
                    return (
containi(classname"door") != -1) ? HAM_SUPERCEDE HAM_IGNORED
                
}
            }
        }
    }
    
    return 
HAM_IGNORED

Its strange because I already check if the entity is valid..

Last edited by wicho; 10-27-2015 at 14:38.
wicho is offline
Arkshine
AMX Mod X Plugin Approver
Join Date: Oct 2005
Old 11-06-2015 , 06:58   Re: Problem with amxx-dev-git4917
Reply With Quote #8

Okay, thanks to IgnacioFDM (#306), It makes sense now why you were getting -1, it's because you were touching worldspawn and you were supposed to get 0 instead. It should be fixed in latest build.

But keep in mind you should anyway always checking an entity. In the above code, you don't check "touched".
__________________

Last edited by Arkshine; 11-06-2015 at 06:59.
Arkshine is offline
granitebloated424
New Member
Join Date: Oct 2016
Old 10-16-2016 , 06:32   Re: Problem with amxx-dev-git4917
Reply With Quote #9

Quote:
Originally Posted by wicho View Post
Hi everybody, well I update to amxx-dev-git4917 and I have a problem with nademodes plugin (plugin not work), this is the error:
Also facing such kind of errors
granitebloated424 is offline
indraraj striker
Veteran Member
Join Date: Mar 2014
Location: Under the water
Old 10-16-2016 , 08:38   Re: Problem with amxx-dev-git4917
Reply With Quote #10

Quote:
Originally Posted by granitebloated424 View Post
Also facing such kind of errors
Quote:
Originally Posted by Arkshine View Post
Okay, thanks to IgnacioFDM (#306), It makes sense now why you were getting -1, it's because you were touching worldspawn and you were supposed to get 0 instead. It should be fixed in latest build.

But keep in mind you should anyway always checking an entity. In the above code, you don't check "touched".
update amxmodx http://www.amxmodx.org/snapshots.php 5073
__________________
Thanks everyone. #miss_you_all

Last edited by indraraj striker; 10-16-2016 at 08:39.
indraraj striker is offline
Reply



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 12:43.


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