Results 1 to 10 of 10
  1. #1
    ImWhacky's Avatar
    Join Date
    Sep 2015
    Gender
    male
    Posts
    509
    Reputation
    56
    Thanks
    4,059
    My Mood
    Breezy

    RCS Not Writing Angles

    "My" RCS Code
    Code:
    void NormalizeAngles(Vector &vecAngle)
    {
    
    
    	if (!std::isfinite(vecAngle.x))
    		vecAngle.x = 0.0f;
    	if (!std::isfinite(vecAngle.y))
    		vecAngle.y = 0.0f;
    
    	while (vecAngle.y < -180.0f)
    		vecAngle.y += 360.0f;
    	while (vecAngle.y > 180.0f)
    		vecAngle.y -= 360.0f;
    
    	if (vecAngle.x > 89.0f)
    		vecAngle.x = 89.0f;
    	if (vecAngle.x < -89.0f)
    		vecAngle.x = -89.0f;
    
    	vecAngle.z = 0.0f;
    }
    
    void RCS()
    {
    	DrawString("RCS running", menux + 250, menuy, MenuR, MenuG, MenuB, pFontSmall);
    	if (RCSEnabled)
    	{
    		DrawString("RCS enabled", menux + 250, menuy + 20, MenuR, MenuG, MenuB, pFontSmall);
    		static Vector vecOldPunchAngle = Vector(0, 0, 0);
    
    		Vector vecPunchAngles = Nsane.Read<Vector>(LocalBase + Punch);
    		Vector vecViewAngles = Nsane.Read<Vector>(dwClientState + ViewAngle);
    
    		if (GetAsyncKeyState(VK_LBUTTON) & 0x8000)
    		{
    			DrawString("RCS button pressed", menux + 250, menuy + 40, MenuR, MenuG, MenuB, pFontSmall);
    			Vector vecCurrent = { vecPunchAngles.x - vecOldPunchAngle.x, vecPunchAngles.y - vecOldPunchAngle.y, 0 };
    
    			vecViewAngles.x = vecViewAngles.x - (vecCurrent.x * 2);
    			vecViewAngles.y = vecViewAngles.y - (vecCurrent.y * 2);
    
    			//NormalizeAngles(vecViewAngles);
    
    			Nsane.Write<Vector>(dwClientState + ViewAngle, vecViewAngles);
    			//Nsane.Write<Vector>(dwClientState + ViewAngle, (0, 0, 0)); // Works
    		}
    
    		vecOldPunchAngle = vecPunchAngles;
    	}
    }
    and before you ask, yes my offsets are up to date.

    so im having a problem, i have strings saying that everything is running but the angles are not being written. any help?

    Epik helped me write this and he said it should 100% work


     

    Steam-TriggeredFemenazi
    CS:GO Rank-MG (but I'm a dirty cheater so who cares)
    Discord-ImWhacky#6260

    P.M. me if you have any questions.


  2. #2
    d4rkW's Avatar
    Join Date
    May 2016
    Gender
    female
    Posts
    40
    Reputation
    10
    Thanks
    12
    Not even looking at your code. Please separate that cancer normalization statement into normalization and clamping functions.

  3. #3
    ImWhacky's Avatar
    Join Date
    Sep 2015
    Gender
    male
    Posts
    509
    Reputation
    56
    Thanks
    4,059
    My Mood
    Breezy
    Quote Originally Posted by d4rkW View Post
    Not even looking at your code. Please separate that cancer normalization statement into normalization and clamping functions.
    not trying to be ignorant but why do i need to do that? if i have to call both of them anyways why not just make them into one function


     

    Steam-TriggeredFemenazi
    CS:GO Rank-MG (but I'm a dirty cheater so who cares)
    Discord-ImWhacky#6260

    P.M. me if you have any questions.


  4. #4
    d4rkW's Avatar
    Join Date
    May 2016
    Gender
    female
    Posts
    40
    Reputation
    10
    Thanks
    12
    Quote Originally Posted by ImWhacky View Post
    not trying to be ignorant but why do i need to do that? if i have to call both of them anyways why not just make them into one function
    Because you don't always want to do both at the same time? Once you go internal you will see why sometimes you need one or the other, but not both, also it's just good programming practice imo.
    Last edited by d4rkW; 06-04-2016 at 03:00 PM.

  5. #5
    ImWhacky's Avatar
    Join Date
    Sep 2015
    Gender
    male
    Posts
    509
    Reputation
    56
    Thanks
    4,059
    My Mood
    Breezy
    Quote Originally Posted by d4rkW View Post
    Because you don't always want to do both at the same time? Once you go internal you will see why sometimes you need one or the other, but not both, also it's just good programming practice imo.
    ok that makes sense, since i basically had Epik write this for me what should be in clamp just this?

    Code:
    while (vecAngle.y < -180.0f)
    	vecAngle.y += 360.0f;
    while (vecAngle.y > 180.0f)
    	vecAngle.y -= 360.0f;
    if (vecAngle.x > 89.0f)
    	vecAngle.x = 89.0f;
    if (vecAngle.x < -89.0f)
    	vecAngle.x = -89.0f;


     

    Steam-TriggeredFemenazi
    CS:GO Rank-MG (but I'm a dirty cheater so who cares)
    Discord-ImWhacky#6260

    P.M. me if you have any questions.


  6. #6
    d4rkW's Avatar
    Join Date
    May 2016
    Gender
    female
    Posts
    40
    Reputation
    10
    Thanks
    12
    Quote Originally Posted by ImWhacky View Post
    ok that makes sense, since i basically had Epik write this for me what should be in clamp just this?

    Code:
    while (vecAngle.y < -180.0f)
        vecAngle.y += 360.0f;
    while (vecAngle.y > 180.0f)
        vecAngle.y -= 360.0f;
    if (vecAngle.x > 89.0f)
        vecAngle.x = 89.0f;
    if (vecAngle.x < -89.0f)
        vecAngle.x = -89.0f;
    Code:
    inline float NormalizeAngle(float flAng)
    {
        if(!std::isfinite(flAng))
        {
            return 0.0f;
        }
     
        return std::remainder(flAng, 360.0f);
    }
    Code:
    inline void ClampViewAngles(Vector3_t& vecAng)
    {
        vecAng.x = std::max(-89.0f, std::min(89.0f, NormalizeAngle(vecAng.x)));
        vecAng.y = NormalizeAngle(vecAng.y);
        vecAng.z = 0.0f;
    }
    Last edited by Hunter; 06-07-2016 at 11:20 AM.

  7. #7
    WasserEsser's Avatar
    Join Date
    Jul 2015
    Gender
    male
    Posts
    735
    Reputation
    174
    Thanks
    677
    My Mood
    Busy
    Quote Originally Posted by ImWhacky View Post
    not trying to be ignorant but why do i need to do that? if i have to call both of them anyways why not just make them into one function
    You should normalize your vector whenever you did any operation with them. This will prevent you from quadrant errors. Clamping has to be done once before writing the angles. If you're calling the normalize function whenever you're doing any operation with your vector, you're clamping your angles before you want them to be clamped, resulting in values that might be cut off before you finished doing operations with them.

    Quote Originally Posted by ImWhacky View Post
    ok that makes sense, since i basically had Epik write this for me what should be in clamp just this?

    Code:
    while (vecAngle.y < -180.0f)
    	vecAngle.y += 360.0f;
    while (vecAngle.y > 180.0f)
    	vecAngle.y -= 360.0f;
    if (vecAngle.x > 89.0f)
    	vecAngle.x = 89.0f;
    if (vecAngle.x < -89.0f)
    	vecAngle.x = -89.0f;
    That's still normalization + clamp.

  8. #8
    voziak's Avatar
    Join Date
    Aug 2014
    Gender
    male
    Posts
    115
    Reputation
    10
    Thanks
    796
    My Mood
    Yeehaw
    shouldn't it be in a loop :S
    also i'd use if shotsfired >= 1 instead

  9. #9
    ImStyL's Avatar
    Join Date
    Jan 2016
    Gender
    male
    Location
    Antartica
    Posts
    145
    Reputation
    10
    Thanks
    2,063
    Quote Originally Posted by ImWhacky View Post
    //Nsane.Write<Vector>(dwClientState + ViewAngle, (0, 0, 0)); // Works
    If that did work, then set
    Code:
    Vector vecOldPunchAngle;
    Outside the loop.

    If nothing still works, add me on skype. (signature)

    -------

    Quote Originally Posted by voziak View Post
    shouldn't it be in a loop :S
    also i'd use if shotsfired >= 1 instead
    This is also something to consider,
    Code:
    If (Shotfired > 1)
    Will set the recoil for only automatic weapons and not on awp,scout,pistol... if you don't set up a weapon check.
    Last edited by ImStyL; 06-07-2016 at 10:24 AM.




    Got a question or need help?
    Click here to add me on Skype





  10. #10
    Hunter's Avatar
    Join Date
    Dec 2013
    Gender
    male
    Location
    Depths Of My Mind.
    Posts
    17,468
    Reputation
    3771
    Thanks
    6,159
    My Mood
    Cheerful
    1 week has passed and no further replies have been made by the OP. Assuming solved.

    /Closed.

Similar Threads

  1. [Help] External RCS not working
    By ImWhacky in forum Counter-Strike 2 Coding & Resources
    Replies: 46
    Last Post: 05-29-2016, 12:14 PM
  2. [Solved] RCS Not Working
    By Skips in forum Counter-Strike 2 Help
    Replies: 5
    Last Post: 11-01-2015, 08:46 AM
  3. [Help] Can't figure out how to write angles in VB .NET
    By cdrizzle in forum Counter-Strike 2 Coding & Resources
    Replies: 8
    Last Post: 10-24-2015, 11:05 AM
  4. Why this Logger source can not write offset noReload?
    By Astr3Lune in forum Crossfire Coding Help & Discussion
    Replies: 2
    Last Post: 08-11-2013, 02:45 PM
  5. [Help Request] Why this Logger source can not write offset?
    By Astr3Lune in forum Crossfire Coding Help & Discussion
    Replies: 0
    Last Post: 08-11-2013, 11:07 AM