[마지막왕국] 관리자 권한 주기... 뭐가 문제일까요
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using System.IO;
using LKCamelot.net;
using LKCamelot.util;
using LKCamelot.model;
using LKCamelot.script;
using LKCamelot.io;
namespace LKCamelot
{
public partial class 제어창 : Form
{
public Player player;
public PlayerHandler handler;
public static Server w_server;
public 제어창()
{
InitializeComponent();
}
private void button1_Click(object sender, EventArgs e)
{
if (textBox1.Text == "")
return;
string chat = "[공지사항] :" + textBox1.Text + " ";
World.SendToAll(new QueDele("all", new UpdateChatBox(0x08, 0xff, 20737, (short)chat.Count(), chat).Compile()));
}
private void button2_Click(object sender, EventArgs e)
{
using (StreamWriter sw = new StreamWriter("worldAdmin.txt", true, Encoding.GetEncoding("euc-kr")))
{
sw.WriteLine(string.Format(",{0}", Nametext.Text));
}
//String pppfile = str2[1] + "님이 관리자로 등록 되었습니다." + " ";
//SendPacket(new UpdateChatBox(0xff, 0xff, 1, (short)pppfile.Count(), pppfile).Compile());
var plr2 = handler.add.Where(xe => xe.Value != null && xe.Value.GetFreeSlots() > 3 && xe.Value.Name == Nametext.ToString() && xe.Value.loggedIn).FirstOrDefault().Value;
string achat = "연구소 서버관리자로 임명되었습니다." + " ";
plr2.client.SendPacket(new UpdateChatBox(0xff, 0xff, 1, (short)achat.Count(), achat).Compile());
string achat2 = "기타내용" + " ";
plr2.client.SendPacket(new UpdateChatBox(0xff, 0xff, 1, (short)achat2.Count(), achat2).Compile());
}
private void textBox2_TextChanged(object sender, EventArgs e)
{
}
private void comboBox1_SelectedIndexChanged(object sender, EventArgs e)
{
}
private void button3_Click(object sender, EventArgs e)
{
}
private void 경험치배율ToolStripMenuItem_Click(object sender, EventArgs e)
{
경험치배율 frm = new 경험치배율();
frm.Show();
}
private void 제어창_Load(object sender, EventArgs e)
{
}
private void 잭팟설정ToolStripMenuItem_Click(object sender, EventArgs e)
{
잭팟 frm = new 잭팟();
frm.Show();
}
}
}
실행하면 제어창에 관리자 아이디 입력 후 관리자 추가 버튼 클릭하면
이 대화 상자 대신 JIT(Just-in-time) 디버깅을 호출하는
방법에 대한 자세한 내용은 이 메시지의 뒷부분을 참조하십시오.
************** 예외 텍스트 **************
System.NullReferenceException: 개체 참조가 개체의 인스턴스로 설정되지 않았습니다.
어떻게 수정해야할지.. ㅋㅋ

댓글1
-
조아욧2019.04.16 - 10:10 #4169568
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using System.IO;using LKCamelot.net;
using LKCamelot.util;
using LKCamelot.model;
using LKCamelot.script;using LKCamelot.io;
namespace LKCamelot
{
public partial class 제어창 : Form
{
public Player player;
public PlayerHandler handler;
public static Server w_server;
public 제어창()
{
InitializeComponent();
}private void button1_Click(object sender, EventArgs e)
{if (textBox1.Text == "")
return;
string chat = "[공지사항] :" + textBox1.Text + " ";
World.SendToAll(new QueDele("all", new UpdateChatBox(0x08, 0xff, 20737, (short)chat.Count(), chat).Compile()));}
private void button2_Click(object sender, EventArgs e)
{
using (StreamWriter sw = new StreamWriter("worldAdmin.txt", true, Encoding.GetEncoding("euc-kr")))
{
sw.WriteLine(string.Format(",{0}", Nametext.Text));}
String Admin = Nametext.Text + " 님이 관리자로 등록 되었습니다." + " ";
World.SendToAll(new QueDele("all", new UpdateChatBox(0x08, 0xff, 20737, (short)Admin.Count(), Admin).Compile()));}
private void textBox2_TextChanged(object sender, EventArgs e)
{}
private void comboBox1_SelectedIndexChanged(object sender, EventArgs e)
{}
private void button3_Click(object sender, EventArgs e)
{
}private void 경험치배율ToolStripMenuItem_Click(object sender, EventArgs e)
{
경험치배율 frm = new 경험치배율();
frm.Show();
}private void 제어창_Load(object sender, EventArgs e)
{}
private void 잭팟설정ToolStripMenuItem_Click(object sender, EventArgs e)
{
잭팟 frm = new 잭팟();
frm.Show();
}
}
}
령하진 님의 최근 댓글
src가 빠져있는데 이거 맞나요? 2023 07.02 ㄳㄳ 2023 05.28 감사합니다 2022 10.25 감사합니당 2022 06.20 감사합니다 2022 06.20