Graal Forums

Graal Forums (https://forums.graalonline.com/forums/index.php)
-   Code Gallery (https://forums.graalonline.com/forums/forumdisplay.php?f=179)
-   -   Staff Stealth (Complete) (https://forums.graalonline.com/forums/showthread.php?t=134262793)

Astram 04-13-2011 02:25 AM

Staff Stealth (Complete)
 
Hi, this is my first official, working script I made myself that is posted to the forums. =D

(in the stealth script help thread, I found my own way =D)

Add this weapon to all players, add a staff tag to, this.canuse for the guild be able to use it, and add a guild to the this.admins for them to be able to see the stealthed admins. Enjoy. This works on all servers, just simply install it, no ganis', no nothin'. All credit goes to me by the way. :D

PHP Code:

//Script Made By Toad (Astram)
function onActionServerSide()
  {
  if (
params[0] == "stealth")
    {
    for (
players)
      {
      
temp.alpha params[1];
      
temp.acct params[2];
      
temp.staffalpha params[3];
      
this.admins = {"Owner","PR Admin","NAT","GANI"}; 
       if (!(
p.guild in this.admins))
         {
         
p.triggerclient("gui",this.name,"stealth",temp.acct,temp.alpha);
         }
       else
         {
         
p.triggerclient("gui",this.name,"stealthadmin",temp.acct,temp.staffalpha);
         }
         }
         }
   if (
params[0] == "stealthcheck")
     {
     for (
pl players)
       {
       if (
pl.clientr.stealth == 1)
         {
         
pl.triggerlient("gui",this.name,"check",0,pl,0.5);
         }
         }
         }
         }
//#CLIENTSIDE
function onKeyPressed(codekeyscancode)
  {
  if (
key == "5")
    {
    
this.canuse = {"Owner","LAT","PR Admin","NAT","GANI"}; 
     if (
player.guild in this.canuse)
      {
    if (
this.on == false)
      {
      
this.on true;
      
clientr.on 1;
      
triggerserver("gui",this.name,"stealth",0,player.account,0.5);
      
client.message.add("Stealth Mode On");
      
clientr.stealth 1;
      }
    else
      {
      
clientr.on 0;
      
this.on false;
      
triggerserver("gui",this.name,"stealth",1,player.account,1);
      
client.message.add("Stealth Mode Off");
      
clientr.stealth 0;
      }
    }
  }
  }
function 
onActionClientSide()
  {
  if (
params[0] == "stealth")
    {
    
findplayer(params[1]).alpha params[2];
    }
  if (
params[0] == "stealthadmin")
    {
    
findplayer(params[1]).alpha params[2];
    }
  if (
params[0] == "check")
    {
    
this.admins = {"Owner","PR Admin","NAT","GANI"};
    if (!(
player.guild in this.admins))
    {
    
findplayer(params[2]).alpha params[1];
    }
    else
    {
    
findplayer(params[2]).alpha params[3];
    }
  }
  }
function 
onCreated()
  {
  
setTimer(.5);
  }
function 
onTimeOut()
  {
  
setTimer(.5);
  
triggerserver("gui",this.name,"stealthcheck");
  } 

=D

Btw, to use press 5 while your tag is on.
And if this script looks messy, it was me tinkering with it to fix up the glitchs in that area (stealthcheck for example)

fowlplay4 04-13-2011 02:58 AM

It's great that you want to contribute that said...

My issues with your script:

1. Your styling is a complete mess. At-least run it through: http://jsbeautifier.org/ (I know it's for Javascript but it works just fine for GS2)

2. Your system is incredibly in-efficient. An unnecessary trigger every half a second (2 triggers a second) by every player whether the system is in use or not is terrible. You also send a ridiculous amount of client triggers as a result.

3. You're setting clientr variables on the client-side, but doing nothing with them on the server-side.

4. Using a gani is a much more elegant solution to 'Staff Stealth' I'm not sure why you would tout the use of 'no ganis'

Twaina 05-04-2011 04:49 PM

I think its a hard script may you use it with clientr.isstaff and a stealth gani like this one here
PHP Code:

//#CLIENTSIDE
function onCreated() { 
  
player.attr[22] = "unstealth.gani"
}

function 
onPlayerChats() {
  if (
player.chat == "/stealth") {
    if (
clientr.isStaff) {
      
toggleStealth();
      
player.chat ="";
    }
  else
    
player.chat "I´m no Staff";
  }
  
  if(
player.chat == "/reconnect") {
    
ServerWarp(ServerName);
  }
}

function 
toggleStealth() { 
  
this.stealth = !this.stealth
  if (
this.stealth)
    
player.attr[22] = "stealth.gani"
  else 
    
player.attr[22] = "unstealth.gani"



Emera 05-05-2011 07:36 PM

Who scripted that twaina?

PowerProNL 05-05-2011 08:02 PM

I use this to style: http://www.javascriptbeautifier.com

Quote:

Originally Posted by Emera (Post 1647770)
Who scripted that twaina?

XD!!!!

Twaina 05-05-2011 08:06 PM

Calli

Twaina 05-05-2011 08:07 PM

He did that use ganis so its better and use clientr.isstaff so you can add the person that on attributes and you are stealth but you can see yourself like graal online on ipod

Emera 05-05-2011 08:13 PM

Couldn't you have put that in the post?

Tigairius 05-05-2011 08:14 PM

Cool. Seems like it might be easier to just do something like:

PHP Code:

//#CLIENTSIDE
function onPlayerChats() {
  
player.chat == "stealth" onTimeout() : (player.chat == "nostealth" setTimer(0) : NULL);
}

function 
onTimeout() {
  
hideplayer(0.1);
  
setTimer(0.1);


You can say "stealth" or "nostealth" to toggle it.

Emera 05-05-2011 08:15 PM

He never lets us down :D

WhiteDragon 05-05-2011 08:26 PM

Quote:

Originally Posted by Tigairius (Post 1647781)
PHP Code:

//#CLIENTSIDE
function onPlayerChats() {
  
player.chat == "stealth" onTimeout() : (player.chat == "nostealth" setTimer(0) : NULL);
}

function 
onTimeout() {
  
hideplayer(0.1);
  
setTimer(0.1);



Can't say I'm a huge fan of that usage of ?:. It should be used when you are actually doing something with the returned value, like temp.x = player.chat == "test" ? 132 : 22;. This way the operator maintains some semantic meaning.

In the case you have a statement where you don't intend on returning anything (like here), that seems like the perfect usage for a full if statement.

Your usage of it seems more like golfing.



Quote:

Originally Posted by Emera (Post 1647770)
Who scripted that twaina?

Quote:

Originally Posted by Emera (Post 1647780)
Couldn't you have put that in the post?

As much as Twaina really should have attributed whoever wrote the script, I feel like things are getting a little too confrontational.

The calmer the environment, the greater chance for productive conversation.

Twaina 05-05-2011 08:30 PM

Yeah i asked to post it...

Astram 05-05-2011 10:33 PM

Quote:

Originally Posted by Twaina (Post 1647522)
I think its a hard script may you use it with clientr.isstaff and a stealth gani like this one here
PHP Code:

//#CLIENTSIDE
function onCreated() { 
  
player.attr[22] = "unstealth.gani"
}

function 
onPlayerChats() {
  if (
player.chat == "/stealth") {
    if (
clientr.isStaff) {
      
toggleStealth();
      
player.chat ="";
    }
  else
    
player.chat "I´m no Staff";
  }
  
  if(
player.chat == "/reconnect") {
    
ServerWarp(ServerName);
  }
}

function 
toggleStealth() { 
  
this.stealth = !this.stealth
  if (
this.stealth)
    
player.attr[22] = "stealth.gani"
  else 
    
player.attr[22] = "unstealth.gani"



Scripting by Twinny

Bleachlover551 07-18-2012 05:35 AM

Does this cover nicks also?
 
does this hide nicks?

Hezzy002 07-18-2012 06:34 AM

Quote:

Originally Posted by Tigairius (Post 1647781)
Cool. Seems like it might be easier to just do something like:

PHP Code:

//#CLIENTSIDE
function onPlayerChats() {
  
player.chat == "stealth" onTimeout() : (player.chat == "nostealth" setTimer(0) : NULL);
}

function 
onTimeout() {
  
hideplayer(0.1);
  
setTimer(0.1);


You can say "stealth" or "nostealth" to toggle it.

Dude, that inline conditional is the ugliest thing I've ever seen in my life.


All times are GMT +2. The time now is 07:21 AM.

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