Bunnyhop Script

Posts 115 of 17 · Page 1 of 2
Bunnyhop Script
Hi guys, I was wondering if anyone can help me make a script to spam space when space is held down, but stop spamming when it's released. Any help is appreciated. thanks!
Quote Originally Posted by TomatoSoup1 View Post
Hi guys, I was wondering if anyone can help me make a script to spam space when space is held down, but stop spamming when it's released. Any help is appreciated. thanks!
To a specif program or you want it to spam it to?
Quote Originally Posted by Jorndel View Post


To a specif program or you want it to spam it to?
I want it to bunnyhop in CS:S and I have little skill in this field
Quote Originally Posted by TomatoSoup1 View Post
I want it to bunnyhop in CS:S and I have little skill in this field
Well, you could use the: SendKeys.Send
Example:
Code:
SendKeys.Send(" ")
And you could add it to a timer

Or the SendMessage
Example:
Code:
Private Declare Auto Function SendMessage Lib "user32.dll" ( ByVal hwnd As IntPtr, ByVal wMsg As Int32, ByVal wParam As Int32, ByVal lParam As Int32 ) As Int32
Private Const WM_KEYDOWN = &H100
Private Const WM_KEYUP = &H101
Private Const VK_SPACE = &H20

Dim p As Process
Dim title As String
Dim handle As IntPtr

Sub SetProcess(ByRef Name As String)
For Each p In Process.GetProcessesByName("ProcessName") 'Without the: .exe | File Extension
title = p.MainWindowTitle
handle = p.MainWindowHandle
Next
End Sub

Sub DoJump()
SendMessage(handle, WM_KEYDOWN, VK_SPACE, 0&)
SendMessage(handle, WM_KEYUP, VK_SPACE, 0&)
End Sub
Note: I might have done something wrong since I don't code VB.Net
Credit to: Pablo for the main stuff. (I just edited it for your usage)
Quote Originally Posted by Jorndel View Post


Well, you could use the: SendKeys.Send
Example:
Code:
SendKeys.Send(" ")
And you could add it to a timer

Or the SendMessage
Example:
Code:
Private Declare Auto Function SendMessage Lib "user32.dll" ( ByVal hwnd As IntPtr, ByVal wMsg As Int32, ByVal wParam As Int32, ByVal lParam As Int32 ) As Int32
Private Const WM_KEYDOWN = &H100
Private Const WM_KEYUP = &H101
Private Const VK_SPACE = &H20

Dim p As Process
Dim title As String
Dim handle As IntPtr

Sub SetProcess(ByRef Name As String)
For Each p In Process.GetProcessesByName("ProcessName") 'Without the: .exe | File Extension
title = p.MainWindowTitle
handle = p.MainWindowHandle
Next
End Sub

Sub DoJump()
SendMessage(handle, WM_KEYDOWN, VK_SPACE, 0&)
SendMessage(handle, WM_KEYUP, VK_SPACE, 0&)
End Sub
Note: I might have done something wrong since I don't code VB.Net
Credit to: Pablo for the main stuff. (I just edited it for your usage)
Okay. First off, thank you, but second, do I have to make any buttons or anything? I am so sorry I suck at this!
Quote Originally Posted by TomatoSoup1 View Post
Okay. First off, thank you, but second, do I have to make any buttons or anything? I am so sorry I suck at this!
This is why I dont help these people, they have no clue on what they are doing and live off leeching code
Quote Originally Posted by 'Bruno View Post
This is why I dont help these people, they have no clue on what they are doing and live off leeching code
I put it as request for a reason. In sorry I'm not a genius like you?
And did YOU learn all by yourself?
Didn't think so.
Quote Originally Posted by TomatoSoup1 View Post
I put it as request for a reason. In sorry I'm not a genius like you?
And did YOU learn all by yourself?
Didn't think so.
You are not learning, you are asking for code you have no idea what it does, and asking where to copy it to.
Okay let me repeat my question. Can someone WALK ME THROUGH te steps of this? Thanks
I tried making it myself, but it spams text now not keys so that's what I need and have no idea how I do that
I guess with that code you'll have it by key press which you are trying to do in couter strike. Since you
re doing it for a game it will be a little different to code because the program itself has to work on top of CS, which wouldn't know how to do.
If it wasn't for a game it'll be easier.

