Graal Forums

Graal Forums (https://forums.graalonline.com/forums/index.php)
-   NPC Scripting (https://forums.graalonline.com/forums/forumdisplay.php?f=8)
-   -   Robbing; help (https://forums.graalonline.com/forums/showthread.php?t=83659)

pig132 01-13-2009 07:02 AM

Robbing; help
 
So I have this script, I know its not the most effecient, but I am still learning. I am having trouble using the triggeractions, obviously, and also getting it to only effect the player who grabbed the safe.

I have this in the class:
PHP Code:

function onActionServerside() {
  
player.guild = "Robbing!";
  
playerrupees += 1000;
}
//#CLIENTSIDE
function onCreated()
{
  for (
pl:allplayers) {
    if (
player.guild = "test") {
      
player.chat = "Alert:" SPC player.account SPC "is robbing the safe at" SPC player.level;
  }
}
  
robbing = false;
  
setTimer(0.05);
  new 
GuiProgressCtrl("Rob_Progress") {
    
profile = GuiBlueProgressProfile;
    
x = 0;
    
y = 0;
    
width = 160;
    
height = 20;
    
progress = 0;
    
visible = false;
  }
  new 
GuiButtonCtrl("Cancel_Button") {
    
profile = GuiBlueButtonProfile;
    
x = 170;
    
y = 0;
    
width = 50;
    
height = 20;
    
text = "Abort";
    
visible = false;
  }
}
if (
robbing = false) {
  function 
onTimeout() {
    
Rob_Progress.visible = true;
    
Cancel_Button.visible = true;
    
setTimer(0.05);
    
disabledefmovement;
    
robbing = true;
    
Rob_Progress.progress += 0.01;
    
timeout=0.05;
    
//player.chat = Rob_Progress.progress;
    
setTimer(0.05);
      if (
Rob_Progress.progress = 1) {
        
setTimer(0);
        
enabledefmovement;
        
Rob_Progress.visible = false;
        
Cancel_Button.visible = false;
        
player.chat = "Sucessfully robbed the safe!";
        
//triggeraction(0,0,"serverside",onTimeout);
    
}
  }
}
function 
Cancel_Button.onAction() {
  if (
robbing = true) {
    
robbing = false;
    
enabledefmovement;
    
setTimer(0);
    
player.chat = "Aborted robbery!";
    
sleep(1);
    
Rob_Progress.visible = false;
    
Cancel_Button.visible = false;
  }
} 


Tigairius 01-13-2009 07:33 AM

PHP Code:

triggeraction(0, 0, this.name, "serverside"); 

or

PHP Code:

triggerserver("gui", this.name); 


pig132 01-13-2009 08:10 AM

Doesn't seem to be working. It is in a class, can you use triggeractions in classes? Maybe thats why it effects everyone in the level aswell?

Crow 01-13-2009 03:10 PM

If it's in a class, you need to have a serverside shape set, so it can be triggered, and you cannot use "serverside" or "clientside" as action names.
Example:

PHP Code:

function onCreated()
  
setShape(1, 32, 32);

function 
onActionExample()
  
this.chat = "Oh my god, I was triggered!";

//#CLIENTSIDE
function onCreated()
  
triggerAction(this.x, this.y, "Example", nil); 


pig132 01-14-2009 05:31 AM

Thanks! ^^ Got it


All times are GMT +2. The time now is 05:37 PM.

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