AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   Entity Touch (https://forums.alliedmods.net/showthread.php?t=144080)

Kiske 11-28-2010 15:19

Entity Touch
 
I want to make an entity is SOLID_NOT for which he played, but when you touch it, it becomes SOLID_NOT for everyone.

Code:
PHP Code:

register_forwardFM_Touch"FORWARD_FMTouch")

public 
FORWARD_FMTouchiEntityIndex )
{
    if ( !
is_valid_entIndex ) || !is_valid_entiEntity ) )
        return 
FMRES_IGNORED;
    
    static 
szEntClassName[32];
    
entity_get_stringiEntityEV_SZ_classnameszEntClassName31 )
    
    if ( 
equalszEntClassName"Entidad_04" ) )
    {
        if ( 
is_user_aliveIndex ) )
        {
            if ( !
task_existsTASK_NOTSOLID iEntity ) && !task_existsTASK_SOLID iEntity ) )
                
set_task0.09"FUNCTION_EntityNotSolid"TASK_NOTSOLID iEntity )
        }
    }

    return 
FMRES_IGNORED;
}

public 
FUNCTION_EntityNotSolidiEntity )
{
    
iEntity -= TASK_NOTSOLID
    
    
if ( is_valid_entiEntity ) )
    {
        
set_peviEntitypev_solidSOLID_NOT )
        
set_peviEntitypev_rendermodekRenderTransAdd )
        
set_peviEntitypev_renderamt55.0 )
        
        
set_task0.9"FUNCTION_EntitySolid"TASK_SOLID iEntity )
    }
}

public 
FUNCTION_EntitySolidiEntity )
{
    
iEntity -= TASK_SOLID
    
    
if ( is_valid_ent(iEntity) )
    {
        
set_peviEntitypev_solidSOLID_BBOX )
        
set_peviEntitypev_rendermodekRenderNormal )
    }



Emp` 11-28-2010 15:45

Re: Entity Touch
 
You can set pev_owner to a player id and it will act like SOLID_NOT for that player. All other players will abide by the normal solid flag.

Kiske 11-28-2010 16:30

Re: Entity Touch
 
I do not understand.
No where to put that code.

A small example please.

ConnorMcLeod 11-28-2010 16:34

Re: Entity Touch
 
Let's start to describe what your plugin does.

Kiske 11-28-2010 17:41

Re: Entity Touch
 
Quote:

Originally Posted by ConnorMcLeod (Post 1359100)
Let's start to describe what your plugin does.

It is a wall (fake) with model that when you touched it becomes transparent and can pass through.

Sorry for my english, i use the translate google.

ConnorMcLeod 11-29-2010 01:08

Re: Entity Touch
 
Why dont you let it just solid trigger and only change appearance when touched ?

Kiske 11-29-2010 07:04

Re: Entity Touch
 
Quote:

Originally Posted by ConnorMcLeod (Post 1359292)
Why dont you let it just solid trigger and only change appearance when touched ?

That's what i do but to work individually.

ConnorMcLeod 11-29-2010 11:10

Re: Entity Touch
 
You mean no everyone is able to pass the wall ?

meTaLiCroSS 11-29-2010 13:17

Re: Entity Touch
 
Quote:

Originally Posted by ConnorMcLeod (Post 1359583)
You mean no everyone is able to pass the wall ?

He's trying to say that we want to make the ability of that block only for the play who touched it.

I told to him about the usage of pev_owner, that can be an answer for this question, but there are 2 problems.

The first, it's that if we set ent's pev_owner "player1's id", the entity will be SOLID_NOT for player1, but if player2 touches the ent while player1 is into the ent (into his size) the ent's pev_owner will be "player2's id" and player1 will get stuck.

And the second one, player's pev_owner can be ent's id, but the problem here is that we don't know which thing can make the modification of the pev_owner on the player.

Kiske 11-29-2010 14:47

Re: Entity Touch
 
Quote:

Originally Posted by meTaLiCroSS (Post 1359667)
He's trying to say that we want to make the ability of that block only for the play who touched it.

I told to him about the usage of pev_owner, that can be an answer for this question, but there are 2 problems.

The first, it's that if we set ent's pev_owner "player1's id", the entity will be SOLID_NOT for player1, but if player2 touches the ent while player1 is into the ent (into his size) the ent's pev_owner will be "player2's id" and player1 will get stuck.

And the second one, player's pev_owner can be ent's id, but the problem here is that we don't know which thing can make the modification of the pev_owner on the player.

Thanks for giving a better example :).


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

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