I have seen many people asking for something like this and decided to make a tutorial on it...
Well here goes...
Step 1.
First make a new class called (hackname)Timer in my case ill be using it for a spam hack... so "SpamTimer" will work for me....
Step 2.
Define these:
Step 3.
Add this code in, to schedule the task after a delay
Step 4.
Make a new class in "(hack)Task", and a method
Step 5.
put this inside run, its basically saying if your toggle is on, and your in multiplayer, restart the timer when its done....
Step 6.
Put your code you want to run under that....
Step 7.
Now add this wherever your toggle/console command is....
Thnx for reading, leave constructive criticism ONLY below!!
P.S. the "new Spamtimer(0.15);" double is in seconds, so 0.15 will be 150ms and 1.5 will be 1 and a half seconds....
Credit To: dmkiller11
Well here goes...
Step 1.
First make a new class called (hackname)Timer in my case ill be using it for a spam hack... so "SpamTimer" will work for me....
Step 2.
Define these:
Code:
Timer spamtimer;
Step 3.
Add this code in, to schedule the task after a delay
Code:
public SpamTimer(double d) {
spamtimer = new Timer();
spamtimer.schedule(new SpamTask(), (long) (d * 1000));
}
Step 4.
Make a new class in "(hack)Task", and a method
Code:
class SpamTask extends TimerTask {
public void run() {
Step 5.
put this inside run, its basically saying if your toggle is on, and your in multiplayer, restart the timer when its done....
Code:
if(Minecraft.isMultiplayerWorld() && hacks.numspam){
new SpamTimer(0.15);
Put your code you want to run under that....
Code:
Minecraft.thePlayer.sendChatMessage("OMGWTFTHISISASPAMMESSAGE")
Step 7.
Now add this wherever your toggle/console command is....
Code:
if(message.startsWith("numspam"))
{
new Spamtimer(0.15);
hacks.numspam = !hacks.numspam;
}
P.S. the "new Spamtimer(0.15);" double is in seconds, so 0.15 will be 150ms and 1.5 will be 1 and a half seconds....
Credit To: dmkiller11
No comments:
Post a Comment