Raised This Month: $51 Target: $400
 12% 

Solved [HELP] pev_angles Problem


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
hellmonja
Senior Member
Join Date: Oct 2015
Old 07-16-2019 , 13:50   [HELP] pev_angles Problem
Reply With Quote #1

I wanted to make a dizzy plugin. So I'm spinning the players view using pev_angles. The problem is the Y axis (players view up or down) keeps resetting to 0 and I don't know why. I'm storing all current pev_angle information in g_dizzyangle[user][0] and only editing g_dizzyangle[user][2] to spin the view. Still the Y axis keeps resetting itself. I want the player to still be able to look up or down while his world is spinning...

PHP Code:
public Dizzy(user)
{
    if(!
g_is_dizzy[user])
    {
        
g_is_dizzy[user] = true;
        
EnableHamForward(HandleDizzyPreThink[user]);
    }
    else
    {
        
g_is_dizzy[user] = false;
        
DisableHamForward(HandleDizzyPreThink[user]);
    }
}

public 
Ham_Dizzy_PreThink(user)
{
    new 
Float:g_old_angle[3];
    new 
Float:g_old_vangle[3], Float:g_vangle[3];

    
pev(userpev_anglesg_old_angle);
    
    
g_dizzyangle[user][0] = g_old_angle[0];
    
g_dizzyangle[user][1] = g_old_angle[1];

    if(
g_is_dizzy[user])
    {
        
g_dizzyangle[user][2] += 2.0;
        
set_pev(userpev_anglesg_dizzyangle[user]);
        
set_pev(userpev_fixangle1);
    }
    else
        
DisableHamForward(HandleDizzyPreThink[user]);

    return 
HAM_HANDLED

__________________

Last edited by hellmonja; 07-17-2019 at 02:54.
hellmonja is offline
CrazY.
Veteran Member
Join Date: May 2015
Location: SP, Brazil
Old 07-16-2019 , 13:59   Re: [HELP] pev_angles Problem
Reply With Quote #2

pev_angle it's model angle, pev_v_angle it's the view angle, that being said, rotate the pev_v_angle instead.
__________________









Last edited by CrazY.; 07-16-2019 at 14:02.
CrazY. is offline
hellmonja
Senior Member
Join Date: Oct 2015
Old 07-16-2019 , 15:06   Re: [HELP] pev_angles Problem
Reply With Quote #3

Quote:
Originally Posted by CrazY. View Post
pev_angle it's model angle, pev_v_angle it's the view angle, that being said, rotate the pev_v_angle instead.
I'm sorry but it doesn't seem to work. It still resets the view (for example I'm looking up and when I turn it on it instantly makes me look straight forward) plus the effect is not there unlike when using pev_angle. I've already disabled all other plugins and only had that one running...

PHP Code:
public Ham_Dizzy_PreThink(user)
{
    new 
Float:old_angle[3];
    
    
pev(userpev_v_angleold_angle);
    
    
g_dizzyangle[user][0] = old_angle[0];
    
g_dizzyangle[user][1] = old_angle[1];

    if(
g_is_dizzy[user])
    {
        
g_dizzyangle[user][2] += 2.0;
        
set_pev(userpev_v_angleg_dizzyangle[user]);
        
set_pev(userpev_fixangle1);
    }
    else
        
DisableHamForward(HandleDizzyPreThink[user]);

    return 
HAM_HANDLED

__________________
hellmonja is offline
edon1337
Penguin Enthusiast
Join Date: Jun 2016
Location: Macedonia
Old 07-16-2019 , 15:21   Re: [HELP] pev_angles Problem
Reply With Quote #4

Try removing pev_fixangle from the code.
__________________
edon1337 is offline
<VeCo>
Veteran Member
Join Date: Jul 2009
Location: Bulgaria
Old 07-16-2019 , 15:24   Re: [HELP] pev_angles Problem
Reply With Quote #5

alter punchangle instead, view angles are reset by the game
__________________
<VeCo> is offline
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
Natsheh
Veteran Member
Join Date: Sep 2012
Old 07-17-2019 , 03:42   Re: [HELP] pev_angles Problem
Reply With Quote #7

Quote:
Originally Posted by <VeCo> View Post
alter punchangle instead, view angles are reset by the game
That's incorrect.

Also the difference between the pev_v_angle and pev_angles is the origin position for View angel it's the player pos and for angles its the model origin.

So I do suggest just to apply a random left and right velocity with changing in punchangles slightly.
__________________
@Jailbreak Main Mod v2.7.0 100%
@User Tag Prefix 100% done !
@Mystery Box 100% done !
@VIP System 100% done !


Last edited by Natsheh; 07-17-2019 at 03:52.
Natsheh is offline
Send a message via MSN to Natsheh Send a message via Skype™ to Natsheh
Reply



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 03:48.


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