Post Reply 
 
Thread Rating:
  • 1 Votes - 1 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Toggle invisible admin
05-27-2012, 23:24
Post: #21
RE: Toggle invisible admin
I liek mudkipz Mudkip
Related links

[Image: 4xu.png]
U JELLY?
+rep me if I've been helpful Big Grin Thanks.
Find all posts by this user
Add Thank You Quote this message in a reply
05-28-2012, 07:01 (This post was last modified: 05-28-2012 07:02 by master131.)
Post: #22
RE: Toggle invisible admin
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.

[Image: 30xhrep.png]

A casual conversation between barata and I about Nukem.
Find all posts by this user
Add Thank You Quote this message in a reply
05-28-2012, 12:10
Post: #23
RE: Toggle invisible admin
(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.
Find all posts by this user
Add Thank You Quote this message in a reply
05-28-2012, 13:31
Post: #24
RE: Toggle invisible admin
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.
Related links

[Image: 30xhrep.png]

A casual conversation between barata and I about Nukem.
Find all posts by this user
Add Thank You Quote this message in a reply
[-] The following 1 user says Thank You to master131 for this post:
TheRaZ (05-28-2012)
05-28-2012, 13:53
Post: #25
RE: Toggle invisible admin
(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" );

[Image: veovuq.png]
Find all posts by this user
Add Thank You Quote this message in a reply
05-28-2012, 14:29 (This post was last modified: 05-28-2012 14:30 by TheRaZ.)
Post: #26
RE: Toggle invisible admin
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?
Find all posts by this user
Add Thank You Quote this message in a reply
05-28-2012, 15:11
Post: #27
RE: Toggle invisible admin
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" );

[Image: veovuq.png]
Find all posts by this user
Add Thank You Quote this message in a reply
05-28-2012, 16:23
Post: #28
RE: Toggle invisible admin
(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
Related links
Find all posts by this user
Add Thank You Quote this message in a reply
05-28-2012, 16:57
Post: #29
RE: Toggle invisible admin
(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

[Image: veovuq.png]
Find all posts by this user
Add Thank You Quote this message in a reply
Post Reply 


Possibly Related Threads...
Thread: Author Replies: Views: Last Post
  Admin menu don't work michiix 5 556 07-16-2011 04:26
Last Post: Cgallagher
  Admin Menu Question GeKKoFL0X 6 572 01-26-2011 16:40
Last Post: GeKKoFL0X

Forum Jump:


User(s) browsing this thread: 1 Guest(s)
Media Embeding by Simple Audio Video Embeder