Graal Forums

Graal Forums (https://forums.graalonline.com/forums/index.php)
-   NPC Scripting (https://forums.graalonline.com/forums/forumdisplay.php?f=8)
-   -   Stealth Script Help (https://forums.graalonline.com/forums/showthread.php?t=134262756)

Astram 04-09-2011 04:38 AM

Stealth Script Help
 
PHP Code:

//Please dont steal this script from the forums, forum viewers.
function onActionServerSide()
  {
  if (
params[0] == "stealth")
    {
    for (
p : players)
      {
      
this.admins = {"Owner","Events Team","LAT"};
      if (!(
p.guild in this.admins))
      {
      
p.triggerclient("gui",this.name,"stealth",params[2],params[1]);
      }
      else
      {
      
temp.p2 = params[2];
      if (
findplayer(temp.p2).clientr.on = 1)
      {
      
p.triggerclient("gui",this.name,"stealth",params[2],0.75);
      }
      else
      {
      
p.triggerclient("gui",this.name,"stealth",params[2],1);
      }
      }
    }
    }
  }
//#CLIENTSIDE
function onKeyPressed(code, key, scancode)
  {
  if (
key == "5")
    {
    
this.canuse = {"Owner","LAT"}; 
     if (
player.guild in this.canuse)
      {
    if (
this.on == false)
      {
      
this.on = true;
      
triggerserver("gui",this.name,"stealth",0,player.account);
      
sleep(0.5);
      
player.alpha = 0.75;
      
client.message.add("Stealth Mode On");
      }
    else
      {
      
this.on = false;
      
triggerserver("gui",this.name,"stealth",1,player.account);
      
sleep(0.5);
      
player.alpha = 1;
      
client.message.add("Stealth Mode Off");
      }
    }
  }
  }
function 
onActionClientSide()
  {
  if (
params[0] == "stealth")
    {
    
findplayer(params[1]).alpha = params[2];
    }
  } 

This has been added to all players...
The problem is that the other admins who are defined in this.admins, only see us other stealthed admins with alpha 1, not alpha 0.75 which is a problem because you don't know if their in stealth, though other players can not see the player that is in stealth.

MrOmega 04-09-2011 05:44 AM

try this, just a quick thought script, haven't tested.
PHP Code:

function onCreated()
{

  
this.admins = { "Owner", "Events Team", "LAT"};

}

function 
onActionServerside()
{

  if ( 
params[ 0] == "stealth")
  {

    
player.clientr.stealthMode = !player.clientr.stealthMode;

    for ( 
temp.p : allplayers)
      
temp.p.triggerclient( "gui", this.name, "stealth", player.index,  player.clientr.stealthMode, ( temp.p.guild in this.admins));

  }
}

//#CLIENTSIDE

function onCreated()
{

  
this.canUse = { "Owner" ,"LAT"}; 

}

function 
onKeyPressed( temp.code, temp.key, temp.scancode)
{

  if ( 
temp.key == "5" && player.guild in this.canUse)
    
triggerserver( "gui", this.name, "stealth");

}

function 
onActionClientside()
{
  
  if ( 
params[ 0] == "stealth")
    
players[ params[ 1]].alpha = float( !params[ 3]? params[ 2]: (  params[ 2]? 0.75: 1));

} 


fowlplay4 04-09-2011 05:56 AM

This is a job better done by using ganis.

You can simply making a copy of walk, and idle. I.e: server_stealth-idle, server_stealth-walk.

Have this placed at the bottom of the ganis:

PHP Code:

SCRIPT
function onPlayerEnters() {
  if (
clientr.staff) {  // You will need to alter Control-NPC/Login
    
player.alpha = 0.5; // Scripts to set a flag if they're staff.
  
} else {
    
player.alpha = 0;
  }
}
SCRIPTEND 

then you can simply keep the weapon to your own. I.e:

-Staff/Stealth
PHP Code:

//#CLIENTSIDE
function onCreated() {
  
this.stealthed = false;
} 

function 
ChatBar.onAction() {
  if (
ChatBar.text == "/stealth") {
    
setStealth();
    
ChatBar.text = "";
  }
}

function 
setStealth() {
  
this.stealthed = !this.stealthed;
  if (
this.stealthed) {
    
replaceani("idle", "stealth-idle");
    
replaceani("walk", "stealth-walk");
  } else {
    
replaceani("idle", "idle");
    
replaceani("walk", "walk");
  }
} 


Astram 04-09-2011 06:22 AM

that didnt help xP

MrOmega 04-09-2011 06:34 AM

clarify

fowlplay4 04-09-2011 06:37 AM

Well we're not going to spoon feed you complete solutions, what part are you struggling with?

Astram 04-09-2011 07:01 AM

Well Mr.Omega's script had the same problem as mine, and with ganis' nicknames would show

fowlplay4 04-09-2011 07:19 AM

Quote:

Originally Posted by Astram (Post 1642263)
Well Mr.Omega's script had the same problem as mine, and with ganis' nicknames would show

Considering that both scripts effectively do the same thing (change the player's alpha) I would say that if the gani way shows nicknames than your way would too.


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

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