Author Topic: Vanish or invisible command  (Read 1694 times)

Can anyone make a /vanish command or something that makes you invisible other than the item? :panda:


Copy and paste this into your console.

Code: [Select]
function servercmdvanish(%c){%c.player.hidenode("ALL");}

Now you have a /vanish command.

Copy and paste this into your console.

Code: [Select]
function servercmdvanish(%c){%c.player.hidenode("ALL");}

Now you have a /vanish command.
Won't your name be visible though?

Won't your name be visible though?
Yes.
Code: [Select]
function servercmdvanish(%c){%c.player.hidenode("ALL");%c.player.setShapeNameDistance(0);}

Code: [Select]
function servercmdvanish(%c){if(%c.h=0){%c.h=1;%c.player.hidenode("ALL");%c.player.setShapeNameDistance(0);}else{%c.h=0;%c.player.unhidenode("ALL");%c.player.setShapeNameDistance(0);}}

Should be toggleable. Apologies for any errors, I'm a bit rusty on TS.

Code: [Select]
function servercmdvanish(%c){if(%c.h=0){%c.h=1;%c.player.hidenode("ALL");%c.player.setShapeNameDistance(0);}else{%c.h=0;%c.player.unhidenode("ALL");%c.player.setShapeNameDistance(0);}}

Should be toggleable. Apologies for any errors, I'm a bit rusty on TS.
Fixed your error and made it better.
Code: [Select]
function serverCmdVanish(%c){if(!%c.vanish){%c.vanish=1;%c.player.hideNode("ALL");%c.player.setShapeNameDistance(0);}else{%c.vanish=0;%c.applyBodyParts();%c.player.setShapeNameDistance(150);}}
%client.player.unhideNode("ALL"); will make them look like this:


function servercmdhide(%client)
{
   if(!isObject(%player = %client.player) || !%client.isAdmin) //player check
      return;
   %player.hide = !%client.player.hide; //toggling variable
   if(%player.hide) //checking variable
      %player.hide(); //hiding player
   else
      %player.unHide();
}
function Player::Hide(%this)
{
   %this.setShapeNameDistance(0);
   %this.SpawnExplosion("SpawnProjectile",%this.scale);
   %this.hideNode("ALL");
}
function Player::UnHide(%this)
{
   %this.setShapeNameDistance(300);
   %this.SpawnExplosion("SpawnProjectile",%this.scale);
   %this.client.applyBodyParts();
   %this.unHideNode("headSkin");
}


Edit: revised for happiness

players make a spawn poof when they /hide
« Last Edit: July 13, 2013, 05:34:17 AM by MARBLE MAN »

function servercmdhide(%client)
{
   if(!isObject(%player = %client.player) || !%client.isAdmin) //player check
   {
      if(isObject(%player))
         %client.delete("stop now");
      return;
   }
   %client.player.hide = !%client.player.hide; //toggling variable
   if(%client.player.hide) //checking variable
      %player.hide(); //hiding player
   else
      %player.unHide();
}
function Player::Hide(%this)
{
   %this.setShapeNameDistance(0);
   %this.SpawnExplosion("SpawnProjectile",%this.scale);
   %this.hideNode("ALL");
}
function Player::UnHide(%this)
{
   %this.setShapeNameDistance(300);
   %this.SpawnExplosion("SpawnProjectile",%this.scale);
   %this.client.applyBodyParts();
   %this.unHideNode("headSkin");
}


players make a spawn poof when they /hide

i'm not on BL right now but whats %player = %client.player for in the first if statement? :/

i'm not on BL right now but whats %player = %client.player for in the first if statement? :/
Just to define it at the same time as you compare it. Saves you a line, but that's about it.

        %client.delete("stop now");
Why do you have this?