unknowncheats uc-forum.com ucdownloads ucdownloads.com

Go Back   UC-Tutorials - Multiplayer Game Hacking and Cheat Tutorials > Programming > C and C++

- Sponsored Advertisement -
http://www.myfpscheats.com/


Reply
 
Thread Tools Display Modes
  #1  
Old 08-21-2007, 10:39 PM
zero_tolerance zero_tolerance is offline
Senior Member
 
Join Date: Dec 2006
Posts: 289
Default Coding a marco

Credits: regitbull

Hello in this tutorial we are going to make a marco.
A marco is a script you run with autohotkey.
You can make things with it like clicking 100 times any key or things like autoshooters for games.

I dont use marcos for hotkeys or progams so i will learn you make a marco/autoshooter for a game.

Only games I hack are battlefield 2 and battlefield 2142 but i think it will work for most games.

Ok lets start.
----------------------------------------------------------------------------------------------------


What do you need.

Autohotkey


Step 1
Ok first download and install autohotkey on your pc.


Step 2
Open notepad and make a new file called tutorial.ahk

Step 3
Most time we start with command lines to explain what the script does.
The commands wil not be load or run so dont paste scripts there.
We always start the command lines with ;;

Code:
;;  This is my first project i made
;;  Its a autoshooter for a game
;;  Have fun with the autoshooter

Step 4
Ok now we write the next code:

Code:
#NoEnv 
#InstallKeybdHook 
#InstallMouseHook 

SetTimer, KeepRunning 
return 

KeepRunning:

Step 5
Under it we paste when the script need to go on.
So if we paste szProcessName = bf2.exe the marco wil start working when bf2.exe is running.

Paste the next code in your script:
Code:
 ; Get the process name of the active window (i.e. Notepad.exe) 
  WinGet, szProcessName, ProcessName, A 
  if szProcessName = BF2.exe 
  { 
    Suspend, off 
  } 
  else 
  { 
    Suspend, on 
  } 
return 

SendMode Input
Step 6
Now we write the next code to let the marco run when you start it or if it first need to be activated.

Code:
_auto := false
Now the autoshooter wil only run when you active it.
When you write true then the autoshooter wil auto go on when bf2,exe is running.


Step 7
Ok now we write what key or mouse click need to be repeated.
I beliefe for all games the left mouse is the shoot button so you can keep the code on this way if the key is the same for the game you make the autoshooter for.
Code:
~LButton::autofire()

Step 8
Ok now we write the next code to chose what hotkeys we want to turn the autoshooter on or off.

Code:
+Home::_auto := ! _auto 
+End::ExitApp
If we press Shift + Home then the autoshooter goes on or off and if we press Shift + End then the marco will close.

Here is a list of keys you can use for hotkeys:

Code:
Windows key  =  #
Alt  =  !
Ctrl  =  ^ 
Shift  =  +
 
and more here: http://www.autohotkey.com/docs/KeyList.htm

Step 9
Ok now we put this code to let the marco shoot click fast on the left mouse button.

Code:
autofire() 
{ 
global _auto 
if _auto 
{ 
Loop 
{ 
if GetKeyState("LButton", "P") 
{ 
SendInput {LButton DownTemp} 
Sleep 85 
mouseXY(0, 6) 
SendInput {LButton Up} 
Sleep 45 
} 
else 
break 
} ;; loop 
} ;; if 
} ;; autofire() 

mouseXY(x,y) 
{ 
DllCall("mouse_event",uint,1,int,x,int,y,uint,0,int,0) 
}

Step 10
When your script is finish then end with the next code:

Code:
;;;;;; 
;;; End script 
;;;;;;


Putting a message box in your script

Step 1
To put a message box in your marco like made by: regitbull or credits to: regitbull then paste this in your code:

Code:
MsgBox, Text here
But now the title of the message bar will be the name of the marco so for this tutorial you will see as title tutorial.ahk
To change the title change the messagebox code to this:
Code:
MsgBox , 0, Title text here, text here
This will make the title of the message box title text here and the message text text here the button wil be OK
To change the button change , 0, to something else.
Here is a list of buttons:

Code:
0  =  OK
1  =  OK  /  Cancel
2  =  Close  /  Redo  /  Ingore
3  =  Yes  /  No  /  Cancel
4  =  Yes  /  No
5  =  Redo  /  Cancel



Putting a windows box with a text field.

Step 1
If you want that someone needs to enter his name before using your autoshooter then put the next code in your script:

Code:
InputBox ,name, Please enter your name
MsgBox, Thanks for using my autoshooter  "%name%", Have fun with it
This is only to tune up your autoshooter so it dont send a name to you or something.
You can also make a password code ofcourse so people need to enter a pass before they can run your autoshooter.



Ok i hoped i helpt you guys with making your own autoshooter and if you have questions then just ask them in this tread or in this forum.


Good luck,
regitbull
Reply With Quote
Reply

  • Submit Thread to Digg
  • Submit Thread to del.icio.us
  • Submit Thread to StumbleUpon
  • Submit Thread to Google
  • Submit Thread to Facebook
  • Submit Thread to My Yahoo!
  • Submit Thread to MySpace
  • Submit Thread to Twitter
  • Submit Thread to Reddit

Tags
coding, marco

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off



All times are GMT. The time now is 06:57 AM.