AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   What is this? (https://forums.alliedmods.net/showthread.php?t=215341)

Spy123 05-06-2013 14:43

What is this?
 
L 05/06/2013 - 21:28:59: [ENGINE] Invalid player 0 (not in-game)
L 05/06/2013 - 21:28:59: [AMXX] Displaying debug trace (plugin "watf.amxx")
L 05/06/2013 - 21:28:59: [AMXX] Run time error 10: native error (native "entity_range")
L 05/06/2013 - 21:28:59: [AMXX] [0] float.inc::operator>(Float:,Float:) (line 138)
L 05/06/2013 - 21:28:59: [AMXX] [1] watf.sma::client_PreThink (line 3578)

In every second i've got this errors on console...

At the line 138 I have:
PHP Code:

#define AMOUNTAGI        "CANT_AGILIDAD_POR_LVL" 

and At the line 3578 I have:
PHP Code:

if(entity_range(idferencere) > maxdistance && entity_range(iddistancemax) > maxdistancem

Someone can explain me?

yan1255 05-06-2013 15:55

Re: What is this?
 
i think for the
Quote:

L 05/06/2013 - 21:28:59: [ENGINE] Invalid player 0 (not in-game)
you should use
Quote:

if ( is_user_connected( index ) )
and explain what are you doing and give a little bigger examples of the plugin...

YakumoHiratsuhi 05-06-2013 15:58

Re: What is this?
 
You get that many errors because you badcoded something in the recursive function client_prethink() you probably did something wrong when passing the parameters in that native, as far as i can see, you passed an invalid data type.

Would you mind posting your client_prethink() code?

Spy123 05-07-2013 12:11

Re: What is this?
 
This is it:

PHP Code:

public client_PreThink(id)
{
    if( 
is_kickball && is_valid_ent(aball) && is_user_connected(id))
    {
        new 
button entity_get_int(idEV_INT_button)
        new 
relode = (button IN_RELOAD)
        new 
usekey = (button IN_USE)
        new 
up = (button IN_FORWARD)
        new 
down = (button IN_BACK)
        new 
moveright = (button IN_MOVERIGHT)
        new 
moveleft = (button IN_MOVELEFT)
        new 
jump = (button IN_JUMP)
        new 
flags entity_get_int(idEV_INT_flags)
        new 
onground flags FL_ONGROUND
        
if( (moveright || moveleft) && !up && !down && jump && onground && !g_sprint[id] && id != ballholder)
            
SideJump[id] = 1
        
        
if(!Coord_Off_Z_active)
        {
            if(
onground)
            {
                new 
User_Origin[3]
                
get_user_origin(idUser_Origin)
                
Coord_Off_Z_active 1
                Coord_Off_Z 
User_Origin[2] - 35
                Coord_Off_Y 
User_Origin[1]
            }
        }

        if(
ballholder 0)
        {
            
no_ball 1
            entity_set_float
(aball,EV_FL_framerate,0.0)
            
entity_set_int(aball,EV_INT_sequence,0)
        }
        else
        {
            if(
no_ball)
            {
                
no_ball 0
                entity_set_int
(aballEV_INT_sequence2);
                
entity_set_float(aballEV_FL_framerate22.0);
            }
        }

        
        
        if(
relode)
        {
            
        
entity_set_float(idEV_FL_framerate0.0);    //FLY CHARGE
        
entity_set_int(idEV_INT_sequence54);
        
entity_set_float(idEV_FL_animtime1.0)
        }



        if(
g_sprint[id])
            
entity_set_float(idEV_FL_fuser20.0)
            

        if( 
id != ballholder )
            
PressedAction[id] = usekey
        
else 
        {
            if( 
usekey && !PressedAction[id]) 
            {
                
kickBall(ballholder0)
                        
                if(
get_pcvar_num(CVAR_OFFSIDE))
                    
Adelantado(id)                    
            }
            else if( !
usekey && PressedAction[id])
                
PressedAction[id] = 0
        
}    
        
        if(
soy_spec[id] || is_user_foul[id] || is_offside[id])
        {
            if((
button IN_ATTACK || button IN_ATTACK2)) 
                
entity_set_int(idEV_INT_button, (button & ~IN_ATTACK) & ~IN_ATTACK2)
        }

/****************************************************************** FRAG O NO FRAG ************************************************************************/
        
new auxiliar get_pcvar_num(CVAR_FRAG)
        if(!
auxiliar)
        {
            if( 
id != ballholder && (button IN_ATTACK || button IN_ATTACK2) ) 
            {

/****************************************************************** FRAG EN AREA ************************************************************************/
            
                
static Float:maxdistance
                
static Float:maxdistancem
                
static ferencere
                
static distancemax

                
new fteam get_user_team(id)
            
                
distancemax Mascots[fteam]
                
maxdistancem get_pcvar_float(CVAR_KILLNEARAREA)
                
                if(
ballholder 0
                {
                    
ferencere ballholder
                    maxdistance 
get_pcvar_float(CVAR_KILLNEARHOLDER)
                }            
                else {
                    
ferencere aball
                    maxdistance 
get_pcvar_float(CVAR_KILLNEARBALL)
                }
                
                if(!
maxdistance)
                    return
                    
                if(
entity_range(idferencere) > maxdistance && entity_range(iddistancemax) > maxdistancem)
                    
entity_set_int(idEV_INT_button, (button & ~IN_ATTACK) & ~IN_ATTACK2)
            }
        }
    }



YakumoHiratsuhi 05-07-2013 15:07

Re: What is this?
 
Thanks for posting the function, here's what i figured out.
entity_range() returns the distance between two entities in a float datatype, i really don't know if this function checks if the two ents are valid, ignoring the player you should check if ferencere or distancemax entity is valid before doing anything.

PHP Code:

if(entity_range(idferencere) > maxdistance && entity_range(iddistancemax) > maxdistancem)
->
if(is_valid_ent(ferencere) && is_valid_ent(distancemax) && entity_range(idferencere) > maxdistance && entity_range(iddistancemax) > maxdistancem

not pretty sure since idk all the part of the global code that is used there.

Spy123 05-08-2013 14:09

Re: What is this?
 
Didn't work :( i still get those errors :(

.Dare Devil. 05-08-2013 15:34

Re: What is this?
 
PHP Code:

public client_PreThink(id)
{
if( 
id == 0  ) return // i dont think that id can be here less than 0 and bigger than 32 so i think this should work

... old code continues 


YakumoHiratsuhi 05-08-2013 15:52

Re: What is this?
 
Quote:

Originally Posted by .Dare Devil. (Post 1948295)
PHP Code:

public client_PreThink(id)
{
if( 
id == 0  ) return // i dont think that id can be here less than 0 and bigger than 32 so i think this should work

... old code continues 


I didn't know that the function could pass 0 as an id :shock: anyway, let him test. :mrgreen:

.Dare Devil. 05-08-2013 15:57

Re: What is this?
 
Quote:

Originally Posted by YakumoHiratsuhi (Post 1948311)
I didn't know that the function could pass 0 as an id :shock: anyway, let him test. :mrgreen:

I was also surprised but as you can see, error logs tell us something else.

Spy123 05-10-2013 12:09

Re: What is this?
 
didn't work guys..i still get this errors:

L 05/10/2013 - 18:23:06: [ENGINE] Invalid player 0 (not in-game)
L 05/10/2013 - 18:23:06: [AMXX] Displaying debug trace (plugin "watf.amxx")
L 05/10/2013 - 18:23:06: [AMXX] Run time error 10: native error (native "entity_range")
L 05/10/2013 - 18:23:06: [AMXX] [0] float.inc::operator>(Float:,Float:) (line 138)
L 05/10/2013 - 18:23:06: [AMXX] [1] watff.sma::client_PreThink (line 3579)


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

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