Quote Originally Posted by TomatoSoup1 View Post
Okay. First off, thank you, but second, do I have to make any buttons or anything? I am so sorry I suck at this!
Quote Originally Posted by DawgiiStylz View Post
I guess with that code you'll have it by key press which you are trying to do in couter strike. Since you
re doing it for a game it will be a little different to code because the program itself has to work on top of CS, which wouldn't know how to do.
If it wasn't for a game it'll be easier.

Erm, you know that stimulate a key press for applications don't need your program to be on the top?
It would be like making and AHK script and run it...

If he gets the point of SendKeys.Send("Key Code")
It stimulates a keyboard input, to the selected / active application.

Which would be CS in this case.
Else it would just write space to the text document. (Or W/E he uses it on)


The SendMessage is used to send messages to the applications without having em active.
(Think I also used it for reading as well...)

But point is: It would also stimulate a key-press as well. (If the info provided allows it)
[hl][/hl]
Kinda want a bit away from what you said but...

You have a function that will register any key pressed, and you can make that in a timer.
To detect if the key you want to activate the "script" was/are pressed.

Using this:
Code:
<DllImport("user32.dll", CharSet:=CharSet.Auto, ExactSpelling:=True)> Public Shared Function GetAsyncKeyState(ByVal vkey As Keys) As Boolean
End Function
And adding that in a timer and do this:
SendKeys:
Code:
If GetAsyncKeyState = Keys.F1 Then SendKeys.Send(" ")
SendMessage:
Code:
If GetAsyncKeyState = Keys.F1 Then DoJump()
Quote Originally Posted by Jorndel View Post


Erm, you know that stimulate a key press for applications don't need your program to be on the top?
It would be like making and AHK script and run it...

If he gets the point of SendKeys.Send("Key Code")
It stimulates a keyboard input, to the selected / active application.

Which would be CS in this case.
Else it would just write space to the text document. (Or W/E he uses it on)


The SendMessage is used to send messages to the applications without having em active.
(Think I also used it for reading as well...)

But point is: It would also stimulate a key-press as well. (If the info provided allows it)
[hl][/hl]
Kinda want a bit away from what you said but...

You have a function that will register any key pressed, and you can make that in a timer.
To detect if the key you want to activate the "script" was/are pressed.

Using this:
Code:
<DllImport("user32.dll", CharSet:=CharSet.Auto, ExactSpelling:=True)> Public Shared Function GetAsyncKeyState(ByVal vkey As Keys) As Boolean
End Function
And adding that in a timer and do this:
SendKeys:
Code:
If GetAsyncKeyState = Keys.F1 Then SendKeys.Send(" ")
SendMessage:
Code:
If GetAsyncKeyState = Keys.F1 Then DoJump()
SendMessage is not overly useful for "automation" purposes. It will only work on applications that have an active message queue, and you must be specifying a valid handle.
Could do a key down and up event. When key down is pressed, a timer activates and key up, the timer turns off. The timer spams the space button
Quote Originally Posted by TomatoSoup1 View Post
Hi guys, I was wondering if anyone can help me make a script to spam space when space is held down, but stop spamming when it's released. Any help is appreciated. thanks!
Quote Originally Posted by DawgiiStylz View Post
Could do a key down and up event. When key down is pressed, a timer activates and key up, the timer turns off. The timer spams the space button
I appologize I didn't see this.

Okay, yeah that sounds like what I want.
KeyDown {Space} handles SendKey {space} on Timer1 Speed
KeyUp {Space} Stops Timer

Can someone please help me translate that to work?
Thats a pretty basic "code" if you are used to the language, if you are not.. meh.. Ask for someone to do it for you, or learn it.
Posts 115 of 17 · Page 1 of 2

Post a Reply

Similar Threads

Tags for this Thread

None

Need help?