Results 1 to 5 of 5
  1. #1
    Member SupahTurdle's Avatar
    Join Date
    Sep 2011
    Posts
    186
    Points
    560
         User Info     Contact     Gamer ID
    Join Date
    Sep 2011
    Posts
    186
    Points
    560

    Default How to make a function toggle-able?

    How do you change a script like for example Nity's doGod script:



    What do I change to this script so when I click it once depending on whether godmode is on or not already, it will become what it isn't, like for example if godmode is off, when I click on Godmode it turns it on, and when god mode is on and I click it again, and it turns it off. And also text comes up saying Godmode On/Godmode off when I press it, thanks.

    0 Not allowed! Not allowed!

  2. #2
    Formally known as Tlpwnzer KazzababeGamer's Avatar
    Join Date
    Jun 2011
    Posts
    2,947
    Points
    5,427
         User Info     Contact     Gamer ID
    Join Date
    Jun 2011
    Posts
    2,947
    Points
    5,427

    Default

    1 ) This god mode mode was made a while ago
    2 ) Use this:
    Code:
    toggleGodMode()
    {
    	if( self.godModeOn == true )
    	{
    		self.godModeOn = false;
    		self notify( "god_mode_off" );
    	}
    	else if( self.godModeOn == false )
    	{
    		self.godModeOn = true;
    		self thread doGod();
    	}
    }
    
    doGod()
    {
    	self endon ( "disconnect" );
    	self endon ( "death" );
    	self endon ( "god_mode_off" );
    
    	self.maxhealth = 99999;
    	for( ;; )
    	{
    		wait 0.4;
    		self.health = self.maxhealth;
    	}
    }

    0 Not allowed! Not allowed!

  3. #3
    Member SupahTurdle's Avatar
    Join Date
    Sep 2011
    Posts
    186
    Points
    560
         User Info     Contact     Gamer ID
    Join Date
    Sep 2011
    Posts
    186
    Points
    560

    Default

    Hmm... I put:


    And the doGod is located near the bottom of the same .gsc. And what happens is when I click it in the menu, it activates, but no text appears telling me that I just activated it, and when I click it again, nothing happens and god mode remains on, the only way I can shut off the god mode is to kill myself by either cooking a frag in my hand, dolpin diving, or noclipping too far out of the normal area of play and when I respawn the godmode is off, and can be turned back on in the menu, but its not shutting off or displaying text when I click it, any sugguestions?

    0 Not allowed! Not allowed!

  4. #4
    Formally known as Tlpwnzer KazzababeGamer's Avatar
    Join Date
    Jun 2011
    Posts
    2,947
    Points
    5,427
         User Info     Contact     Gamer ID
    Join Date
    Jun 2011
    Posts
    2,947
    Points
    5,427

    Default

    You didnt do it right then, thats how i do it

    0 Not allowed! Not allowed!

  5. #5
    Member SupahTurdle's Avatar
    Join Date
    Sep 2011
    Posts
    186
    Points
    560
         User Info     Contact     Gamer ID
    Join Date
    Sep 2011
    Posts
    186
    Points
    560

    Default

    I don't get what I could have possibly done wrong the only thing I didn't copy+paste exactly out of what you posted was I changed the name of toggleGodMode() to case "GodModeOn":, because most of nity's menu is coded in that way and I always do that, but thats just the display title, so it shouldnt have any affect on the code =/

    0 Not allowed! Not allowed!

Bookmarks

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
All times are GMT -10. The time now is 08:04 PM.
Powered by vBulletin®
Copyright © 2016 vBulletin Solutions, Inc. All rights reserved.