AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   [Help] ent (https://forums.alliedmods.net/showthread.php?t=312613)

Fuck For Fun 12-09-2018 12:40

[Help] ent
 
Quote:

L 12/09/2018 - 18:28:21: [FAKEMETA] Invalid entity
L 12/09/2018 - 18:28:21: [AMXX] Displaying debug trace (plugin "jailbreak_ball.amxx", version "2.1")
L 12/09/2018 - 18:28:21: [AMXX] Run time error 10: native error (native "pev")
L 12/09/2018 - 18:28:21: [AMXX] [0] jailbreak_ball.sma::FwdTouch (line 898)
Code:

public FwdTouch(ent, id)
{
        static szNameEnt[32], szNameId[32]
        pev(ent, pev_classname, szNameEnt, sizeof szNameEnt - 1)
        pev(id, pev_classname, szNameId, sizeof szNameId - 1)
       
        static Float:fGameTime
        fGameTime = get_gametime()
       
        if(equal(szNameEnt, "JailNet") && equal(szNameId, g_szBallName) && (fGameTime - g_fLastTouch) > 0.1)
        {
                Goal()
                g_fLastTouch = fGameTime
        }
}

Should I do a test of pev ENT?

Bugsy 12-09-2018 12:57

Re: [Help] ent
 
Show how you are registering the touch. If that is good, I would just add a pev_valid() test on ent at the very top.

Fuck For Fun 12-09-2018 13:02

Re: [Help] ent
 
Quote:

Originally Posted by Bugsy (Post 2627919)
Show how you are registering the touch. If that is good, I would just add a pev_valid() test on ent at the very top.

ok...
Code:

register_forward(FM_Touch, "FwdTouch", 0)

Natsheh 12-09-2018 13:49

Re: [Help] ent
 
As bugsy said check if ent and id are greater than 0

Fuck For Fun 12-09-2018 14:08

Re: [Help] ent
 
Quote:

Originally Posted by Natsheh (Post 2627930)
As bugsy said check if ent and id are greater than 0

Yes I know, I just wanted to know if that was the way so I wrote it down in the first post under the code.
Quote:

if(!pev_valid(ent))
return FMRES_IGNORED

Fuck For Fun 12-09-2018 19:34

Re: [Help] ent
 
still error
Code:

public FwdTouch(ent, id)
{
        if(!pev_valid(ent))
                return FMRES_IGNORED
               
        static szNameEnt[32], szNameId[32]
        pev(ent, pev_classname, szNameEnt, sizeof szNameEnt - 1)
        pev(id, pev_classname, szNameId, sizeof szNameId - 1) // line 902
       
        static Float:fGameTime
        fGameTime = get_gametime()
       
        if(equal(szNameEnt, "JailNet") && equal(szNameId, g_szBallName) && (fGameTime - g_fLastTouch) > 0.1)
        {
                Goal()
                g_fLastTouch = fGameTime
        }
       
        return FMRES_IGNORED
}

Quote:

L 12/10/2018 - 01:16:00: [FAKEMETA] Invalid entity
L 12/10/2018 - 01:16:00: [AMXX] Run time error 10: native error (native "pev")
L 12/10/2018 - 01:16:00: [AMXX] [0] jailbreak_ball.sma::FwdTouch (line 902)
im using 1.9.0 amxx

Bugsy 12-09-2018 19:59

Re: [Help] ent
 
Think about it.. If it is saying the line being called on 'id' is resulting in an invalid entity error, this means you should also put a check on the entity associated with 'id'.
PHP Code:

if ( !pev_valident ) || !pev_validid ) )
        return 
FMRES_IGNORED 



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

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