Thread: [Solved] [HELP] pev_angles Problem
View Single Post
hellmonja
Senior Member
Join Date: Oct 2015
Old 07-17-2019 , 02:54   Re: [HELP] pev_angles Problem
Reply With Quote #6

I got it! In order to make your Y axis angle (up and down view) stay the same you have to multiply it by -3. I'll explain it in detail in case someone needs this as well.

So basically your angle for pev_angles has 3 parts: Angle [0] makes you look up or down. Angle [1] left to right. And angle [2], well let's say you spin in this angle and it'll like you're doing cartwheels.

I experimented and made two commands: Check_Angle and Set_Angle, which are both self explanatory. But when I check angle[0] and it returns, let's say 7.0; when I then set angle[0] to 7.0 it gives me a different angle. So I set the angle to -90.0 and when I checked it it was 30.0. Here's the code I used.
PHP Code:
public plugin_init()
{
    
register_plugin("Dizzy Test""alpha""hellmonja");
    
    
register_clcmd("check_angle""Check_Angle");
    
register_clcmd("set_angle""Set_Angle");
}

public 
Check_Angle(user)
{
    new 
Float:old_angle[3];
        
pev(userpev_anglesold_angle);
//    pev(user, pev_v_angle, old_angle);
    
    
client_print(userprint_chat"0:%f | 1:%f | 2:%f"old_angle[0], old_angle[1], old_angle[2]);
    
    return 
PLUGIN_HANDLED
}

public 
Set_Angle(user)
{
    new 
y_angle[32];
    
read_argv1y_anglesizeof y_angle );
    
    new 
Float:old_angle[3], Float:new_angle[3];
        
pev(userpev_anglesold_angle);
//    pev(user, pev_v_angle, old_angle);
    
    
new_angle[0] = str_to_float(y_angle);
    
new_angle[1] = old_angle[1];
    
new_angle[2] = old_angle[2];

    
set_pev(userpev_anglesnew_angle);
//    set_pev(user, pev_v_angle, new_angle);
    
set_pev(userpev_fixangle1);
    
    return 
PLUGIN_HANDLED

Like I said, if you want to get angle[0] of pev_angles and want to set to view back to that angle you have to multiply it by -3 when you set pev_angles again.

Thanks to everyone who replied. Knowing people are ready support you in this site is much appreciated...
__________________
hellmonja is offline