Graal Forums  

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

Reply
 
Thread Tools Search this Thread Display Modes
  #1  
Old 04-13-2011, 02:25 AM
Astram Astram is offline
Era iPhone PR
Astram's Avatar
Join Date: Aug 2010
Posts: 324
Astram can only hope to improve
Send a message via AIM to Astram
Talking 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.

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)
__________________
-Toad
The worlds biggest Toad fan...
Era iPhone FTW!


Reply With Quote
  #2  
Old 04-13-2011, 02:58 AM
fowlplay4 fowlplay4 is offline
team canada
fowlplay4's Avatar
Join Date: Jul 2004
Location: Canada
Posts: 5,200
fowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond repute
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'
__________________
Quote:
Reply With Quote
  #3  
Old 05-04-2011, 04:49 PM
Twaina Twaina is offline
Registered User
Join Date: Dec 2010
Posts: 59
Twaina has a little shameless behaviour in the past
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"

Reply With Quote
  #4  
Old 05-05-2011, 07:36 PM
Emera Emera is offline
Delterian Hybrid
Emera's Avatar
Join Date: Mar 2011
Location: Newcastle Upon-Tyne
Posts: 1,704
Emera is a jewel in the roughEmera is a jewel in the rough
Who scripted that twaina?
__________________
Reply With Quote
  #5  
Old 05-05-2011, 08:02 PM
PowerProNL PowerProNL is offline
Retired Zone Manager
PowerProNL's Avatar
Join Date: Feb 2008
Location: Holland
Posts: 266
PowerProNL can only hope to improve
Send a message via AIM to PowerProNL
I use this to style: http://www.javascriptbeautifier.com

Quote:
Originally Posted by Emera View Post
Who scripted that twaina?
XD!!!!
__________________
Graal Mail: [email protected]
McPowerProNL, I'm loving it
Reply With Quote
  #6  
Old 05-05-2011, 08:06 PM
Twaina Twaina is offline
Registered User
Join Date: Dec 2010
Posts: 59
Twaina has a little shameless behaviour in the past
Calli
Reply With Quote
  #7  
Old 05-05-2011, 08:07 PM
Twaina Twaina is offline
Registered User
Join Date: Dec 2010
Posts: 59
Twaina has a little shameless behaviour in the past
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
Reply With Quote
  #8  
Old 05-05-2011, 08:13 PM
Emera Emera is offline
Delterian Hybrid
Emera's Avatar
Join Date: Mar 2011
Location: Newcastle Upon-Tyne
Posts: 1,704
Emera is a jewel in the roughEmera is a jewel in the rough
Couldn't you have put that in the post?
__________________
Reply With Quote
  #9  
Old 05-05-2011, 08:14 PM
Tigairius Tigairius is offline
The Cat
Tigairius's Avatar
Join Date: Jan 2007
Location: Missouri, USA
Posts: 4,240
Tigairius has a brilliant futureTigairius has a brilliant futureTigairius has a brilliant futureTigairius has a brilliant futureTigairius has a brilliant futureTigairius has a brilliant futureTigairius has a brilliant futureTigairius has a brilliant future
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.
__________________


“Shoot for the moon. Even if you miss, you'll land among the stars.”
Reply With Quote
  #10  
Old 05-05-2011, 08:15 PM
Emera Emera is offline
Delterian Hybrid
Emera's Avatar
Join Date: Mar 2011
Location: Newcastle Upon-Tyne
Posts: 1,704
Emera is a jewel in the roughEmera is a jewel in the rough
He never lets us down
__________________
Reply With Quote
  #11  
Old 05-05-2011, 08:26 PM
WhiteDragon WhiteDragon is offline
Banned
Join Date: Feb 2007
Posts: 1,002
WhiteDragon is a splendid one to beholdWhiteDragon is a splendid one to beholdWhiteDragon is a splendid one to beholdWhiteDragon is a splendid one to beholdWhiteDragon is a splendid one to behold
Quote:
Originally Posted by Tigairius View Post
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 View Post
Who scripted that twaina?
Quote:
Originally Posted by Emera View Post
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.
Reply With Quote
  #12  
Old 05-05-2011, 08:30 PM
Twaina Twaina is offline
Registered User
Join Date: Dec 2010
Posts: 59
Twaina has a little shameless behaviour in the past
Yeah i asked to post it...
Reply With Quote
  #13  
Old 05-05-2011, 10:33 PM
Astram Astram is offline
Era iPhone PR
Astram's Avatar
Join Date: Aug 2010
Posts: 324
Astram can only hope to improve
Send a message via AIM to Astram
Quote:
Originally Posted by Twaina View Post
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
__________________
-Toad
The worlds biggest Toad fan...
Era iPhone FTW!


Reply With Quote
  #14  
Old 07-18-2012, 05:35 AM
Bleachlover551 Bleachlover551 is offline
Soul Reaper
Bleachlover551's Avatar
Join Date: Jul 2012
Location: Brunswick
Posts: 34
Bleachlover551 is an unknown quantity at this point
Does this cover nicks also?

does this hide nicks?
Reply With Quote
  #15  
Old 07-18-2012, 06:34 AM
Hezzy002 Hezzy002 is offline
Registered User
Join Date: Jul 2011
Posts: 247
Hezzy002 is a jewel in the roughHezzy002 is a jewel in the rough
Quote:
Originally Posted by Tigairius View Post
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.

Last edited by Tigairius; 07-22-2012 at 07:18 PM.. Reason: Inappropriate
Reply With Quote
Reply


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 05:34 PM.


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