05-27-2012, 23:24
05-28-2012, 07:01
Replace the function with this instead:
Then, at the bottom of onPlayerConnect, add the last line after the others:
Now you can still toggle invisibility even if you die.
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, 12:10
(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.
05-28-2012, 13:31
Oh, you need to add a for/while loop, try with this instead:
Make sure to keep the other line where it is.
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:53
(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
Code:
self notifyOnPlayerCommand( "toggle", "+mlook" );
05-28-2012, 14:29
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.
And what you think about this code?
It is restarting itself after an usage: tried I and worked.
Which one is better and why?
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?
05-28-2012, 15:11
Yes, is necesary 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, 16:23
(05-28-2012, 15:11)Yamato Wrote: [ -> ]Yes, is necesary 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) ]
05-28-2012, 16:57
(05-28-2012, 16:23)TheRaZ Wrote: [ -> ](05-28-2012, 15:11)Yamato Wrote: [ -> ]Yes, is necesary 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) ]
Yes I was saying that you can also put it out of it.