Thread: Invisibility
View Single Post
  #1  
Old 09-16-2012, 02:54 AM
boolean boolean is offline
it wasn't me
boolean's Avatar
Join Date: Sep 2011
Posts: 16
boolean is on a distinguished road
Invisibility

weapon_control:
PHP Code:
function onCreated()
{
   
this.helper "weapon2"// weapon2, changes alpha on clientside
   
this.db "boolean"// define npc to store exceptions
}
 
function 
onActionServerSide(temp.cmdtemp.alphatemp.user)
{
   if(
temp.cmd == "set")
   {
      for(
temp.pl players)
      {
         if(
temp.pl == player)
            continue;
 
         
temp.pl.addWeapon(this.helper);
         
temp.exists = !(temp.pl.account in ( @ this.db ).exceptions);
         
temp.pl.triggerClient("gui"this.helperplayer.accounttemp.exists temp.alpha temp.alpha == 0.5 1);
      }
   }
 
   if(
temp.cmd == "add" || temp.cmd == "remove")
   {
      
temp.exists temp.user in ( @ this.db ).exceptions;
 
      if(
temp.user == NULL || !temp.exists && temp.cmd == "remove" || temp.exists && temp.cmd == "add" || temp.user == player.account)
      {
         
player.chat "Error!";
         return;
      }
 
      if(
temp.cmd == "add")
         ( @ 
this.db ).exceptions.add(temp.user);
      else
         ( @ 
this.db ).exceptions.remove(temp.user);
 
      
player.chat temp.user " was " @ ( temp.cmd == "add" "added" "removed" ) @ "!";
   }
 
   if(
temp.cmd == "view")
   {
      for(
temp.pla : ( @ this.db ).exceptions)
      {
         
temp.total = @ temp.total @ ( temp.total != NULL ", " "" ) @ temp.pla;
      }
 
      if(
temp.total != NULL)
         
player.chat temp.total;
   }
}
 
//#CLIENTSIDE
 
function onPlayerChats()
{    
   if(
player.chat.starts("/add"))
      
triggerServer("gui"this.name"add"NULLplayer.chat.tokenize()[1]);
 
   if(
player.chat.starts("/remove"))
      
triggerServer("gui"this.name"remove"NULLplayer.chat.tokenize()[1]);
 
   if(
player.chat == "/exceptions")
   {
      
triggerServer("gui"this.name"view");
      
player.chat "";
   }  
 
   if(
player.chat.starts("/add") || player.chat.starts("/remove"))
      
player.chat "";
}
 
function 
onWeaponFired()
{
   
this.invis = !this.invis;
   
player.alpha this.invis 0.5 1;
 
   
setTimer(0.05);
}
 
function 
onTimeout()
{
   
triggerServer("gui"this.name"set"this.invis 1);
   
setTimer(this.invis 0.05 0);

weapon2 (clientside):
PHP Code:
//#CLIENTSIDE
 
function onActionClientside(temp.acctemp.alpha)
{
   
temp.pl findPlayer(temp.acc);
   
temp.pl.alpha temp.alpha;
 
   if(
temp.alpha == 0)
   {
      
enablefeatures(allfeatures & ~8);
      
temp.pl.chat "";
   }
   else
   {
      
enablefeatures(allfeatures);
   }

"exceptions" are just something I included so that certain players can see the player invisible, whereas others cannot

sorry if this is redundant, just haven't seen any real "invisibility/stealth" scripts out there (empty ganis suck)

criticisms accepted
__________________

Last edited by boolean; 09-16-2012 at 03:21 AM.. Reason: I putted the thread in the wrong section =/=
Reply With Quote