//PlayerMobile pm = this as PlayerMobile;
XmlValue money = (XmlValue)XmlAttach.FindAttachment(this, typeof (XmlValue), "money");
Code://PlayerMobile pm = this as PlayerMobile; XmlValue money = (XmlValue)XmlAttach.FindAttachment(this, typeof (XmlValue), "money");
this shows that you at first had the right idea but you didnt really understand it.
"this" is a reference to the current instance of the class you are in. Therefor "this" would be your gump.
You need to get a reference to the player in your gump and then pass it in your FindAttachment method
if (money != null)
{
AddLabel(198, 95, 1156, String.Format("{0}", this ));
}
public sorakagump() : base( 0, 0 )
{
this.Closable=false;
this.Disposable=true;
this.Dragable=true;
this.Resizable=false;
//PlayerMobile pm = (PlayerMobile)m;
XmlValue money = (XmlValue)XmlAttach.FindAttachment(this, typeof (XmlValue), "money");
AddPage(0);
AddBackground(1, 40, 279, 122, 2620);
PlayerMobile mobile = (PlayerMobile)m;
if (m.Player && m != null)
{
if (money != null)
{
AddLabel(198, 95, 1156, String.Format("{0}", money ));
}
AddLabel(123, 51, 1171, "Name");
AddLabel(115, 96, 165, "Gold");
AddImage(8, 65, 21639);
AddItem(198, 95, 3823);
AddItem(185, 101, 3823);
AddItem(210, 100, 3823);
}
}
public sorakagump(PlayerMobile pm) : base( 0, 0 )
{
Closable=false;
Disposable=true;
Dragable=true;
Resizable=false;
AddPage(0);
AddBackground(1, 40, 279, 122, 2620);
XmlValue money = (XmlValue)XmlAttach.FindAttachment(pm, typeof (XmlValue), "money");
if (money != null)
{
AddLabel(198, 95, 1156, String.Format("{0}", money ));
}
AddLabel(123, 51, 1171, "Name");
AddLabel(115, 96, 165, "Gold");
AddImage(8, 65, 21639);
AddItem(198, 95, 3823);
AddItem(185, 101, 3823);
AddItem(210, 100, 3823);
}
We use essential cookies to make this site work, and optional cookies to enhance your experience.