View Single Post
  #2  
Old 01-15-2013, 02:35 PM
mewtoo18 mewtoo18 is offline
Registered User
Join Date: Sep 2003
Location: Southbend IN
Posts: 41
mewtoo18 is on a distinguished road
Quote:
Originally Posted by ffcmike View Post
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?
Reply With Quote