c++ disable key?

Results 1 to 22 of 22
  1. #1
    Account Upgraded | Title Enabled! Trilest is offline
    MemberRank
    Apr 2009 Join Date
    The NetherlandsLocation
    549Posts

    c++ disable key?

    I am looking for a c++ line that disables a key..

    I want to disable the
    Code:
    0
    wich is ->
    Code:
    0x30
    for like 5 seconds after they pressed it an after those 5 seconds it'll work again.oO


    E.G:
    They press taunt, then disabled for 5 sec and after those 5 secs they can taunt again -=]





    Thanks in advance ! <3


  2. #2
    Member Donald Duck is offline
    MemberRank
    Jun 2009 Join Date
    USA.Location
    95Posts

    Re: c++ disable key?

    Another rip-off of LG?

    Anyway, get the timestamp, save it in some variable, then do a compare.

  3. #3
    Account Upgraded | Title Enabled! Trilest is offline
    MemberRank
    Apr 2009 Join Date
    The NetherlandsLocation
    549Posts

    Re: c++ disable key?

    Quote Originally Posted by Donald Duck View Post
    Another rip-off of LG?

    Anyway, get the timestamp, save it in some variable, then do a compare.
    Dude i'm just trying to make my ideas true.
    I dont rip, if I rip then I wouldn't ask because I would steal the code from them =S?

    Anyway there should be a more easier way, I already tried with Sleep but didn't worked oO

  4. #4
    Valued Member ZeroCold is offline
    MemberRank
    Mar 2009 Join Date
    Somewhere I belong.Location
    146Posts

    Re: c++ disable key?

    If you work with Sleep the runable will freeze to.

  5. #5
    Infraction Banned Domega is offline
    MemberRank
    Jun 2009 Join Date
    134Posts

    Re: c++ disable key?

    Remove it altogether. Also, remove the laugh. It promotes griefing. An aggressive and negative community can bring some of the best times. It can really create a strong community if people hate eachother. But it always dulls down eventually and your server will be dead.

  6. #6
    Valued Member ZeroCold is offline
    MemberRank
    Mar 2009 Join Date
    Somewhere I belong.Location
    146Posts

    Re: c++ disable key?

    Quote Originally Posted by Domega View Post
    Remove it altogether. Also, remove the laugh. It promotes griefing. An aggressive and negative community can bring some of the best times. It can really create a strong community if people hate eachother. But it always dulls down eventually and your server will be dead.
    Wtf? You have read to many comics. And that's the result.
    Now bakc on tpoic.

  7. #7
    Account Upgraded | Title Enabled! Trilest is offline
    MemberRank
    Apr 2009 Join Date
    The NetherlandsLocation
    549Posts

    Re: c++ disable key?

    lol rofl.


    Yeah I noticed I keep freezing [spiking] ;P

    But yeah How do I disable it then for 5 secs?

  8. #8
    Browser. Nova is offline
    MemberRank
    Nov 2008 Join Date
    --Location
    400Posts

    Re: c++ disable key?

    Here is a kinda crappy idea but,

    What if you used GeyAnsyKeyState ? And then, each time it detects it, add a sleep(x); between each key pressing, would that mabye work ? I'm kinda new to C++ so I'm not too sure.

  9. #9
    Account Upgraded | Title Enabled! Trilest is offline
    MemberRank
    Apr 2009 Join Date
    The NetherlandsLocation
    549Posts

    Re: c++ disable key?

    [QUOTE=Nova

  10. #10
    Valued Member ZeroCold is offline
    MemberRank
    Mar 2009 Join Date
    Somewhere I belong.Location
    146Posts

    Re: c++ disable key?

    [QUOTE=Nova

  11. #11
    Reverse Engineer ThievingSix is offline
    MemberRank
    Mar 2007 Join Date
    CaliforniaLocation
    901Posts

    Re: c++ disable key?

    Do a WH_KEYBOARD_LL hook and return 1 to null the char.

  12. #12
    Account Upgraded | Title Enabled! Guy is offline
    MemberRank
    Apr 2009 Join Date
    919Posts

    Re: c++ disable key?

    Quote Originally Posted by ZeroCold View Post
    Really creapy I already told Sleep() will freez the runable to.
    However, try this one out:

    1) Locate the laugh event.
    2) Hook it, having it jump to an empty area (e.g. Codecave) in the runnable.
    3) In the runnable, launch a new thread with a routine that does this:
    a) Launches emote
    b) Pauses for 5 seconds
    c) Exits

    Before you launch the new thread, have it check if another thread is already running. If it is, pause, and try again in 1 second. To check if a thread is running, you could use an area in memory (e.g. Pseudo variable) to mark whether a thread is running or not. The thread would mark the bit when it starts, on unmark it on exit.

  13. #13
    Valued Member Team Lion is offline
    MemberRank
    Apr 2009 Join Date
    110Posts

    Re: c++ disable key?

    Or couldn't you simply use a quick variable in memory?

    E.x.

    Hook the laugh event or whatever event you want, have your DLL look like so:
    Code:
    DWORD prevTime;
    
    void laughHook() {
        DWORD currTime = GetTickCount();
        if((currTime - prevTime) > 5000)
            originalLaughFunction();
        prevTime = currTime;
    }
    I think that would suffice just as well as your recommendation gWX0. If not clarify for me, I haven't messed with Gunz in a long time anyhow.
    Last edited by Team Lion; 24-06-09 at 01:13 AM. Reason: Updated variable types to conform with Windows API

  14. #14
    Account Upgraded | Title Enabled! Tman151 is offline
    MemberRank
    May 2009 Join Date
    CaliforniaLocation
    306Posts

    Re: c++ disable key?

    Isn't sleep a good way to prevent lag though?
    Something like
    Code:
      D3DXVECTOR2[2] = GetPos(pChar())[2];Sleep(500);
    Code might be wrong, I'm not sure. Just woke up. :P

  15. #15
    2D > 3D Wucas is offline
    MemberRank
    Dec 2008 Join Date
    In your bed :3Location
    2,523Posts

    Re: c++ disable key?

    gWXO i was wondering. In asm how would a create thread function look like o.o

  16. #16
    Account Upgraded | Title Enabled! Trilest is offline
    MemberRank
    Apr 2009 Join Date
    The NetherlandsLocation
    549Posts

    Re: c++ disable key?

    Quote Originally Posted by Tman151 View Post
    Isn't sleep a good way to prevent lag though?
    Something like
    Code:
      D3DXVECTOR2[2] = GetPos(pChar())[2];Sleep(500);
    Code might be wrong, I'm not sure. Just woke up. :P
    What has the postion to do with the laugh or taunt oO ?

    Well anyway Thanks for all the comments <3

    I will try something out tomorrow i'm to tired now..

  17. #17
    Account Upgraded | Title Enabled! Tman151 is offline
    MemberRank
    May 2009 Join Date
    CaliforniaLocation
    306Posts

    Re: c++ disable key?

    Quote Originally Posted by Trilest View Post
    What has the postion to do with the laugh or taunt oO ?

    Well anyway Thanks for all the comments <3

    I will try something out tomorrow i'm to tired now..
    Absolutely nothing. :P
    I'm not sure, got a killer hangover.

    Edit: Oh ya, :P I was showing that sleep is kinda of a necessity to prevent lag. xD

  18. #18
    Account Upgraded | Title Enabled! Trilest is offline
    MemberRank
    Apr 2009 Join Date
    The NetherlandsLocation
    549Posts

    Re: c++ disable key?

    Quote Originally Posted by Tman151 View Post
    Absolutely nothing. :P
    I'm not sure, got a killer hangover.

    Edit: Oh ya, :P I was showing that sleep is kinda of a necessity to prevent lag. xD
    Well it is really irritating that sleep, Every time you press that key it'll freeze for some secs >.,

  19. #19
    Account Upgraded | Title Enabled! Guy is offline
    MemberRank
    Apr 2009 Join Date
    919Posts

    Re: c++ disable key?

    Quote Originally Posted by BetrayedAcheron View Post
    gWXO i was wondering. In asm how would a create thread function look like o.o
    Code:
    PUSH 0                   ; Thread ID
    PUSH 0                   ; Creation flags
    PUSH 0                   ; Parameters
    PUSH 0x00401000 ; Start Address
    PUSH 20                 ; Size of routine
    PUSH 0                   ; Thread attributes
    CALL Kernel32.CreateThread
    Commented as well.

  20. #20
    Valued Member Team Lion is offline
    MemberRank
    Apr 2009 Join Date
    110Posts

    Re: c++ disable key?

    Quote Originally Posted by Tman151 View Post
    Isn't sleep a good way to prevent lag though?
    Something like
    Code:
      D3DXVECTOR2[2] = GetPos(pChar())[2];Sleep(500);
    Code might be wrong, I'm not sure. Just woke up. :P

    Sleep and GetTickCount on most systems (all the ones I know, but supposedly it is possible not to) use the same central tick counter, and therefore the > 5000 or sleep(5000); have the same exact time resolution and should perform in about the same amount of time.

    Starting a new thread just seems a little overkill compared to what I thought of. I just like to keep things simple.

  21. #21
    Account Upgraded | Title Enabled! Guy is offline
    MemberRank
    Apr 2009 Join Date
    919Posts

    Re: c++ disable key?

    Quote Originally Posted by Team Lion View Post
    Sleep and GetTickCount on most systems (all the ones I know, but supposedly it is possible not to) use the same central tick counter, and therefore the > 5000 or sleep(5000); have the same exact time resolution and should perform in about the same amount of time.

    Starting a new thread just seems a little overkill compared to what I thought of. I just like to keep things simple.
    GetTickCount would still require storage of a variable, a routine to be ran, and, something to keep track of checking the seconds elapsed.

    Anyways, a whole thread would cause little to no overall performance lost, compared to an extra routine running in the main thread.

  22. #22
    Valued Member Team Lion is offline
    MemberRank
    Apr 2009 Join Date
    110Posts

    Re: c++ disable key?

    Yeah it is quite negligible. Oh well. Both will work at any rate, and both can be edited directly into the runnable without the need of an extra injection.



Advertisement