View Single Post
Driving To Heaven
Senior Member
Join Date: Jun 2009
Location: somewhere far away
Old 06-26-2009 , 05:34   Re: CS 1.6 Custom 3rd Person View
Reply With Quote #25

I need 3Dwiew. When press e, not show normal wiew.
Good player model.
Good crosshair.

This code. When press e, not show normal wiew
But bad player model and crosshair not up when shooting.

PHP Code:
#include <amxmodx>
#include <hamsandwich>
#include <engine>

#define PLUGIN "New Plug-In"
#define VERSION "1.0"
#define AUTHOR "tpt"

public plugin_init() 
{
    
register_plugin(PLUGINVERSIONAUTHOR)
    
RegisterHamHam_Spawn"player""fwSpawnPost")
}

public 
plugin_precache() precache_model("models/rpgrocket.mdl")

public 
fwSpawnPostid )
    if( 
is_user_aliveid ) ) set_viewidCAMERA_3RDPERSON 
This code. When press e, show normal wiew.
But good player model, and good crosshair.

PHP Code:
#include <amxmodx> 
#include <hamsandwich> 
#include <engine> 

#define PLUGIN "thirdperson" 
#define VERSION "1.0" 
#define AUTHOR "" 

new const pl_cm_class[] = "PlayerCamera" 

public plugin_init() 

    
register_pluginPLUGINVERSIONAUTHOR 
    
register_thinkpl_cm_class"Think_PlayerCamera" 
    
RegisterHam(Ham_Spawn"player""fwHamSpawn"1


public 
fwHamSpawnid 
    if( 
is_user_aliveid ) ) Create_PlayerCameraid ); 

Create_PlayerCamera(id)  
{  
    new 
ent = -1  
    
while ((ent find_ent_by_class(ent,pl_cm_class)) != 0)  
    {  
        if (
entity_get_edict(ent,EV_ENT_owner) == id)  
        {  
            
attach_view(id ent)  
            return  
        }  
    }  
    
ent 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 
iButtons;  
    
iButtons entity_get_int(ownerEV_INT_button)  
     
    if( 
iButtons IN_USE  || !is_user_alive(owner))  
    {  
        
attach_view(owner,owner)  
        
remove_entity(ent)  
        return 
PLUGIN_CONTINUE;  
    }  
     
     
    static 
Float:origin[3], Float:fAngle[3],Float:origin2[3];  
    
entity_get_vector(owner,EV_VEC_origin,origin)  
    
entity_get_vector(owner,EV_VEC_v_angle,fAngle)  
     
    
origin2[0] = origin[0]  
    
origin2[1] = origin[1]  
    
origin2[2] = origin[2]  
     
    static 
Float:fVBack[3];  
    
angle_vectorfAngleANGLEVECTOR_FORWARDfVBack );  
     
    
origin[2] += 20.0;  
     
    
origin[0] += ( -fVBack[0] * 150.0 );  
    
origin[1] += ( -fVBack[1] * 150.0 );  
    
origin[2] += ( -fVBack[2] * 150.0 );  
     
    
trace_line(owner,origin2,origin,origin)  
     
    
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;  

Driving To Heaven is offline