I have this old Mailbox script that is great and players love it.
Problem is . . the only player on their account that can open it is the first player they have who accessed it. That player then becomes the sole owner and their other characters on their account cannot open it.
Is there a way to have the Ownership apply to all characters on their account (not just the first one that used the mailbox)?
I thought about using an Account Tag but I don't think that would work. If I use a simple Account Tag then every player who owns a Mailbox could open all other Mailboxes.
So I am at a logic impasse on how/where to start to solve this.
Here is the Mailbox script:
Does anyone know of a solution?
Many Thanks
Problem is . . the only player on their account that can open it is the first player they have who accessed it. That player then becomes the sole owner and their other characters on their account cannot open it.
Is there a way to have the Ownership apply to all characters on their account (not just the first one that used the mailbox)?
I thought about using an Account Tag but I don't think that would work. If I use a simple Account Tag then every player who owns a Mailbox could open all other Mailboxes.
So I am at a logic impasse on how/where to start to solve this.
Here is the Mailbox script:
Code:
using System;
using System.Collections;
using Server.Multis;
using Server.Mobiles;
using Server.Network;
using System.Collections.Generic;
using Server.ContextMenus;
namespace Server.Items
{
public class MailBox : LockableContainer
{
private Mobile m_Owner;
public Mobile Owner
{
get { return m_Owner; }
set { m_Owner = value; InvalidateProperties(); }
}
[Constructable]
public MailBox() : base( 0x9A8 )
{
Name = "Mail Box";
Weight = 2.0;
}
public override void OnTelekinesis( Mobile from )
{
return;
}
public override void OnDoubleClick( Mobile from )
{
if( Owner == null && IsChildOf( from.Backpack ))
{
Owner = from;
from.SendMessage( "You now own this box!" );
base.OnDoubleClick( from );
}
else if( Owner == null)
{
from.SendMessage( "You can only set your self as owner of this box if it is in your pack!" );
}
else if( !IsSecure && IsAccessibleTo( from ) )
base.OnDoubleClick( from );
else if( Owner == from || from.AccessLevel > Owner.AccessLevel )
base.OnDoubleClick( from );
else
from.SendMessage( "This is not your box, you must be the owner to open it!" );
}
public override void GetProperties( ObjectPropertyList list )
{
base.GetProperties( list );
list.Add( 1072304, Owner == null ? "nobody" : Owner.Name );
}
public MailBox(Serial serial) : base(serial){}
public override void Serialize( GenericWriter writer )
{
base.Serialize( writer );
writer.Write( (int)1 );
writer.Write( m_Owner != null );
if( m_Owner != null ) writer.Write( m_Owner );
}
public override void Deserialize( GenericReader reader )
{
base.Deserialize( reader );
int version = reader.ReadInt();
if( reader.ReadBool() ) m_Owner = reader.ReadMobile();
}
}
}
Does anyone know of a solution?
Many Thanks