AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   Check if(variable)... Doesn't work (https://forums.alliedmods.net/showthread.php?t=237705)

proffs 03-28-2014 13:35

Check if(variable)... Doesn't work
 
I need to check if( GAME_DGBALL <= g_iCurrentGame <= GAME_ZMBOMBS )

This is my way to do it, but this part:
PHP Code:

if(iEnt == && GAME_DGBALL <= g_iCurrentGame <= GAME_ZMBOMBS
    { 

Makes it crash the server.

If I only have:

PHP Code:

if( GAME_DGBALL <= g_iCurrentGame <= GAME_ZMBOMBS )
    {
        return 
PLUGIN_CONTINUE;
    } 


It wont work because fuck logic?

PHP Code:

public ball_interact(iBalliEnt
{    
    if( 
GAME_DGBALL <= g_iCurrentGame <= GAME_ZMBOMBS )
    {
        return 
PLUGIN_CONTINUE;
    }    
    
    if(
iEnt == && GAME_DGBALL <= g_iCurrentGame <= GAME_ZMBOMBS
    {
        
entity_set_int(iBallEV_INT_iuser11)
        
set_rendering(iBall);
    }
    else 
    {
        new 
iClassname[32]
        
entity_get_string(iEnt,EV_SZ_classnameiClassnamecharsmax(iClassname))
        
        if(
equali(iClassname,"func_"5)) 
        {
            
entity_set_int(iBallEV_INT_iuser11)
            
set_rendering(iBall)

            new 
Float:start[3], Float:end[3], Float:ground[3]
            
entity_get_vector(iBallEV_VEC_originstart)
            
end start
            end
[2] -= 1024.0
            trace_line
(iEnt,start,end,ground)
            
ground[2] += 7.0
            entity_set_vector
(iBallEV_VEC_originground)
        }
    }
    return 
PLUGIN_CONTINUE



ironskillz1 03-28-2014 14:25

Re: Check if(variable)... Doesn't work
 
Code:

public ball_interact(iBall, iEnt) 
{   
    if( GAME_DGBALL <= g_iCurrentGame <= GAME_ZMBOMBS )
    {
        return PLUGIN_CONTINUE;
    }   
   
    if(iEnt == 0) 
    {
        entity_set_int(iBall, EV_INT_iuser1, 1)
        set_rendering(iBall);
    }
    else 
    {
        new iClassname[32]
        entity_get_string(iEnt,EV_SZ_classname, iClassname, charsmax(iClassname))
       
        if(equali(iClassname,"func_", 5)) 
        {
            entity_set_int(iBall, EV_INT_iuser1, 1)
            set_rendering(iBall)

            new Float:start[3], Float:end[3], Float:ground[3]
            entity_get_vector(iBall, EV_VEC_origin, start)
            end = start
            end[2] -= 1024.0
            trace_line(iEnt,start,end,ground)
            ground[2] += 7.0
            entity_set_vector(iBall, EV_VEC_origin, ground)
        }
    }
    return PLUGIN_CONTINUE
}


proffs 03-28-2014 14:34

Re: Check if(variable)... Doesn't work
 
Quote:

Originally Posted by ironskillz1 (Post 2117052)
Code:

public ball_interact(iBall, iEnt) 
{   
    if( GAME_DGBALL <= g_iCurrentGame <= GAME_ZMBOMBS )
    {
        return PLUGIN_CONTINUE;
    }   
   
    if(iEnt == 0) 
    {
        entity_set_int(iBall, EV_INT_iuser1, 1)
        set_rendering(iBall);
    }
    else 
    {
        new iClassname[32]
        entity_get_string(iEnt,EV_SZ_classname, iClassname, charsmax(iClassname))
       
        if(equali(iClassname,"func_", 5)) 
        {
            entity_set_int(iBall, EV_INT_iuser1, 1)
            set_rendering(iBall)

            new Float:start[3], Float:end[3], Float:ground[3]
            entity_get_vector(iBall, EV_VEC_origin, start)
            end = start
            end[2] -= 1024.0
            trace_line(iEnt,start,end,ground)
            ground[2] += 7.0
            entity_set_vector(iBall, EV_VEC_origin, ground)
        }
    }
    return PLUGIN_CONTINUE
}


But then all regular nades will float on floor.
So it wont work at this way..
And the code you posted before, didn't help at all.

ironskillz1 03-28-2014 14:39

Re: Check if(variable)... Doesn't work
 
From my private daysmenu

Code:

public ball_interact(ball,ent)
{
        if( GAME_DGBALL <= g_iCurrentGame <= GAME_ZMBOMBS )
        {
                if(ent == 0) {
                        entity_set_int(ball,EV_INT_iuser1,1);
                        set_rendering(ball);
                }
                else {
                        new classname[32];
                        entity_get_string(ent,EV_SZ_classname,classname,31);
               
                        if(equali(classname,"func_",5)) {
                                entity_set_int(ball,EV_INT_iuser1,1);
                                set_rendering(ball);
                       
                        }
                }
        }
        return PLUGIN_CONTINUE;
}


proffs 03-28-2014 14:51

Re: Check if(variable)... Doesn't work
 
Quote:

Originally Posted by ironskillz1 (Post 2117062)
From my private daysmenu

Code:

public ball_interact(ball,ent)
{
        if( GAME_DGBALL <= g_iCurrentGame <= GAME_ZMBOMBS )
        {
                if(ent == 0) {
                        entity_set_int(ball,EV_INT_iuser1,1);
                        set_rendering(ball);
                }
                else {
                        new classname[32];
                        entity_get_string(ent,EV_SZ_classname,classname,31);
               
                        if(equali(classname,"func_",5)) {
                                entity_set_int(ball,EV_INT_iuser1,1);
                                set_rendering(ball);
                       
                        }
                }
        }
        return PLUGIN_CONTINUE;
}


Thanks, works now. Let see if it crashes!


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

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