c++ disable key?

Joined
Apr 30, 2009
Messages
539
Reaction score
22
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
 
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
 
Upvote 0
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.
 
Upvote 0
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.
 
Upvote 0
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.
 
Upvote 0
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.
 
Upvote 0
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:
Upvote 0
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
 
Upvote 0
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..
 
Upvote 0
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
 
Upvote 0
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.
 
Upvote 0
Back