AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   camera view (https://forums.alliedmods.net/showthread.php?t=108397)

drumzplaya13 11-04-2009 19:59

camera view
 
With this code you can view 1st person inside of nades,flashes, and smokes.

PHP Code:

#include <amxmodx> 
#include <engine> 

#define PLUGIN "Steer nades" 
#define VERSION "1.4" 
#define AUTHOR "NL)Ramon(NL" 

new bool:isgren[33
new 
whosgren[33

new 
grencamgravgrensmokecamgrenexpl

public plugin_init() { 
    
register_plugin(PLUGINVERSIONAUTHOR
    
register_event("DeathMsg","dead","a"
    
grencam register_cvar("amx_grencam","1"
    
smokecam register_cvar("amx_grensmoke","0"
    
gravgren register_cvar("amx_grengrav","0"
    
grenexpl register_cvar("amx_grenexplode","1")


public 
dead(){
    new 
id read_data(2)
    
isgren[id] = false 
    attach_view
(id,id
    
whosgren[id] = 
}

public 
grenade_throw(id,grenid,grentype) { 
    if(
get_pcvar_num(grencam) <= || is_user_bot(id) || !is_user_alive(id)) return PLUGIN_CONTINUE 
    
if(get_pcvar_num(smokecam) <= && grentype == 9) return PLUGIN_CONTINUE 
    
if(grenid <= 0)  
        { 
        
isgren[id] = false 
        
return PLUGIN_CONTINUE 
    

    if(
get_pcvar_num(grenexpl)) 
        {
        
client_cmd(id,"weapon_knife")
        
client_print(id,print_chat,"Press attack ( mouse 1 ) to let the grenade explode.")
    }
    
isgren[id] = true 
    whosgren
[id] = grenid 
    attach_view
(id,grenid
    return 
PLUGIN_CONTINUE 


public 
client_PreThink(id){ 
    if(!
isgren[id] || !is_user_alive(id)) return PLUGIN_CONTINUE  
    
if(!is_valid_ent(whosgren[id])) 
        { 
        
isgren[id] = false 
        attach_view
(id,id
        
whosgren[id] = 
        
return PLUGIN_CONTINUE 
    

    if(
get_pcvar_num(grenexpl) && get_user_button(id) & IN_ATTACK)
        {
        
entity_set_float(whosgren[id], EV_FL_dmgtimeget_gametime() - 7)
        return 
PLUGIN_CONTINUE 
    
}
    
    
attach_view(id,whosgren[id])
    new 
Float:angles[3
    
entity_get_vector(id,EV_VEC_v_angle,angles
    new 
Float:setvel[3
    
velocity_by_aim(id,get_speed(whosgren[id]),setvel
    if(
get_pcvar_num(gravgren)) 
        { 
        new 
Float:vel[3
        
entity_get_vector(whosgren[id],EV_VEC_velocity,vel
        
setvel[2] = vel[2
    } 
    
entity_set_vector(whosgren[id],EV_VEC_velocity,setvel
    
entity_set_vector(whosgren[id],EV_VEC_angles,angles
    return 
PLUGIN_CONTINUE 




I am wondering if someone can take out the explosion of the nades, flashes and smokes, and make it so it travels till it hits the ground, meaning you can throw it as far as you can but the nades dont explode they disappear when they hit the ground but when they hit the ground it goes back to the 1st person view of the player.


All times are GMT -4. The time now is 17:46.

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