Graal Forums

Graal Forums (https://forums.graalonline.com/forums/index.php)
-   Bug Report (https://forums.graalonline.com/forums/forumdisplay.php?f=193)
-   -   Weird Trigger Behaviour (https://forums.graalonline.com/forums/showthread.php?t=134267750)

ffcmike 01-09-2013 11:46 PM

Weird Trigger Behaviour
 
This is not necessarily a bug, and I also noticed this as a result of a mistake, but imagine quit(); being invoked in the following scenario:

PHP Code:

function onActionServerside(temp.param){
  if(
temp.param == "quit"){
    
temp.obj this.cache.(@ player.account);
    
//really should have - temp.obj.playerlist.remove(player);
    
for(temp.pl temp.obj.playerlist){
      
temp.pl.triggerclient("gui"this.name"takeWeapon");
    }
  }
}

//#CLIENTSIDE
function onActionClientside(temp.param){
  if(
temp.param == "takeWeapon"){
    
this.takeWeapon();
  }
}

function 
quit(){
  
triggerserver("gui"this.name"quit");
  
this.takeWeapon();
}

function 
takeWeapon(){
  
this.doRandomStuff();
  
this.destroy();


So basically, this script is destroying the weapon on your client, after sending a trigger to the server in order to send a trigger to the clients within a list of players, including yourself.

The problem I've noticed is that due to the weapon already being destroyed on your client, the triggerclient from the server is actually being invoked the next time you have the weapon added to you. In this case, it would cause the weapon to destroy itself upon being added to you a 2nd time.

mewtoo18 01-15-2013 02:35 PM

Quote:

Originally Posted by ffcmike (Post 1711899)
This is not necessarily a bug, and I also noticed this as a result of a mistake, but imagine quit(); being invoked in the following scenario:

PHP Code:

function onActionServerside(temp.param){
  if(
temp.param == "quit"){
    
temp.obj this.cache.(@ player.account);
    
//really should have - temp.obj.playerlist.remove(player);
    
for(temp.pl temp.obj.playerlist){
      
temp.pl.triggerclient("gui"this.name"takeWeapon");
    }
  }
}

//#CLIENTSIDE
function onActionClientside(temp.param){
  if(
temp.param == "takeWeapon"){
    
this.takeWeapon();
  }
}

function 
quit(){
  
triggerserver("gui"this.name"quit");
  
this.takeWeapon();
}

function 
takeWeapon(){
  
this.doRandomStuff();
  
this.destroy();


So basically, this script is destroying the weapon on your client, after sending a trigger to the server in order to send a trigger to the clients within a list of players, including yourself.

The problem I've noticed is that due to the weapon already being destroyed on your client, the triggerclient from the server is actually being invoked the next time you have the weapon added to you. In this case, it would cause the weapon to destroy itself upon being added to you a 2nd time.

Does it still do that if you remove the weapon rather then destroy it?


All times are GMT +2. The time now is 08:42 AM.

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