View Single Post
  #1  
Old 01-10-2006, 07:53 PM
Tom Tom is offline
Grraaaaaw
Tom's Avatar
Join Date: May 2005
Posts: 2,037
Tom is on a distinguished road
Suggestion: Clientside Class

Clientside TStaticVar CAN'T join classes. In a former thread it was said it was due to security risk. However, why can't classes be scripted in the Weapon NPC and make the scripts truly class-oriented?

PHP Code:
class item
{
  function 
item( id = 0, quant = 1 ) // Constructor
  
{
    
this.index = id;
    
this.quant = quant;
  }
  function 
drop( quant = 1 )
  {
    if (
quant > this.quant) quant = this.quant;
    if (
quant < 1) return false;
    
triggeraction(0, 0, "serverside", "Items", this.id, this.quant);
  }
} 
Or, even more in depth, more functions to the actual classes:

PHP Code:
class wearableitem : public item
{
  function 
wearableitem( id = 0, quant = 1) : item:item( id, quant );

  function 
wear()
  {
    if (
this.worn) return true;
 
    
player.wear ++;
    
this.worn = true;

    return 
true;
  }
  function 
remove()
  {
    if (!
this.worn) return true;

    
player.wear --;
    
this.worn = false;
    return 
true;
  }
}