AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   Camera Problem (https://forums.alliedmods.net/showthread.php?t=155658)

padilha007 04-25-2011 03:18

Camera Problem
 
PHP Code:

#include <amxmodx>
#include <fakemeta>
#include <engine>

new const pl_cm_class[] = "PlayerCamera"
new g_iPlayerCamera[33]

public 
plugin_init()
{
    
register_think(pl_cm_class,"Think_PlayerCamera")
}

Create_PlayerCamera(id)
{
    static 
iEntiEnt g_iPlayerCamera[id];
    
    if ( 
pev_valid(iEnt) )
    {
        
engfunc(EngFunc_SetViewidiEnt);
    }
    else
    {
        static 
ent ent g_iPlayerCamera[id] = create_entity("info_target")
        
        if( !
ent )
            return;
        
        
entity_set_string(entEV_SZ_classnamepl_cm_class)
        
        
entity_set_model(ent"models/w_usp.mdl")
        
        
entity_set_byte(entEV_INT_solidSOLID_TRIGGER)
        
entity_set_int(entEV_INT_movetypeMOVETYPE_FLYMISSILE)
        
        
entity_set_edict(entEV_ENT_ownerid)
        
        
entity_set_int(ent,EV_INT_rendermodekRenderTransTexture)
        
entity_set_float(entEV_FL_renderamt0.0 )
        
        
attach_view(id,ent)
        
entity_set_float(entEV_FL_nextthinkget_gametime())
    }
}

public 
Think_PlayerCamera(ent)
{
    static 
owner
    owner 
entity_get_edict(ent,EV_ENT_owner)
    
    static 
Float:origin[3], Float:fAngle[3],Float:origin2[3];
    
entity_get_vector(owner,EV_VEC_v_angle,fAngle);
    
entity_get_vector(owner,EV_VEC_origin,origin);
    
    
origin2[0] = origin[0];
    
origin2[1] = origin[1];
    
origin2[2] = origin[2];
    
    static 
Float:fVBack[3];
    
angle_vectorfAngleANGLEVECTOR_FORWARDfVBack );
    
    
origin[2] += 35.0;
    
    
origin[0] += ( -fVBack[0] * 150.0 );
    
origin[1] += ( -fVBack[1] * 150.0 );
    
origin[2] += ( -fVBack[2] * 150.0 );
    
    
trace_line(ownerorigin2originorigin);
    
    
entity_set_vector(ent,EV_VEC_origin,origin)
    
    
entity_get_vector(owner,EV_VEC_velocity,origin2)
    
entity_set_vector(ent,EV_VEC_velocity,origin2)
    
    
entity_set_vector(ent,EV_VEC_angles,fAngle)
    
entity_set_float(entEV_FL_nextthinkget_gametime())
    
    return 
PLUGIN_CONTINUE


Image:
http://img220.**************/i/errordo.png/

My problem is that when the wall while the camera can see the other players. There is a possibility to fix this?

SonicSonedit 04-25-2011 07:43

Re: Camera Problem
 
1) Grabbing someone's else code just like that is bad.
2) Ask author.


All times are GMT -4. The time now is 19:45.

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