View Single Post
  #1  
Old 01-09-2013, 11:46 PM
ffcmike ffcmike is offline
Banned
Join Date: Jul 2004
Location: London
Posts: 2,029
ffcmike has a reputation beyond reputeffcmike has a reputation beyond reputeffcmike has a reputation beyond reputeffcmike has a reputation beyond reputeffcmike has a reputation beyond reputeffcmike has a reputation beyond reputeffcmike has a reputation beyond reputeffcmike has a reputation beyond repute
Send a message via AIM to ffcmike Send a message via MSN to ffcmike
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.
Reply With Quote