Raised This Month: $ Target: $400
 0% 

Solved [HELP] pev_angles Problem


  
 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
hellmonja
Senior Member
Join Date: Oct 2015
Old 07-17-2019 , 02:54   Re: [HELP] pev_angles Problem
Reply With Quote #7

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
 



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


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


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