• Amused
  • Angry
  • Annoyed
  • Awesome
  • Bemused
  • Cocky
  • Cool
  • Crazy
  • Crying
  • Down
  • Drunk
  • Embarrased
  • Enraged
  • Friendly
  • Geeky
  • Godly
  • Happy
  • Hateful
  • Hungry
  • Innocent
  • Meh
  • Piratey
  • Poorly
  • Sad
  • Secret
  • Shy
  • Sneaky
  • Tired
  • Wtf
  • At Work
  • CodenzHub
  • Coding
  • Deejaying
  • Donating
  • Drinking
  • Eating
  • Editing
  • Hacking
  • Hate Mailing
  • Jamin'
  • Lagging
  • Live Streaming
  • Lurking
  • No Status
  • Pawning
  • PC Gaming
  • PS Gaming
  • Raging
  • Reversing
  • Sleeping
  • Steam Gaming
  • Trolling
  • TwitchStreamer
  • Vodka!
  • Watching TV/Movie
  • Xbox Gaming
  • Youtuber
  • Zombies
  • Results 1 to 7 of 7
    1. #1
      Newbie
      Learning to hack games!
       
      Feeling Normal
       
      PlayTheRace's Avatar
      Join Date
      Dec 2013
      Posts
      1
      Thanks (-->)
      0
      Thanks (<--)
      0

      C++ The variable does not change within the function.

      Silent VPN
      hi guys.
      I have a problem in a function.
      I want a variable to be changed within the function.
      But when when the bool variable is changed inside the function, to release the hotkey it returns to its previous state.
      example:
      Variavel = True;
      If rotkey = pressionada {
      Variavel = false;

      But when you release the hotkey, it returns true.

      Code usage.

      Code:
      void HBase::DrawItem(int ItemX, int distancia, bool ativar){
      	if (GetAsyncKeyState(VK_NUMPAD6)){
      		ativar = true;
      
      	}
      can someone help me?
      Last edited by PlayTheRace; 12-01-2013 at 09:56 PM.

    2. #2
      Kim Kong Trasher
      I don't have status.
       
      Raging
       
      c5's Avatar
      Join Date
      Jul 2012
      Location
      Mankei Iland
      Posts
      1,221
      Thanks (-->)
      97
      Thanks (<--)
      492
      else aktivar = false?
      C++ The variable does not change within the function.

    3. #3
      The Angel Of Verdun
      Always More To Code!
       
      Lurking
       
      Nether's Avatar
      Join Date
      Dec 2013
      Location
      England, SW
      Posts
      299
      Thanks (-->)
      54
      Thanks (<--)
      188
      If you still havent solved your problem maybe you could try this:

      Code:
      ativar = !ativar
      Its basically saying:

      if ativar is true set to false / if ativar is false set to true

      PS: I may be wrong as Ive only been learning C++ for a short time.

    4. Thanks Fleep thanked for this post
    5. #4
      Hacker
      ^.^
       
      Eating
       
      NTvalk's Avatar
      Join Date
      Jul 2013
      Location
      Your RAM
      Posts
      512
      Thanks (-->)
      176
      Thanks (<--)
      146
      to release the hotkey it returns to its previous state.
      example:
      Variavel = True;
      If rotkey = pressionada {
      Variavel = false;

      But when you release the hotkey, it returns true.
      I think what you need is a while loop tho,
      while(!getasynckeystate(CK_KEY)) ativar = false;

      but i guess you have already solved it.

    6. #5
      k
      haxin'
       
      Coding
       
      kokole's Avatar
      Join Date
      Aug 2012
      Posts
      71
      Thanks (-->)
      14
      Thanks (<--)
      14
      Quote Originally Posted by NTvalk View Post
      I think what you need is a while loop tho,
      while(!getasynckeystate(CK_KEY)) ativar = false;

      but i guess you have already solved it.
      Isn't this better?
      Code:
      ativar = false;
      while(!getasynckeystate(CK_KEY))
      	Sleep(10);
      That way you wont set ativar to false each time it loops, and the sleep reduces CPU usage.
      h4x1ng ftw

    7. #6
      Hacker
      ^.^
       
      Eating
       
      NTvalk's Avatar
      Join Date
      Jul 2013
      Location
      Your RAM
      Posts
      512
      Thanks (-->)
      176
      Thanks (<--)
      146
      Quote Originally Posted by kokole View Post
      Isn't this better?
      Code:
      ativar = false;
      while(!getasynckeystate(CK_KEY))
      	Sleep(10);
      That way you wont set ativar to false each time it loops, and the sleep reduces CPU usage.
      you are right, the loop i showed is not good
      Anyway since he is inside a render function he can just use an if statement.
      Last edited by NTvalk; 12-12-2013 at 10:32 AM.

    8. Thanks kokole thanked for this post
    9. #7
      RTFM
      Shootin Pool!
       
      Coding
       
      Syperus's Avatar
      Join Date
      Oct 2012
      Location
      127.0.0.1
      Posts
      436
      Thanks (-->)
      101
      Thanks (<--)
      131
      Silent VPN
      Or
      if (GetAsyncKeyState(VK_NUMPAD6) & 1){
      ativar = true;

      }

    Similar Game Hacker Threads

    1. [Tutorial] OllyDbg Variable Editing
      By Retsoen in forum Game Hacking Tutorials
      Replies: 2
      Last Post: 10-14-2017, 01:30 AM
    2. [Help] DLL Injection : How to store variable into memory of injected proc
      By babacool123 in forum Hacking Help
      Replies: 1
      Last Post: 03-23-2016, 08:44 PM
    3. Replies: 5
      Last Post: 06-22-2015, 06:27 AM
    4. static variable problem
      By Liduen in forum C/C++
      Replies: 8
      Last Post: 02-14-2014, 11:22 AM
    5. Calling a function by address (function in another module)
      By c5 in forum Tutorials and Snippets
      Replies: 9
      Last Post: 11-05-2013, 09:27 AM

    Tags for this Thread