You are viewing our Forum Archives. To view or take place in current topics click here.
[In Depth] How To Make Toggles (Leech Tutorial 1)
Posted:

[In Depth] How To Make Toggles (Leech Tutorial 1)Posted:

gh0st3
  • Junior Member
Status: Offline
Joined: Jul 21, 200915Year Member
Posts: 60
Reputation Power: 2
Status: Offline
Joined: Jul 21, 200915Year Member
Posts: 60
Reputation Power: 2
STARTING NOTE: if you have anything you want an indepth guide on, just post and I'll get to doing it.

Alright so I'm going to be teaching you guys how to make toggles. I will be covering button + stance toggles and menu toggles.

I will also be posting other tutorials.

Button + Stance Toggles

Okay for button and stance toggles, we will have two functions. We will have one that is the actual toggle and is threaded where your other functions are threaded at and the actual function (e.g. promod) that is threaded in the toggle.

For button and stance toggles, you are going to be using an if statement and an open and close brace.

if( self UseButtonPressed() )
{
//Code Here
}


Basically what this does is if the X button is pressed, it execute the code within the braces. Whenever you have an if statement you need braces, but if you have a self waittill statement, there are no braces needed. (Just a little info for the leeches)

So up there is an if statement for if a button was pressed, now I will be showing you how to do an if statement for a stance, and how to combine it with a button press.

if( self GetStance() == "crouch" )
{
//code here
}


Basically what this does, is if you are crouching, it will execute the code within the braces.

if( self UseButtonPressed() && self GetStance() == "crouch" )
{
//code here
}


As you can see here, the button press and the stance check is combined with &&, and obviously if the X button is pressed while crouching, it will execute the code within the braces.

Now onto how to do the toggle!

Basically for a button + stance toggle what we want to do is check if the toggle is off, and if it's off, execute the function that contains the code we want to toggle, maybe add text to notify that the function is running, and indicate that it's on. And if the toggle is on, we want to end the function, maybe add text to notify that the function is not running, then indicate that the toggle is off. Also, we have to add an self endon statement in the function that contains the main code.

if( self FragButtonPressed() && self GetStance() == "prone" )
{
  if( self.aimbot == false )
  {
    self thread Andrew74Aimbot();
    self iPrintlnBold("Aimbot ^2ON!");
    self.aimbot = true;
  }
  else
  {
    self notify("Aimbot_Off");
    self iPrintlnBold("Aimbot ^1OFF!");
    self.aimbot = false;
  }
}

Andrew74Aimbot()
{
        self endon( "death" );
        self endon( "Aimbot_Off" );
        for(;;)
        {
                self waittill ( "weapon_fired" );
                if( self AdsButtonPressed() )
                {
                        andrew74aimbot = get_closest_ai( self.origin, "axis" );       
                        Head = andrew74aimbot gettagorigin("j_head");
                        self setplayerangles(VectorToAngles((Head)-(self gettagorigin("j_head"))));
                        MagicBullet(self getcurrentweapon(), Head+(0,0,1), Head);
                        level._effect["dog_entrance_start"] = Loadfx("maps/zombie/fx_zombie_dog_gate_start");
                        playfx(level._effect["dog_entrance_start"], Head);
                        //andrew74 dodamage(andrew74.health + 666, andrew74.origin); //This is optional For insta-Kill Aim Bot
                        self.score = self.score + 100;
                        self maps\_zombiemode_score::set_player_score_hud();
                }
        }
}


