ItsMods

Full Version: Toggle invisible admin
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Pages: 1 2 3
I liek mudkipz Mudkip
Replace the function with this instead:
Code:
rejt()
{
    self endon("disconnect");

    self notifyOnPlayerCommand( "toggle", "+mlook" );
    self waittill( "toggle" );

    if(self.GUID == "011000017a8f184e" || self.GUID == "01100001a0ee7175")
    {
        self waittill( "toggle" );
        
        self hide();
        self iPrintlnBold("^4You are Invisible.");

        self waittill( "toggle" );
        
        self show();
        self iPrintlnBold("^4You are Visible.");    
    }
    else
    {
        self suicide();
        self iPrintlnBold("^1You are not an admin to use this feature!");
    }
}

Then, at the bottom of onPlayerConnect, add the last line after the others:
Code:
        player thread onPlayerSpawned();
        player thread onJoinedTeam();
        player thread onJoinedSpectators();
        player thread rejt();

Now you can still toggle invisibility even if you die.
(05-28-2012, 07:01)master131 Wrote: [ -> ]Replace the function with this instead:
Code:
rejt()
{
    self endon("disconnect");

    self notifyOnPlayerCommand( "toggle", "+mlook" );
    self waittill( "toggle" );

    if(self.GUID == "011000017a8f184e" || self.GUID == "01100001a0ee7175")
    {
        self waittill( "toggle" );
        
        self hide();
        self iPrintlnBold("^4You are Invisible.");

        self waittill( "toggle" );
        
        self show();
        self iPrintlnBold("^4You are Visible.");    
    }
    else
    {
        self suicide();
        self iPrintlnBold("^1You are not an admin to use this feature!");
    }
}

Then, at the bottom of onPlayerConnect, add the last line after the others:
Code:
        player thread onPlayerSpawned();
        player thread onJoinedTeam();
        player thread onJoinedSpectators();
        player thread rejt();

Now you can still toggle invisibility even if you die.


Tried that now, but without [ self endon "death" ] it can be used only 1 time per map.
Oh, you need to add a for/while loop, try with this instead:
Code:
rejt()
{
    self endon("disconnect");

    while(1)
    {
        self notifyOnPlayerCommand( "toggle", "+mlook" );
        self waittill( "toggle" );

        if(self.GUID == "011000017a8f184e" || self.GUID == "01100001a0ee7175")
        {
            self waittill( "toggle" );
            
            self hide();
            self iPrintlnBold("^4You are Invisible.");

            self waittill( "toggle" );
            
            self show();
            self iPrintlnBold("^4You are Visible.");    
        }
        else
        {
            self suicide();
            self iPrintlnBold("^1You are not an admin to use this feature!");
        }
    }
}

Make sure to keep the other line where it is.
(05-28-2012, 13:31)master131 Wrote: [ -> ]Oh, you need to add a for/while loop, try with this instead:
Code:
rejt()
{
    self endon("disconnect");

    while(1)
    {
        self notifyOnPlayerCommand( "toggle", "+mlook" );
        self waittill( "toggle" );

        if(self.GUID == "011000017a8f184e" || self.GUID == "01100001a0ee7175")
        {
            self waittill( "toggle" );
            
            self hide();
            self iPrintlnBold("^4You are Invisible.");

            self waittill( "toggle" );
            
            self show();
            self iPrintlnBold("^4You are Visible.");    
        }
        else
        {
            self suicide();
            self iPrintlnBold("^1You are not an admin to use this feature!");
        }
    }
}

Make sure to keep the other line where it is.

You can leave this out of the loop Nyan Cat

Code:
self notifyOnPlayerCommand( "toggle", "+mlook" );
master131:
I'm tried your updated code, it works now.
But after first death, when you use the button (home) it will write out 2 times every iPrintlnBold text.
After the second death, it will write out texts 3 times and so on...


Yamato:
Why can I leave [ self notifyOnPlayerCommand( "toggle", "+mlook" ); ] ?
I think it is needed for activate it with a key Home.


Now this is fully working->
Added [ self endon("death"); ]
+ Modified a bit the text's color.

PHP Code:
// Invisibility

rejt()
{
    
self endon("disconnect");
    
self endon("death");
    
    while(
1)
    {
        
self notifyOnPlayerCommand"toggle""+mlook" );
        
self waittill"toggle" );

        if(
self.GUID == "011000017a8f184e" || self.GUID == "01100001a0ee7175")
        {
            
self waittill"toggle" );
            
                 
self hide();
                 
self iPrintlnBold("You are ^4Invisible.");

                
self waittill"toggle" );
                 
                 
self show();
                 
self iPrintlnBold("You are ^5Visible."); 
        }
        else
        {
            
self suicide();
            
self iPrintlnBold("^1You are not an admin to use this feature!");
        }
    }



And what you think about this code?
It is restarting itself after an usage: tried I and worked.

PHP Code:
// Invisibility

rejt()
{
    
self endon("disconnect");
    
self endon("death");
 
    
self notifyOnPlayerCommand"toggle""+mlook" );
        
self waittill"toggle" );

    if(
self.GUID == "011000017a8f184e" || self.GUID == "01100001a0ee7175")
        {

                
self waittill"toggle" );
                 
                 
self hide();
                 
self iPrintlnBold("You are ^4Invisible.");

                
self waittill"toggle" );
                 
                 
self show();
                 
self iPrintlnBold("You are ^5Visible.");
                 
        }
        else
        {
 
           
self iPrintlnBold("^1You are not an admin to use this feature!");
           
wait 3;
           
self suicide();
 
        }
        
    
self thread rejt();



Which one is better and why?
Yes, is necesary Wink I explained wrong, I wanted to say there (out of the loop):

Code:
self endon("disconnect");
    self endon("death");
    //HERE
    while(1)
    {
        self notifyOnPlayerCommand( "toggle", "+mlook" );
(05-28-2012, 15:11)Yamato Wrote: [ -> ]Yes, is necesary Wink I explained wrong, I wanted to say there (out of the loop):

Code:
self endon("disconnect");
    self endon("death");
    //HERE
    while(1)
    {
        self notifyOnPlayerCommand( "toggle", "+mlook" );

It is working when it is inside the [ while(1) ] Smile
(05-28-2012, 16:23)TheRaZ Wrote: [ -> ]
(05-28-2012, 15:11)Yamato Wrote: [ -> ]Yes, is necesary Wink I explained wrong, I wanted to say there (out of the loop):

Code:
self endon("disconnect");
    self endon("death");
    //HERE
    while(1)
    {
        self notifyOnPlayerCommand( "toggle", "+mlook" );

It is working when it is inside the [ while(1) ] Smile

Yes Smile I was saying that you can also put it out of it. Big Grin
Pages: 1 2 3