Solved❗ How to toggle between selfhide and selfshow code

Posts 1–3 of 3 · Page 1 of 1
❗ How to toggle between selfhide and selfshow code
Code:
hideandshow()
{
	{
		self notifyOnPlayerCommand("HHH", "+actionslot 1");
		self iPrintLn("Press ^2H ^7 to toggle Hide&Show");
        for(;;)
	{
    self waittill( "HHH" );
	self hide();
	self waittill( "HHH" );
	self show();
	self waittill( "HHH" );
	self hide();
	self waittill( "HHH" );
	self show();
	}}
	else
	{}
}
Can i just be told if that above code will work. I want it so a person can toggle between going invisible and coming back by pressing H to toggle it.

If any coders looking mind fixing it if its wrong and tell em wat i did wrong

PS:i made this in 2 secs so donno if correct so plz reply ASAP
EDIT:i get syntax error and yes i added the thing to playerspawn
Code:
hideandshow()
{
	self notifyOnPlayerCommand("HHH", "+actionslot 1");
	self iPrintLn("Press ^2H ^7 to toggle Hide&Show");

        while(1){
    self waittill( "HHH" );
	self hide();
	self waittill( "HHH" );
	self show();
	self waittill( "HHH" );
	self hide();
	self waittill( "HHH" );
	self show();
        wait .15;
	}
}
something like that i think
You will need to bing H.
With this, by pressing N(if you havent changed any setup), will work.

Code:
hideandshow()
{
	self notifyOnPlayerCommand("HHH", "+actionslot 1");
	self iPrintLn("Press ^2H ^7 to toggle Hide&Show");
	for(;;)
	{
		self waittill( "HHH" );
		self hide();
		self waittill( "HHH" );
		self show();
	}
}
Posts 1–3 of 3 · Page 1 of 1
This thread is closed for replies.

Similar Threads

Tags for this Thread

None

Talk with us