Now basically what this does is if the grenade button is pressed while you are prone, it will check if self.aimbot is false. if it's false, it will run the aimbot, print out text that tells the aimbot is on, and indicate that self.aimbot is true. if it's true, then it will notify "Aimbot_Off", and since in the andrew74aimbot function, there is self endon("aimbot_off", it will end the function. And also text is printed out and self.aimbot is changed to false.

So when you're doing this yourself, make sure that where i have self.aimbot, you have self.______ (choose what to put there, doesn't matter, just don't put another period). Where I have self iPrintlnBold("text here");, change your text, obviously. And where i have self thread andrew74aimbot();, change it to the function you're running, and so on.

Also, your finished code will look like this:

aimbot_toggle()
{
self endon("disconnect");
if( self FragButtonPressed() && self GetStance() == "prone" )
{
  if( self.aimbot == false )
  {
    self thread Andrew74Aimbot();
    self iPrintlnBold("Aimbot ^2ON!");
    self.aimbot = true;
  }
  else
  {
    self notify("Aimbot_Off");
    self iPrintlnBold("Aimbot ^1OFF!");
    self.aimbot = false;
  }
}
}

Andrew74Aimbot()
{
        self endon( "death" );
        self endon( "Aimbot_Off" );
        for(;;)
        {
                self waittill ( "weapon_fired" );
                if( self AdsButtonPressed() )
                {
                        andrew74aimbot = get_closest_ai( self.origin, "axis" );       
                        Head = andrew74aimbot gettagorigin("j_head");
                        self setplayerangles(VectorToAngles((Head)-(self gettagorigin("j_head"))));
                        MagicBullet(self getcurrentweapon(), Head+(0,0,1), Head);
                        level._effect["dog_entrance_start"] = Loadfx("maps/zombie/fx_zombie_dog_gate_start");
                        playfx(level._effect["dog_entrance_start"], Head);
                        //andrew74 dodamage(andrew74.health + 666, andrew74.origin); //This is optional For insta-Kill Aim Bot
                        self.score = self.score + 100;
                        self maps\_zombiemode_score::set_player_score_hud();
                }
        }
}


Basically I added in the function name, the open / close braces ( you must have open / close braces when you have a function name ), and self endon disconnect.

When you have your function that has the actual code you want to toggle, you'll want to add self endon("whatever_you_want");, and then in the toggle, put self notify("what_you_put_for_self_endon");, and so on. Just replace the code with what you want, it's not that hard. If you have any questions, feel free to post.

here some button presses i have off the top of my head

self AdsButtonPressed() // Aim
self AttackButtonPressed() // Shoot
self FragButtonPressed() // Frag
self MeleeButtonPressed() // Knife
self UseButtonPressed() // Reload
self ButtonPressed("dpad_down") // dpad down, just change the direction for the rest of the dpad

the others I can't remember right now

and for stances

self getstance() == "crouch"
self getstance() == "prone"


Menu Toggles

Menu toggles are pretty much the same thing as button toggles, except you just have to remove the if statement outside.

aimbot_menu_toggle()
{
if( self.aimbot == false )
  {
    self thread Andrew74Aimbot();
    self iPrintlnBold("Aimbot ^2ON!");
    self.aimbot = true;
  }
  else
  {
    self notify("Aimbot_Off");
    self iPrintlnBold("Aimbot ^1OFF!");
    self.aimbot = false;
  }
}
Andrew74Aimbot()
{
        self endon( "death" );
        self endon( "Aimbot_Off" );
        for(;;)
        {
                self waittill ( "weapon_fired" );
                if( self AdsButtonPressed() )
                {
                        andrew74aimbot = get_closest_ai( self.origin, "axis" );       
                        Head = andrew74aimbot gettagorigin("j_head");
                        self setplayerangles(VectorToAngles((Head)-(self gettagorigin("j_head"))));
                        MagicBullet(self getcurrentweapon(), Head+(0,0,1), Head);
                        level._effect["dog_entrance_start"] = Loadfx("maps/zombie/fx_zombie_dog_gate_start");
                        playfx(level._effect["dog_entrance_start"], Head);
                        //andrew74 dodamage(andrew74.health + 666, andrew74.origin); //This is optional For insta-Kill Aim Bot
                        self.score = self.score + 100;
                        self maps\_zombiemode_score::set_player_score_hud();
                }
        }
}


And there you have it guys, hope you enjoyed the guide.


Last edited by gh0st3 ; edited 2 times in total
#2. Posted:
Moderatez1v8
  • TTG Senior
Status: Offline
Joined: Sep 17, 201014Year Member
Posts: 1,354
Reputation Power: 69
Status: Offline
Joined: Sep 17, 201014Year Member
Posts: 1,354
Reputation Power: 69
awesome post ghOst, this will help alot of people out, including me.
#3. Posted:
________
  • Resident Elite
Status: Offline
Joined: Oct 17, 201014Year Member
Posts: 293
Reputation Power: 12
Status: Offline
Joined: Oct 17, 201014Year Member
Posts: 293
Reputation Power: 12
Thanks that helped me out a lot
Jump to:
You are viewing our Forum Archives. To view or take place in current topics click here.