merhaba
arkadaşlar hazırladığım bir script var bunu ilk oluşturulan her karakterlerde çıkmasını istiyorum bunun için "CharacterCreation.cs içinde EventSink_CharacterCreated methodunun altına bir yere ekliyorum"

eklediğim kod bir komut sayesinde çalışıyor fakat yeni açılan bir karakter için otomatik ekrana çıkmasını yapamadım.
ekranda çıkması için hazırladığım kod aşşağıda ama işe yaramıyor. neden olabilir?
m_Mobile.SendGump(new PlayerNameControl(m_Mobile));

// bu tür bir kodu aynı yere ekleyince çalışıyor fakat yukardaki kodu ekleyince çalışmıyor.
m_Mobile.Name = "Test";


buda kendi hazırladığım kod
using System;
using System.Collections.Generic;
using System.Text;
using Server.Gumps;
using Server.Commands;
using Server.Mobiles;
using System.Collections;
using System.Text.RegularExpressions;

namespace Server.Custom
{
    public class PlayerNameControl : Gump
    {
        Mobile p_mobile;
        public static void Initialize()
        {
            CommandSystem.Register("Kontrol", AccessLevel.Administrator, new CommandEventHandler(Admin_OnCommand));
        }

        public static void Admin_OnCommand(CommandEventArgs e)
        {
            e.Mobile.SendGump(new PlayerNameControl(e.Mobile));
        }

        public PlayerNameControl(Mobile Player)
            : base(100, 100)
        {
            p_mobile = Player;
            p_mobile.Name = "IsimBulPageAt";

            this.Closable = false;
            //this.Resizable = false;
            //this.Dragable = false;
            AddPage(0);
            AddBackground(0, 0, 200, 100, 0x2486);
            AddLabel(13, 11, 0x480, "Lütfen yeni isminizi belirtiniz.");
            AddTextEntry(12, 30, 131, 20, 0x480, 3, "");
            AddButton(12, 61, 4005, 4007, 1, GumpButtonType.Reply, 0);
        }

        public override void OnResponse(Network.NetState sender, RelayInfo info)
        {
            TextRelay trYeniIsim = info.GetTextEntry(3);
            if (trYeniIsim.Text.Length < 3)
            {
                p_mobile.SendMessage(30, "İsminiz Minimum 3 / Maximum 15 hane olabilir lütfen tekrar deneyiniz.");
                p_mobile.SendGump(new PlayerNameControl(sender.Mobile));
                return;
            }
            string YeniIsim = trYeniIsim.Text.TrimStart(' ').TrimEnd(' ');
            switch (info.ButtonID)
            {
                case 1:
                    if (YeniIsim.Length > 15)
                    {
                        p_mobile.SendMessage(30, "İsminiz Minimum 3 / Maximum 15 hane olabilir lütfen tekrar deneyiniz.");
                        p_mobile.SendGump(new PlayerNameControl(sender.Mobile));
                        return;
                    }
                    foreach (Mobile Player in World.Mobiles.Values)
                    {
                        if (Player is PlayerMobile)
                        {
                            if (Player.Name == YeniIsim)
                            {
                                p_mobile.SendMessage(30, "Bu isim birbaşkası tarafından kullanılıyor.");
                                p_mobile.SendGump(new PlayerNameControl(sender.Mobile));
                                return;
                            }
                        }
                    }
                    Regex validator = new Regex(@"[^\w\s0-9]");
                    Regex validator2 = new Regex("([0-9])");
                    if (!validator.IsMatch(YeniIsim) == true & validator2.IsMatch(YeniIsim) == false)
                    {
                        string[] lent = YeniIsim.Split(' ');
                        if (lent.Length != 2 & lent.Length != 1)
                        {
                            p_mobile.SendMessage(30, "Maxsimum 1 boşluk.");
                            p_mobile.SendGump(new PlayerNameControl(sender.Mobile));
                            return;
                        }
                        if (YeniIsim.Length == 3 | YeniIsim.Length < 3)
                        {
                            int iv = YeniIsim.IndexOf(" ");
                            if (iv != -1)
                            {
                                p_mobile.SendMessage(30, "Kısa isimlere boşluk yakışmaz.");
                                p_mobile.SendGump(new PlayerNameControl(sender.Mobile));
                                return;
                            }
                        }
                        this.Closable = true;
                        p_mobile.SendMessage(0x70, "İsminiz {0}'den {1}'e değiştirildi.", p_mobile.Name, YeniIsim);
                        p_mobile.Name = YeniIsim;
                    }
                    else
                    {
                        p_mobile.SendMessage(30, "Sadece harf yazabilirsiniz.");
                        p_mobile.SendGump(new PlayerNameControl(sender.Mobile));
                    }
                    break;
            }
        }

    }
}



Bu konu mastik750 tarafından düzenlendi(2011-10-11 06:19, 12 yıl önce)
Mobile goster = goster.Mobile;
goster.SendGump = ( new PlayerNameControl());

Bu şekilde bir denermisin. Test etmedim fakat bir test et.

Bu konu Eraser Shroud tarafından düzenlendi(2011-10-15 23:28, 12 yıl önce)

Üye Ol veya Giriş Yap

Bu forum başlığına mesaj atmak istiyorsanız hemen üye olun veya giriş yapın.