Graal Forums  

Go Back   Graal Forums > Development Forums > NPC Scripting
FAQ Members List Calendar Today's Posts

 
 
Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #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
 


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +2. The time now is 03:23 AM.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2024, vBulletin Solutions Inc.
Copyright (C) 1998-2019 Toonslab All Rights Reserved.